Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

184 rader
5.8 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. };
  68. },
  69. onLoad: function(options) {
  70. this.customerId = options.customerId;
  71. this.statistical()
  72. },
  73. methods: {
  74. statistical() {
  75. this.$u.get("/matchKeywords/findCARKeywords", {
  76. customerId: this.customerId
  77. }).then(res => {
  78. res.forEach((item, index) => {
  79. if (item.isInterval == 0) {
  80. item.label = item.name + item.unit + '-' + item.endName + item.unit;
  81. item.value = index
  82. } else {
  83. item.label = item.name;
  84. item.value = index
  85. }
  86. })
  87. this.selectlist = res;
  88. })
  89. },
  90. oninputtap() {
  91. this.Showhiddenunits = true;
  92. },
  93. confirm(e) {
  94. let indexs = e[0].value;
  95. this.selectlist.forEach((item, index) => {
  96. if (indexs == item.value) {
  97. this.Semanticword = item.name;
  98. this.keyword = item.matchName;
  99. if (item.isInterval == 0) {
  100. this.qujian = false;
  101. this.Semanticword = item.name + item.unit + '-' + item.endName + item.unit;
  102. } else {
  103. this.qujian = true;
  104. }
  105. }
  106. })
  107. this.searchinfo()
  108. },
  109. tapspagek(i) {
  110. this.roleindex = i;
  111. this.keyword = "";
  112. this.Semanticword = '';
  113. this.qujian = true;
  114. this.listarr = [];
  115. },
  116. formatTime(num) {
  117. //格式化时间格式
  118. num = num.toFixed(0);
  119. let second = num % 60;
  120. if (second < 10) second = '0' + second;
  121. let min = Math.floor(num / 60);
  122. if (min < 10) min = '0' + min;
  123. return min + ":" + second;
  124. },
  125. searchinfo() {
  126. if (this.keyword.length == 0) {
  127. return
  128. } else {
  129. let parames = {
  130. keyword: this.keyword,
  131. customerId: this.customerId
  132. }
  133. this.$u.post("/corpus/keyWordsMatching", parames).then(res => {
  134. res.forEach(item => {
  135. item.Content = JSON.parse(item.transferContent)
  136. })
  137. res.forEach(cet => {
  138. cet.Content.time = this.formatTime(cet.Content.bg / 1000)
  139. if (this.qujian == false) {
  140. cet.Content.text = cet.Content.onebest;
  141. } else {
  142. cet.Content.text = this.brightKeyword(cet.Content.onebest)
  143. }
  144. })
  145. this.listarr = res;
  146. })
  147. }
  148. },
  149. //替换方法
  150. brightKeyword(val) {
  151. if (val.indexOf(this.keyword) !== -1) {
  152. return val.replace(this.keyword, `<font style='color: red'>${this.keyword}</font>`);
  153. } else {
  154. return val;
  155. }
  156. },
  157. //跳转
  158. toaidoinfo(item, id, index) {
  159. uni.setStorageSync("entrance", 2); //写入缓存
  160. item.customerId = this.customerId;
  161. item.id = id;
  162. item.index = index;
  163. let pages = getCurrentPages() //获取当前页面栈的信息
  164. let prevPage = pages[pages.length - 2] //获取上一个页面
  165. prevPage.setData({ //把需要回传的值保存到上一个页面
  166. info: item
  167. });
  168. wx.navigateBack({ //然后返回上一个页面
  169. delta: 1
  170. })
  171. }
  172. },
  173. }
  174. </script>
  175. <style lang="scss" scoped>
  176. .bosdttom {
  177. border-bottom: 2px solid #2671E2;
  178. }
  179. </style>