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.
 
 
 
 

276 lines
7.0 KiB

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