Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

Detailsofthesearch.vue 5.7 KiB

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