Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 

290 řádky
7.5 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. tipsFncName: "", // 通知其他页面的方法名称
  94. };
  95. },
  96. onLoad(options) {
  97. this.customerId = options.customerId;
  98. this.keyword = options.keyword;
  99. this.skpl = options.skpl;
  100. console.log(111);
  101. if (options.UpDateEvent) this.tipsFncName = options.UpDateEvent;
  102. if (this.skpl == 2) {
  103. this.searchinfo();
  104. } else {
  105. this.disabled = false;
  106. }
  107. },
  108. methods: {
  109. // 对话加命中标签
  110. dealTypes(type) {
  111. if (type) {
  112. let tem = type.substring(1).split(",");
  113. return tem;
  114. } else {
  115. return [];
  116. }
  117. },
  118. // 对话加命中标签
  119. dealword(type) {
  120. if (type) {
  121. let a = type.split("-");
  122. let rest = type.substring(2).split("-").join(",");
  123. let arr = [a[0], rest];
  124. return arr;
  125. } else {
  126. return [];
  127. }
  128. },
  129. formatTime(num) {
  130. //格式化时间格式
  131. num = num.toFixed(0);
  132. let second = num % 60;
  133. if (second < 10) second = "0" + second;
  134. let min = Math.floor(num / 60);
  135. if (min < 10) min = "0" + min;
  136. return min + ":" + second;
  137. },
  138. searchinfo() {
  139. if (this.keyword.length == 0) {
  140. return;
  141. } else {
  142. let parames = {
  143. keyword: this.keyword,
  144. customerId: this.customerId,
  145. };
  146. this.$u.post("/corpus/keyWordsMatching", parames).then((res) => {
  147. res.forEach((item) => {
  148. item.Content = JSON.parse(item.transferContent);
  149. });
  150. res.forEach((cet) => {
  151. cet.Content.time = this.formatTime(cet.Content.bg / 1000);
  152. cet.Content.text = this.brightKeyword(cet.Content.onebest);
  153. });
  154. this.listarr = res;
  155. });
  156. }
  157. },
  158. //替换方法
  159. brightKeyword(val) {
  160. if (val.indexOf(this.keyword) !== -1) {
  161. return val.replace(
  162. this.keyword,
  163. `<font style='color: red'>${this.keyword}</font>`
  164. );
  165. } else {
  166. return val;
  167. }
  168. },
  169. //跳转
  170. toaidoinfo(item, id, index) {
  171. uni.setStorageSync("entrance", 2); //写入缓存
  172. item.customerId = this.customerId;
  173. item.id = id;
  174. item.index = index;
  175. if (this.skpl == 2) {
  176. this.infostust(item);
  177. } else {
  178. let pages = getCurrentPages(); //获取当前页面栈的信息
  179. let prevPage = pages[pages.length - 2]; //获取上一个页面
  180. if (this.tipsFncName) uni.$emit(this.tipsFncName, item);
  181. prevPage.setData({
  182. //把需要回传的值保存到上一个页面
  183. info: item,
  184. });
  185. wx.navigateBack({
  186. //然后返回上一个页面
  187. delta: 1,
  188. });
  189. }
  190. },
  191. //只有一条的时候
  192. infostust(item) {
  193. uni.setStorageSync("searchobj", item); //写入缓存
  194. const parames = {
  195. pageNum: 1,
  196. pageSize: 100,
  197. query: {
  198. customerId: this.customerId,
  199. },
  200. };
  201. this.$u.post("/corpus/findByPage", parames).then((res) => {
  202. if (res[0].merge == 0) {
  203. let newobj = res[0];
  204. if (this.tipsFncName) {
  205. uni.$emit(this.tipsFncName, item);
  206. uni.navigateBack();
  207. return;
  208. }
  209. console.log(12)
  210. uni.navigateTo({
  211. url: `/pages/mine/details2?customerId=${newobj.customerId}&status=${
  212. newobj.status
  213. }&stateisshow=${"2"}`,
  214. });
  215. } else {
  216. let newobj = res[0];
  217. uni.navigateTo({
  218. url: `/pages/mine/details?customerId=${newobj.customerId}&status=${
  219. newobj.status
  220. }&stateisshow=${"2"}`,
  221. });
  222. }
  223. });
  224. },
  225. },
  226. };
  227. </script>
  228. <style lang="scss" scoped>
  229. .box {
  230. width: 690rpx;
  231. height: 64rpx;
  232. margin: 0 auto;
  233. margin-top: 30rpx;
  234. background: #f2f2f2;
  235. border-radius: 32rpx;
  236. display: flex;
  237. align-items: center;
  238. }
  239. .box-list {
  240. width: 690rpx;
  241. margin: 30rpx auto 0;
  242. }
  243. .item-list {
  244. display: flex;
  245. border-bottom: 1px solid #e0e0e0;
  246. .icon {
  247. width: 26rpx;
  248. height: 36rpx;
  249. margin-top: 4rpx;
  250. }
  251. .text {
  252. color: #666666;
  253. font-size: 28rpx;
  254. line-height: 36rpx;
  255. margin-left: 10rpx;
  256. width: 80%;
  257. }
  258. .time {
  259. font-size: 28rpx;
  260. width: 10%;
  261. width: 14%;
  262. text-align: right;
  263. }
  264. }
  265. .newmark {
  266. margin-top: 20rpx;
  267. padding-left: 30rpx;
  268. .mark-item {
  269. display: flex;
  270. flex-wrap: wrap;
  271. margin-bottom: 12rpx;
  272. .markicon {
  273. width: 30rpx;
  274. height: 30rpx;
  275. margin-right: 12rpx;
  276. }
  277. .marktext {
  278. flex: 1;
  279. font-size: 24rpx;
  280. font-family: PingFangSC-Regular, PingFang SC;
  281. font-weight: 400;
  282. color: #3e50e8;
  283. min-height: 30rpx;
  284. line-height: 30rpx;
  285. }
  286. }
  287. }
  288. </style>