|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- <template>
- <view class="translation">
- <view style="display: flex;width: 100%;height: 100rpx;border-bottom: 1px solid #E0E0E0;">
- <view style="width: 50%;display: flex;align-items: center;justify-content: center;font-size: 30rpx;">
- <view style="line-height: 50rpx;" :class="roleindex == 0 ? 'bosdttom' : ''" @click="tapspagek(0)">
- 画像语义词选择</view>
- </view>
- <view style="width: 50%;display: flex;align-items: center;justify-content: center;font-size: 30rpx;">
- <view style="line-height: 50rpx;" :class="roleindex == 1 ? 'bosdttom' : ''" @click="tapspagek(1)">关键词输入
- </view>
- </view>
- </view>
- <view v-if='roleindex==0' style="width: 690rpx;height: 64rpx;margin: 0 auto;margin-top: 30rpx;">
- <view style="display: flex;align-items: center;border-bottom: 1px solid #C9C9C9;height: 80rpx;">
- <view>画像语义词:</view>
- <view style="width:70%" @click="oninputtap()">
- <text v-if="Semanticword.length==0">请选择</text>
- <text v-else>{{Semanticword}}</text>
- </view>
- <view>
- <image src="https://qufang.oss-cn-beijing.aliyuncs.com/upload/icon/xcx/jjycrm/qf/more.png"
- style="width:12rpx;height:23rpx;margin-left: 16rpx;">
- </view>
- </view>
- </view>
- <view v-if='roleindex==1' style="width: 690rpx;height: 64rpx;margin: 0 auto;margin-top: 30rpx;background: #F2F2F2;border-radius: 32rpx;
- display: flex;align-items: center;">
- <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 style="width: 690rpx;margin: 0 auto;margin-top: 10rpx;">
-
- <view
- style="width: 100%;border-bottom: 1px solid #E0E0E0;display: flex;padding-bottom: 10rpx;margin-top: 40rpx;"
- v-for="(item,index) in listarr" :key='index' @click="toaidoinfo(item.Content,item.corpusId,item.index)">
- <view style="width: 26rpx;height: 36rpx;margin-top: 4rpx;">
- <image style="width: 26rpx;height: 28rpx;" src="/static/images/testimg.png" mode=""></image>
- </view>
- <view v-html="item.Content.text"
- style="color: #666666;font-size: 28rpx;line-height: 36rpx;margin-left: 10rpx;width: 80%;"></view>
- <view style="font-size: 28rpx;width: 10%;width: 14%;text-align: right;">{{item.Content.time}}</view>
- </view>
-
- </view>
- <u-select v-model="Showhiddenunits" mode="single-column" :list="selectlist" @confirm="confirm"></u-select>
- </view>
- </template>
-
- <script>
- var util = require("../../../../utils/util.js");
- var config = require("../../../../config");
- export default {
- data() {
- return {
- customerId: '',
- listarr: [],
- keyword: '',
- skpl: '',
- roleindex: 0,
- Showhiddenunits: false,
- selectlist: [],
- Semanticword: '',
- qujian: true,
- from: '', // 来源
- tipsFncName: '', // 提醒页面变更的值
- };
- },
- onLoad(options) {
- this.customerId = options.customerId;
- if (options.UpDateEvent) this.tipsFncName = options.UpDateEvent
- console.log(options)
- this.statistical()
- },
- methods: {
- statistical() {
- this.$u.get("/matchKeywords/findCARKeywords", {
- customerId: this.customerId
- }).then(res => {
- res.forEach((item, index) => {
- if (item.isInterval == 0) {
- item.label = item.name + item.unit + '-' + item.endName + item.unit;
- item.value = index
- } else {
- item.label = item.name;
- item.value = index
- }
- })
- this.selectlist = res;
- })
- },
- oninputtap() {
- this.Showhiddenunits = true;
- },
- confirm(e) {
- let indexs = e[0].value;
- this.selectlist.forEach((item, index) => {
- if (indexs == item.value) {
- this.Semanticword = item.name;
- this.keyword = item.matchName;
- if (item.isInterval == 0) {
- this.qujian = false;
- this.Semanticword = item.name + item.unit + '-' + item.endName + item.unit;
- } else {
- this.qujian = true;
- }
- }
- })
- this.searchinfo()
- },
- tapspagek(i) {
- this.roleindex = i;
- this.keyword = "";
- this.Semanticword = '';
- this.qujian = true;
- this.listarr = [];
- },
- 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)
- if (this.qujian == false) {
- cet.Content.text = cet.Content.onebest;
- } else {
- 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;
-
- // let pages = getCurrentPages() //获取当前页面栈的信息
- // let prevPage = pages[pages.length - 2] //获取上一个页面
- // prevPage.setData({ //把需要回传的值保存到上一个页面
- // info: item
- // });
- console.log('我在这里打印了', item)
- uni.$emit(this.tipsFncName, item)
- uni.navigateBack()
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- .bosdttom {
- border-bottom: 2px solid #2671E2;
- }
- </style>
|