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.
 
 
 

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