<!--
 * @Author: ch
 * @Date: 2022-03-26 14:32:03
 * @LastEditors: ch
 * @LastEditTime: 2022-04-26 17:52:30
 * @Description: file content
-->
<template>
	<view>
		<view class="msgItem" v-for="item in msgData" :key="item.id">
			<view class="msgItem--title">
				<text>{{item.payload.title}}</text>
				<text class="msgItem--time">{{item.createTimeStamp}}</text>
			</view>
			<view class="msgItem--con">
				<image class="msgItem--img" src="@/static/message/xt.png" mode="widthFix"/>
				<view class="msgItem--desc">{{item.payload.content}}</view>
			</view>
		</view>
	</view>
</template>
<script>
// import {MsbWebSkt, createUUID} from '@/common/utils';
export default {
	computed:{
		msgData (){
			// console.log(this.$store.state.sessionData,'---',this.$Route.query.id);
			const sessionData = this.$store.state.sessionData.find(i =>i.id == this.$Route.query.id)
			return sessionData ? sessionData.messageList : [];

		}
	},
	onShow(){
		this.getHistoryMsg();
	},
	methods:{
		getHistoryMsg(){
			// MsbWebSkt.onOpen(()=>{
				// MsbWebSkt.send({
				// 	data : JSON.stringify({
				// 		traceId : createUUID(),
				// 		traceType : "2", 
				// 		content: { sessionId : this.$Route.query.id}
				// 	}),	
				// 	success(){
				// 		console.log('suxx');
				// 	},
				// 	fail(e){
				// 		console.log('fxx',e);
				// 	}
				// })
			// })
		},
		xx(){
			console.log(this.$store.state.sessionData);
		}
	}
}
</script>
<style lang="scss" scoped>
.msgItem{
	padding: 40rpx 0 0 40rpx;
	&--title{
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding-right: 40rpx;
		font-size: $font-size-lg;
		color: $color-grey6;
	}
	&--time{
		font-size: $font-size-sm;
		color: $color-grey4;
	}
	&--con{
		display: flex;
		border-bottom: 1px solid $color-grey2;
		padding: 40rpx 0;
	}
	&--img{
		width: 140rpx;
		height: 140rpx;
		border-radius: 12rpx;
		margin-right: 40rpx;
	}
	&--desc{
		width: 455rpx;
		font-size: $font-size-base;
		line-height: 39rpx;
		color: $color-grey5;
	}
}
</style>