<template>
	<view class="translation">
		<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.onebest" 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>
</template>

<script>
	var util = require("../../../utils/util.js");
	var config = require("../../../config");
	export default {
		data() {
			return {
				customerId:'',
				listarr:[],
				id:'',
			};
		},
		onLoad: function(options) {
			this.customerId = options.customerId;
			this.id=options.id;
			this.searchinfo()
		},
		methods: {
			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(){
				let parames={
					marketingId:this.id,
					customerId:this.customerId
				}
				this.$u.post("/corpus/pinWordMatching", parames).then(res => {
					res.forEach(item=>{
						item.Content=JSON.parse(item.transferContent)
					})
					res.forEach(cet=>{
						cet.Content.time=this.formatTime(cet.Content.bg/1000)
					})
					this.listarr=res;
				})
			},
			//跳转
			toaidoinfo(item,id,index){
				item.customerId=this.customerId;
				item.id=id;
				item.index=index;
				this.infostust(item)
			},
			//只有一条的时候
			infostust(item){
				console.log("zobudao")
				let d = JSON.parse(JSON.stringify([item]))
					d[0].onebest=""
				const parames = {
					pageNum: 1,
					pageSize: 100,
					query: {
						customerId: this.customerId,
					}
				}
				this.$u.post("/corpus/findByPage", parames).then(res => {
					if(res[0].recordDuration>360){
						let newobj = res[0];
						uni.navigateTo({
							url: `/pages/main/details2?customerId=${newobj.customerId}&status=${newobj.status}&itemobj=${JSON.stringify(d[0])}&stateisshow=${'2'}`
						})
					}else{
						let newobj = res[0];
						uni.navigateTo({
							url: `/pages/main/details?customerId=${newobj.customerId}&status=${newobj.status}&itemobj=${JSON.stringify(d[0])}&stateisshow=${'2'}`
						})
					}
				})
			},
			
		},
	}
</script>
<style lang="scss" scoped>

</style>
