Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

154 Zeilen
4.4 KiB

  1. <template>
  2. <view class="translation">
  3. <view class="box">
  4. <view style="width: 10%;height: 64rpx;display: flex;align-items: center;">
  5. <image style="width: 28rpx;height: 28rpx;margin-left: 30rpx;" src="/static/images/search.png" mode=""></image>
  6. </view>
  7. <view style="width: 90%;height: 64rpx;display: flex;align-items: center;">
  8. <input type="text" @input="searchinfo" :disabled="disabled" v-model="keyword" placeholder="请输入关键字"
  9. style="width: 100%;color: #999999;font-size: 24rpx;"/>
  10. </view>
  11. </view>
  12. <view style="width: 690rpx;margin: 0 auto;margin-top: 10rpx;">
  13. <view style="width: 100%;border-bottom: 1px solid #E0E0E0;display: flex;padding-bottom: 10rpx;margin-top: 40rpx;"
  14. v-for="(item,index) in listarr" :key='index' @click="toaidoinfo(item.Content,item.corpusId,item.index)">
  15. <view style="width: 26rpx;height: 36rpx;margin-top: 4rpx;">
  16. <image style="width: 26rpx;height: 28rpx;" src="../../static/images/testimg.png" mode=""></image>
  17. </view>
  18. <view v-html="item.Content.text" style="color: #666666;font-size: 28rpx;line-height: 36rpx;margin-left: 10rpx;width: 80%;"></view>
  19. <view style="font-size: 28rpx;width: 10%;width: 14%;text-align: right;">{{item.Content.time}}</view>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. var util = require("../../utils/util.js");
  26. var config = require("../../config");
  27. export default {
  28. data() {
  29. return {
  30. customerId:'',
  31. listarr:[],
  32. keyword:'',
  33. skpl:'',
  34. disabled:false,
  35. tipsFncName: '', // 通知其他页面的方法名称
  36. };
  37. },
  38. onLoad(options) {
  39. this.customerId = options.customerId;
  40. this.keyword=options.keyword;
  41. this.skpl=options.skpl;
  42. if (options.UpDateEvent) this.tipsFncName = options.UpDateEvent
  43. if(this.skpl==2){
  44. this.searchinfo()
  45. this.disabled=true;
  46. }else{
  47. this.disabled=false;
  48. }
  49. },
  50. methods: {
  51. formatTime(num) {
  52. //格式化时间格式
  53. num = num.toFixed(0);
  54. let second = num % 60;
  55. if (second < 10) second = '0' + second;
  56. let min = Math.floor(num / 60);
  57. if (min < 10) min = '0' + min;
  58. return min + ":" + second;
  59. },
  60. searchinfo(){
  61. if(this.keyword.length==0){
  62. return
  63. }else{
  64. let parames={
  65. keyword:this.keyword,
  66. customerId:this.customerId
  67. }
  68. this.$u.post("/corpus/keyWordsMatching", parames).then(res => {
  69. res.forEach(item=>{
  70. item.Content=JSON.parse(item.transferContent)
  71. })
  72. res.forEach(cet=>{
  73. cet.Content.time=this.formatTime(cet.Content.bg/1000)
  74. cet.Content.text=this.brightKeyword(cet.Content.onebest)
  75. })
  76. this.listarr=res;
  77. })
  78. }
  79. },
  80. //替换方法
  81. brightKeyword(val) {
  82. if (val.indexOf(this.keyword) !== -1) {
  83. return val.replace(this.keyword, `<font style='color: red'>${this.keyword}</font>`);
  84. } else {
  85. return val;
  86. }
  87. },
  88. //跳转
  89. toaidoinfo(item,id,index){
  90. uni.setStorageSync("entrance", 2); //写入缓存
  91. item.customerId=this.customerId;
  92. item.id=id;
  93. item.index=index;
  94. if(this.skpl==2){
  95. this.infostust(item)
  96. }else{
  97. let pages = getCurrentPages() //获取当前页面栈的信息
  98. let prevPage = pages[pages.length - 2] //获取上一个页面
  99. if (this.tipsFncName) uni.$emit(this.tipsFncName, item)
  100. prevPage.setData({ //把需要回传的值保存到上一个页面
  101. info: item
  102. });
  103. wx.navigateBack({ //然后返回上一个页面
  104. delta: 1
  105. })
  106. }
  107. },
  108. //只有一条的时候
  109. infostust(item){
  110. uni.setStorageSync("searchobj", item); //写入缓存
  111. const parames = {
  112. pageNum: 1,
  113. pageSize: 100,
  114. query: {
  115. customerId: this.customerId,
  116. }
  117. }
  118. this.$u.post("/corpus/findByPage", parames).then(res => {
  119. if(res[0].merge==0){
  120. let newobj = res[0];
  121. if (this.tipsFncName) {
  122. uni.$emit(this.tipsFncName, item)
  123. uni.navigateBack()
  124. return
  125. }
  126. uni.navigateTo({
  127. url: `/pages/mine/details2?customerId=${newobj.customerId}&status=${newobj.status}&stateisshow=${'2'}`
  128. })
  129. }else{
  130. let newobj = res[0];
  131. uni.navigateTo({
  132. url: `/pages/mine/details?customerId=${newobj.customerId}&status=${newobj.status}&stateisshow=${'2'}`
  133. })
  134. }
  135. })
  136. },
  137. },
  138. }
  139. </script>
  140. <style lang="scss" scoped>
  141. .box{
  142. width: 690rpx;
  143. height: 64rpx;
  144. margin: 0 auto;
  145. margin-top: 30rpx;
  146. background: #F2F2F2;
  147. border-radius: 32rpx;
  148. display: flex;
  149. align-items: center;
  150. }
  151. </style>