Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 

141 строка
4.2 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. item.customerId=this.customerId;
  90. item.id=id;
  91. item.index=index;
  92. if(this.skpl==2){
  93. this.infostust(item)
  94. }else{
  95. let pages = getCurrentPages() //获取当前页面栈的信息
  96. let prevPage = pages[pages.length - 2] //获取上一个页面
  97. prevPage.setData({ //把需要回传的值保存到上一个页面
  98. info: item
  99. });
  100. wx.navigateBack({ //然后返回上一个页面
  101. delta: 1
  102. })
  103. }
  104. },
  105. //只有一条的时候
  106. infostust(item){
  107. console.log("zobudao")
  108. let d = JSON.parse(JSON.stringify([item]))
  109. d[0].onebest=""
  110. const parames = {
  111. pageNum: 1,
  112. pageSize: 100,
  113. query: {
  114. customerId: this.customerId,
  115. }
  116. }
  117. this.$u.post("/corpus/findByPage", parames).then(res => {
  118. if(res[0].recordDuration>360){
  119. let newobj = res[0];
  120. uni.navigateTo({
  121. url: `/pages/main/details2?customerId=${newobj.customerId}&status=${newobj.status}&itemobj=${JSON.stringify(d[0])}&stateisshow=${'2'}`
  122. })
  123. }else{
  124. let newobj = res[0];
  125. uni.navigateTo({
  126. url: `/pages/main/details?customerId=${newobj.customerId}&status=${newobj.status}&itemobj=${JSON.stringify(d[0])}&stateisshow=${'2'}`
  127. })
  128. }
  129. })
  130. },
  131. },
  132. }
  133. </script>
  134. <style lang="scss" scoped>
  135. </style>