AI销管
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

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