Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

před 2 roky
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. tipsFncEvent: "",
  37. };
  38. },
  39. onLoad(options) {
  40. this.customerId = options.customerId;
  41. this.keyword=options.keyword;
  42. this.skpl=options.skpl;
  43. if (options.UpDateEvent) this.tipsFncEvent = options.UpDateEvent
  44. },
  45. methods: {
  46. formatTime(num) {
  47. //格式化时间格式
  48. num = num.toFixed(0);
  49. let second = num % 60;
  50. if (second < 10) second = '0' + second;
  51. let min = Math.floor(num / 60);
  52. if (min < 10) min = '0' + min;
  53. return min + ":" + second;
  54. },
  55. searchinfo(){
  56. if(this.keyword.length==0){
  57. return
  58. }else{
  59. let parames={
  60. keyword:this.keyword,
  61. customerId:this.customerId
  62. }
  63. this.$u.post("/corpus/keyWordsMatching", parames).then(res => {
  64. res.forEach(item=>{
  65. item.Content=JSON.parse(item.transferContent)
  66. })
  67. res.forEach(cet=>{
  68. cet.Content.time=this.formatTime(cet.Content.bg/1000)
  69. cet.Content.text=this.brightKeyword(cet.Content.onebest)
  70. })
  71. this.listarr=res;
  72. })
  73. }
  74. },
  75. //替换方法
  76. brightKeyword(val) {
  77. if (val.indexOf(this.keyword) !== -1) {
  78. return val.replace(this.keyword, `<font style='color: red'>${this.keyword}</font>`);
  79. } else {
  80. return val;
  81. }
  82. },
  83. //跳转
  84. toaidoinfo(item,id,index){
  85. item.customerId=this.customerId;
  86. item.id=id;
  87. item.index=index;
  88. if(this.skpl==2){
  89. this.infostust(item)
  90. }else{
  91. let pages = getCurrentPages() //获取当前页面栈的信息
  92. let prevPage = pages[pages.length - 2] //获取上一个页面
  93. uni.$emit(this.tipsFncEvent, item)
  94. prevPage.setData({ //把需要回传的值保存到上一个页面
  95. info: item
  96. });
  97. wx.navigateBack({ //然后返回上一个页面
  98. delta: 1
  99. })
  100. }
  101. },
  102. //只有一条的时候
  103. infostust(item){
  104. let d = JSON.parse(JSON.stringify([item]))
  105. var itemobjhh={
  106. bg:d[0].bg,
  107. customerId:d[0].customerId,
  108. id:'',
  109. onebest:d[0].onebest,
  110. }
  111. const parames = {
  112. pageNum: 1,
  113. pageSize: 100,
  114. query: {
  115. customerId: this.customerId,
  116. }
  117. }
  118. console.log(item)
  119. this.$u.post("/corpus/findByPage", parames).then(res => {
  120. if(res[0].merge==0){
  121. let newobj = res[0];
  122. uni.navigateTo({
  123. url: `/pages/learning/Thefulltext/index2?customerId=${newobj.customerId}&status=${newobj.status}&itemobj=${JSON.stringify(itemobjhh)}&stateisshow=${'2'}`
  124. })
  125. }else{
  126. let newobj = res[0];
  127. uni.navigateTo({
  128. url: `/pages/learning/Thefulltext/index?customerId=${newobj.customerId}&status=${newobj.status}&itemobj=${JSON.stringify(itemobjhh)}&stateisshow=${'2'}`
  129. })
  130. }
  131. })
  132. },
  133. },
  134. }
  135. </script>
  136. <style lang="scss" scoped>
  137. </style>