AI销管
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 

150 wiersze
4.4 KiB

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