|
- <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/customer/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>
- <view v-if="Showhiddenunits">
- <u-select v-model="Showhiddenunits" mode="single-column" :list="selectlist" @confirm="confirm"></u-select>
- </view>
- </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
- };
- },
- onLoad: function(options) {
- this.customerId = options.customerId;
- 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){
- item.customerId=this.customerId;
- item.id=id;
- item.index=index;
-
- let pages = getCurrentPages() //获取当前页面栈的信息
- let prevPage = pages[pages.length - 2] //获取上一个页面
- prevPage.setData({ //把需要回传的值保存到上一个页面
- info: item
- });
- wx.navigateBack({ //然后返回上一个页面
- delta: 1
- })
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- .bosdttom{
- border-bottom: 2px solid #2671E2;
- }
- </style>
|