選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

187 行
5.9 KiB

  1. <template>
  2. <view class="translation">
  3. <view style="display: flex;width: 100%;height: 100rpx;border-bottom: 1px solid #E0E0E0;">
  4. <view style="width: 50%;display: flex;align-items: center;justify-content: center;font-size: 30rpx;">
  5. <view style="line-height: 50rpx;" :class="roleindex == 0 ? 'bosdttom' : ''" @click="tapspagek(0)">
  6. 画像语义词选择</view>
  7. </view>
  8. <view style="width: 50%;display: flex;align-items: center;justify-content: center;font-size: 30rpx;">
  9. <view style="line-height: 50rpx;" :class="roleindex == 1 ? 'bosdttom' : ''" @click="tapspagek(1)">关键词输入
  10. </view>
  11. </view>
  12. </view>
  13. <view v-if='roleindex==0' style="width: 690rpx;height: 64rpx;margin: 0 auto;margin-top: 30rpx;">
  14. <view style="display: flex;align-items: center;border-bottom: 1px solid #C9C9C9;height: 80rpx;">
  15. <view>画像语义词:</view>
  16. <view style="width:70%" @click="oninputtap()">
  17. <text v-if="Semanticword.length==0">请选择</text>
  18. <text v-else>{{Semanticword}}</text>
  19. </view>
  20. <view>
  21. <image src="https://qufang.oss-cn-beijing.aliyuncs.com/upload/icon/xcx/jjycrm/qf/more.png"
  22. style="width:12rpx;height:23rpx;margin-left: 16rpx;">
  23. </view>
  24. </view>
  25. </view>
  26. <view v-if='roleindex==1' style="width: 690rpx;height: 64rpx;margin: 0 auto;margin-top: 30rpx;background: #F2F2F2;border-radius: 32rpx;
  27. display: flex;align-items: center;">
  28. <view style="width: 10%;height: 64rpx;display: flex;align-items: center;">
  29. <image style="width: 28rpx;height: 28rpx;margin-left: 30rpx;" src="/static/images/search.png" mode="">
  30. </image>
  31. </view>
  32. <view style="width: 90%;height: 64rpx;display: flex;align-items: center;">
  33. <input type="text" @input="searchinfo" v-model="keyword" placeholder="请输入关键字"
  34. style="width: 100%;color: #999999;font-size: 24rpx;" />
  35. </view>
  36. </view>
  37. <view style="width: 690rpx;margin: 0 auto;margin-top: 10rpx;">
  38. <view
  39. style="width: 100%;border-bottom: 1px solid #E0E0E0;display: flex;padding-bottom: 10rpx;margin-top: 40rpx;"
  40. v-for="(item,index) in listarr" :key='index' @click="toaidoinfo(item.Content,item.corpusId,item.index)">
  41. <view style="width: 26rpx;height: 36rpx;margin-top: 4rpx;">
  42. <image style="width: 26rpx;height: 28rpx;" src="/static/images/testimg.png" mode=""></image>
  43. </view>
  44. <view v-html="item.Content.text"
  45. style="color: #666666;font-size: 28rpx;line-height: 36rpx;margin-left: 10rpx;width: 80%;"></view>
  46. <view style="font-size: 28rpx;width: 10%;width: 14%;text-align: right;">{{item.Content.time}}</view>
  47. </view>
  48. </view>
  49. <u-select v-model="Showhiddenunits" mode="single-column" :list="selectlist" @confirm="confirm"></u-select>
  50. </view>
  51. </template>
  52. <script>
  53. var util = require("../../../../utils/util.js");
  54. var config = require("../../../../config");
  55. export default {
  56. data() {
  57. return {
  58. customerId: '',
  59. listarr: [],
  60. keyword: '',
  61. skpl: '',
  62. roleindex: 0,
  63. Showhiddenunits: false,
  64. selectlist: [],
  65. Semanticword: '',
  66. qujian: true,
  67. from: '', // 来源
  68. };
  69. },
  70. onLoad(options) {
  71. this.customerId = options.customerId;
  72. this.statistical()
  73. },
  74. methods: {
  75. statistical() {
  76. this.$u.get("/matchKeywords/findCARKeywords", {
  77. customerId: this.customerId
  78. }).then(res => {
  79. res.forEach((item, index) => {
  80. if (item.isInterval == 0) {
  81. item.label = item.name + item.unit + '-' + item.endName + item.unit;
  82. item.value = index
  83. } else {
  84. item.label = item.name;
  85. item.value = index
  86. }
  87. })
  88. this.selectlist = res;
  89. })
  90. },
  91. oninputtap() {
  92. this.Showhiddenunits = true;
  93. },
  94. confirm(e) {
  95. let indexs = e[0].value;
  96. this.selectlist.forEach((item, index) => {
  97. if (indexs == item.value) {
  98. this.Semanticword = item.name;
  99. this.keyword = item.matchName;
  100. if (item.isInterval == 0) {
  101. this.qujian = false;
  102. this.Semanticword = item.name + item.unit + '-' + item.endName + item.unit;
  103. } else {
  104. this.qujian = true;
  105. }
  106. }
  107. })
  108. this.searchinfo()
  109. },
  110. tapspagek(i) {
  111. this.roleindex = i;
  112. this.keyword = "";
  113. this.Semanticword = '';
  114. this.qujian = true;
  115. this.listarr = [];
  116. },
  117. formatTime(num) {
  118. //格式化时间格式
  119. num = num.toFixed(0);
  120. let second = num % 60;
  121. if (second < 10) second = '0' + second;
  122. let min = Math.floor(num / 60);
  123. if (min < 10) min = '0' + min;
  124. return min + ":" + second;
  125. },
  126. searchinfo() {
  127. if (this.keyword.length == 0) {
  128. return
  129. } else {
  130. let parames = {
  131. keyword: this.keyword,
  132. customerId: this.customerId
  133. }
  134. this.$u.post("/corpus/keyWordsMatching", parames).then(res => {
  135. res.forEach(item => {
  136. item.Content = JSON.parse(item.transferContent)
  137. })
  138. res.forEach(cet => {
  139. cet.Content.time = this.formatTime(cet.Content.bg / 1000)
  140. if (this.qujian == false) {
  141. cet.Content.text = cet.Content.onebest;
  142. } else {
  143. cet.Content.text = this.brightKeyword(cet.Content.onebest)
  144. }
  145. })
  146. this.listarr = res;
  147. })
  148. }
  149. },
  150. //替换方法
  151. brightKeyword(val) {
  152. if (val.indexOf(this.keyword) !== -1) {
  153. return val.replace(this.keyword, `<font style='color: red'>${this.keyword}</font>`);
  154. } else {
  155. return val;
  156. }
  157. },
  158. //跳转
  159. toaidoinfo(item, id, index) {
  160. uni.setStorageSync("entrance", 2); //写入缓存
  161. item.customerId = this.customerId;
  162. item.id = id;
  163. item.index = index;
  164. let pages = getCurrentPages() //获取当前页面栈的信息
  165. let prevPage = pages[pages.length - 2] //获取上一个页面
  166. prevPage.setData({ //把需要回传的值保存到上一个页面
  167. info: item
  168. });
  169. uni.$emit('Receivedetailabout', item)
  170. wx.navigateBack({ //然后返回上一个页面
  171. delta: 1
  172. })
  173. }
  174. },
  175. }
  176. </script>
  177. <style lang="scss" scoped>
  178. .bosdttom {
  179. border-bottom: 2px solid #2671E2;
  180. }
  181. </style>