AI销管
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Keywordsearch.vue 6.4 KiB

2 年之前
1 年之前
2 年之前
1 年之前
2 年之前
2 年之前
1 年之前
2 年之前
2 年之前
1 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
1 年之前
2 年之前
2 年之前
2 年之前
2 年之前
1 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
1 年之前
2 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <view class="translation">
  3. <view class="box">
  4. <view style="width: 10%; height: 64rpx; display: flex; align-items: center">
  5. <image style="width: 28rpx; height: 28rpx; margin-left: 30rpx" src="/static/images/search.png" mode="">
  6. </image>
  7. </view>
  8. <view style="width: 90%; height: 64rpx; display: flex; align-items: center">
  9. <input type="text" @input="searchinfo" v-model="keyword" placeholder="请输入关键字"
  10. style="width: 100%; color: #999999; font-size: 24rpx" />
  11. </view>
  12. </view>
  13. <view class="box-list">
  14. <view style="width: 100%; padding-bottom: 10rpx;" v-for="(item, index) in listarr" :key="index"
  15. @click="toaidoinfo(item.Content, item.corpusId, item.index)">
  16. <view class="item-list">
  17. <view class="icon">
  18. <image style="width: 26rpx; height: 28rpx" src="../../static/images/testimg.png" mode="">
  19. </image>
  20. </view>
  21. <view v-html="item.Content.text" class="text"></view>
  22. <view class="time">{{ item.Content.time }}</view>
  23. </view>
  24. <!-- 1 客户画像 2销讲词 3违禁 4 需求挖掘 -->
  25. <view class="newmark" v-if="item.Content.types">
  26. <view class="mark-item" v-for="(subitem, i) in dealTypes(item.Content.types)" :key="i">
  27. <image v-if="dealword(subitem)[0] == 1" class="markicon"
  28. src="https://static.quhouse.com/37e0de3f8d1c421dac8bf699d5e7992d.png"></image>
  29. <image v-if="dealword(subitem)[0] == 2" class="markicon"
  30. src="https://static.quhouse.com/b106e8e75db24a59a579a15a78830a76.png"></image>
  31. <image v-if="dealword(subitem)[0] == 3" class="markicon"
  32. src="https://static.quhouse.com/8443a2ecb81d4639991ab29c422e9949.png"></image>
  33. <image v-if="dealword(subitem)[0] == 4" class="markicon"
  34. src="https://static.quhouse.com/1cd794cb6c974d9dad948a6dd444518b.png"></image>
  35. <view class="marktext" :style="
  36. dealword(subitem)[0] == 3 ? 'color:#E7483C' : 'color:#3E50E8'
  37. ">{{ dealword(subitem)[1] }}</view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. var util = require("../../utils/util.js");
  46. var config = require("../../config");
  47. export default {
  48. data() {
  49. return {
  50. customerId: '',
  51. listarr: [],
  52. keyword: '',
  53. skpl: '',
  54. disabled: false,
  55. tipsFncName: '', // 通知其他页面的方法名称
  56. types: 0,
  57. };
  58. },
  59. onLoad: function(options) {
  60. this.customerId = options.customerId;
  61. this.keyword = options.keyword;
  62. this.skpl = options.skpl;
  63. if (options.UpDateEvent) this.tipsFncName = options.UpDateEvent
  64. if (options.types) this.types = options.types
  65. if (this.skpl == 2) {
  66. this.searchinfo()
  67. this.disabled = true;
  68. } else {
  69. this.disabled = false;
  70. }
  71. },
  72. methods: {
  73. // 对话加命中标签
  74. dealTypes(type) {
  75. if (type) {
  76. let tem = type.substring(1).split(",");
  77. return tem;
  78. } else {
  79. return [];
  80. }
  81. },
  82. // 对话加命中标签
  83. dealword(type) {
  84. if (type) {
  85. let a = type.split("-");
  86. let rest = type.substring(2).split("-").join(",");
  87. let arr = [a[0], rest];
  88. return arr;
  89. } else {
  90. return [];
  91. }
  92. },
  93. formatTime(num) {
  94. //格式化时间格式
  95. num = num.toFixed(0);
  96. let second = num % 60;
  97. if (second < 10) second = '0' + second;
  98. let min = Math.floor(num / 60);
  99. if (min < 10) min = '0' + min;
  100. return min + ":" + second;
  101. },
  102. searchinfo() {
  103. if (this.keyword.length == 0) {
  104. return
  105. } else {
  106. let parames = {
  107. keyword: this.keyword,
  108. customerId: this.customerId,
  109. }
  110. if (this.types == 1) {
  111. parames.type = 1
  112. }
  113. this.$u.post("/corpus/keyWordsMatching", parames).then(res => {
  114. res.forEach(item => {
  115. item.Content = JSON.parse(item.transferContent)
  116. })
  117. res.forEach(cet => {
  118. cet.Content.time = this.formatTime(cet.Content.bg / 1000)
  119. cet.Content.text = this.brightKeyword(cet.Content.onebest)
  120. })
  121. this.listarr = res;
  122. })
  123. }
  124. },
  125. //替换方法
  126. brightKeyword(val) {
  127. if (val.indexOf(this.keyword) !== -1) {
  128. return val.replace(this.keyword, `<font style='color: red'>${this.keyword}</font>`);
  129. } else {
  130. return val;
  131. }
  132. },
  133. //跳转
  134. toaidoinfo(item, id, index) {
  135. uni.setStorageSync("entrance", 2); //写入缓存
  136. item.customerId = this.customerId;
  137. item.id = id;
  138. item.index = index;
  139. if (this.skpl == 2) {
  140. this.infostust(item)
  141. } else {
  142. let pages = getCurrentPages() //获取当前页面栈的信息
  143. let prevPage = pages[pages.length - 2] //获取上一个页面
  144. if (this.tipsFncName) uni.$emit(this.tipsFncName, item)
  145. prevPage.setData({ //把需要回传的值保存到上一个页面
  146. info: item
  147. });
  148. wx.navigateBack({ //然后返回上一个页面
  149. delta: 1
  150. })
  151. }
  152. },
  153. //只有一条的时候
  154. infostust(item) {
  155. uni.setStorageSync("searchobj", item); //写入缓存
  156. const parames = {
  157. pageNum: 1,
  158. pageSize: 100,
  159. query: {
  160. customerId: this.customerId,
  161. }
  162. }
  163. this.$u.post("/corpus/findByPage", parames).then(res => {
  164. if (res[0].merge == 0) {
  165. let newobj = res[0];
  166. uni.navigateTo({
  167. url: `/pages/mine/details2?customerId=${newobj.customerId}&status=${newobj.status}&stateisshow=${'2'}`
  168. })
  169. } else {
  170. let newobj = res[0];
  171. uni.navigateTo({
  172. url: `/pages/mine/details?customerId=${newobj.customerId}&status=${newobj.status}&stateisshow=${'2'}`
  173. })
  174. }
  175. })
  176. },
  177. },
  178. }
  179. </script>
  180. <style lang="scss" scoped>
  181. .box {
  182. width: 690rpx;
  183. height: 64rpx;
  184. margin: 0 auto;
  185. margin-top: 30rpx;
  186. background: #f2f2f2;
  187. border-radius: 32rpx;
  188. display: flex;
  189. align-items: center;
  190. }
  191. .box-list {
  192. width: 690rpx;
  193. margin: 30rpx auto 0;
  194. }
  195. .item-list {
  196. display: flex;
  197. border-bottom: 1px solid #e0e0e0;
  198. .icon {
  199. width: 26rpx;
  200. height: 36rpx;
  201. margin-top: 4rpx;
  202. }
  203. .text {
  204. color: #666666;
  205. font-size: 28rpx;
  206. line-height: 36rpx;
  207. margin-left: 10rpx;
  208. width: 80%;
  209. }
  210. .time {
  211. font-size: 28rpx;
  212. width: 10%;
  213. width: 14%;
  214. text-align: right;
  215. }
  216. }
  217. .newmark {
  218. margin-top: 20rpx;
  219. padding-left: 30rpx;
  220. .mark-item {
  221. display: flex;
  222. flex-wrap: wrap;
  223. margin-bottom: 12rpx;
  224. .markicon {
  225. width: 30rpx;
  226. height: 30rpx;
  227. margin-right: 12rpx;
  228. }
  229. .marktext {
  230. flex: 1;
  231. font-size: 24rpx;
  232. font-family: PingFangSC-Regular, PingFang SC;
  233. font-weight: 400;
  234. color: #3e50e8;
  235. min-height: 30rpx;
  236. line-height: 30rpx;
  237. }
  238. }
  239. }
  240. </style>