|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275 |
- <template>
- <view class="translation">
- <view class="box">
- <view
- style="width: 10%; height: 64rpx; display: flex; align-items: center"
- >
- <image
- style="width: 28rpx; height: 28rpx; margin-left: 30rpx"
- src="/static/images/search.png"
- mode=""
- ></image>
- </view>
- <view
- style="width: 90%; height: 64rpx; display: flex; align-items: center"
- >
- <input
- type="text"
- @input="searchinfo"
- v-model="keyword"
- placeholder="请输入关键字"
- style="width: 100%; color: #999999; font-size: 24rpx"
- />
- </view>
- </view>
- <view class="box-list">
- <view
- style="width: 100%; padding-bottom: 10rpx;"
- v-for="(item, index) in listarr"
- :key="index"
- @click="toaidoinfo(item.Content, item.corpusId, item.index)"
- >
- <view class="item-list">
- <view class="icon">
- <image
- style="width: 26rpx; height: 28rpx"
- src="../../static/images/testimg.png"
- mode=""
- ></image>
- </view>
- <view v-html="item.Content.text" class="text"></view>
- <view class="time">{{ item.Content.time }}</view>
- </view>
- <!-- 1 客户画像 2销讲词 3违禁 4 需求挖掘 -->
- <view class="newmark" v-if="item.Content.types">
- <view
- class="mark-item"
- v-for="(subitem, i) in dealTypes(item.Content.types)"
- :key="i"
- >
- <image
- v-if="dealword(subitem)[0] == 1"
- class="markicon"
- src="https://static.quhouse.com/37e0de3f8d1c421dac8bf699d5e7992d.png"
- ></image>
- <image
- v-if="dealword(subitem)[0] == 2"
- class="markicon"
- src="https://static.quhouse.com/b106e8e75db24a59a579a15a78830a76.png"
- ></image>
- <image
- v-if="dealword(subitem)[0] == 3"
- class="markicon"
- src="https://static.quhouse.com/8443a2ecb81d4639991ab29c422e9949.png"
- ></image>
- <image
- v-if="dealword(subitem)[0] == 4"
- class="markicon"
- src="https://static.quhouse.com/1cd794cb6c974d9dad948a6dd444518b.png"
- ></image>
- <view
- class="marktext"
- :style="
- dealword(subitem)[0] == 3 ? 'color:#E7483C' : 'color:#3E50E8'
- "
- >{{ dealword(subitem)[1] }}</view
- >
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
-
- <script>
- var util = require("../../utils/util.js");
- var config = require("../../config");
- export default {
- data() {
- return {
- customerId: '',
- listarr: [],
- keyword: '',
- skpl: '',
- disabled: false,
- tipsFncName: '', // 通知其他页面的方法名称
- };
- },
- onLoad: function(options) {
- this.customerId = options.customerId;
- this.keyword = options.keyword;
- this.skpl = options.skpl;
- if (options.UpDateEvent) this.tipsFncName = options.UpDateEvent
- if (this.skpl == 2) {
- this.searchinfo()
- this.disabled = true;
- } else {
- this.disabled = false;
- }
- },
- methods: {
- // 对话加命中标签
- dealTypes(type) {
- if (type) {
- let tem = type.substring(1).split(",");
- return tem;
- } else {
- return [];
- }
- },
- // 对话加命中标签
- dealword(type) {
- if (type) {
- let a = type.split("-");
- let rest = type.substring(2).split("-").join(",");
- let arr = [a[0], rest];
- return arr;
- } else {
- return [];
- }
- },
- formatTime(num) {
- //格式化时间格式
- num = num.toFixed(0);
- let second = num % 60;
- if (second < 10) second = '0' + second;
- let min = Math.floor(num / 60);
- if (min < 10) min = '0' + min;
- return min + ":" + second;
- },
- searchinfo() {
- if (this.keyword.length == 0) {
- return
- } else {
- let parames = {
- keyword: this.keyword,
- customerId: this.customerId
- }
- this.$u.post("/corpus/keyWordsMatching", parames).then(res => {
- res.forEach(item => {
- item.Content = JSON.parse(item.transferContent)
- })
- res.forEach(cet => {
- cet.Content.time = this.formatTime(cet.Content.bg / 1000)
- cet.Content.text = this.brightKeyword(cet.Content.onebest)
- })
- this.listarr = res;
- })
- }
- },
- //替换方法
- brightKeyword(val) {
- if (val.indexOf(this.keyword) !== -1) {
- return val.replace(this.keyword, `<font style='color: red'>${this.keyword}</font>`);
- } else {
- return val;
- }
- },
- //跳转
- toaidoinfo(item, id, index) {
- uni.setStorageSync("entrance", 2); //写入缓存
- item.customerId = this.customerId;
- item.id = id;
- item.index = index;
- if (this.skpl == 2) {
- this.infostust(item)
- } else {
- let pages = getCurrentPages() //获取当前页面栈的信息
- let prevPage = pages[pages.length - 2] //获取上一个页面
- if (this.tipsFncName) uni.$emit(this.tipsFncName, item)
- prevPage.setData({ //把需要回传的值保存到上一个页面
- info: item
- });
- wx.navigateBack({ //然后返回上一个页面
- delta: 1
- })
- }
- },
- //只有一条的时候
- infostust(item) {
- uni.setStorageSync("searchobj", item); //写入缓存
- const parames = {
- pageNum: 1,
- pageSize: 100,
- query: {
- customerId: this.customerId,
- }
- }
- this.$u.post("/corpus/findByPage", parames).then(res => {
- if (res[0].merge == 0) {
- let newobj = res[0];
- uni.navigateTo({
- url: `/pages/mine/details2?customerId=${newobj.customerId}&status=${newobj.status}&stateisshow=${'2'}`
- })
- } else {
- let newobj = res[0];
- uni.navigateTo({
- url: `/pages/mine/details?customerId=${newobj.customerId}&status=${newobj.status}&stateisshow=${'2'}`
- })
- }
- })
- },
- },
- }
- </script>
- <style lang="scss" scoped>
- .box {
- width: 690rpx;
- height: 64rpx;
- margin: 0 auto;
- margin-top: 30rpx;
- background: #f2f2f2;
- border-radius: 32rpx;
- display: flex;
- align-items: center;
- }
- .box-list {
- width: 690rpx;
- margin: 30rpx auto 0;
- }
- .item-list {
- display: flex;
- border-bottom: 1px solid #e0e0e0;
- .icon {
- width: 26rpx;
- height: 36rpx;
- margin-top: 4rpx;
- }
- .text {
- color: #666666;
- font-size: 28rpx;
- line-height: 36rpx;
- margin-left: 10rpx;
- width: 80%;
- }
- .time {
- font-size: 28rpx;
- width: 10%;
- width: 14%;
- text-align: right;
- }
- }
- .newmark {
- margin-top: 20rpx;
- padding-left: 30rpx;
- .mark-item {
- display: flex;
- flex-wrap: wrap;
- margin-bottom: 12rpx;
- .markicon {
- width: 30rpx;
- height: 30rpx;
- margin-right: 12rpx;
- }
- .marktext {
- flex: 1;
- font-size: 24rpx;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #3e50e8;
- min-height: 30rpx;
- line-height: 30rpx;
- }
- }
- }
- </style>
|