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.
 
 
 

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