選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

139 行
4.1 KiB

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