Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

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