<template>
	<view>
		<view style="text-align: center;">{{commentDetail.grade}}</view>
		<view>
			<view v-for="(item,index) in commentDetail.firstList" :key="index">
				<view class="uni-flex uni-row">
					<view style="float:left" class="flex-item">{{item.firstName}}</view>
					<view style="text-align: center;" class="flex-item">{{item.remark}}</view>
					<view style="text-align: center;" v-for="(items,indexs) in item.thirdList" :key="indexs">
						{{items.dicname}}
					</view>
				</view>
			</view>
			<view style="float:left">评价内容</view>
			<view style="text-align: right;">评价时间：{{commentDetail.createtime}}</view>
			<view>{{commentDetail.evaluate}}</view>
			<view>
				<view style="float:left" v-for="(item,index) in commentDetail.image_url" :key="index">
					<image style="height: 200rpx;width: 200rpx;" :src="item" ></image>
				</view>
			</view>
			<view>
				<view style="float:left" v-for="(item,index) in commentDetail.interactList" :key="index">
					<view v-if="item.types == 'REPLY'" style="float:left;font-size: 20rpx;">回复人：{{item.user_name}}</view>
					<view v-if="item.types == 'ASSESS'" style="float:left;font-size: 20rpx;">回复人：我</view>
					<view style="text-align: right;font-size: 20rpx;">回复时间：{{item.createtime}}</view>
					<view style="font-size: 30rpx;">{{item.content}}</view>
				</view>
			</view>
			<view>
				<view>
					<textarea v-model="textValue" placeholder-style="color:#f7f7f4" placeholder="亲,点击这里可以添加评论哦..."/>
				</view>
			</view>
			<view >上传照片</view>
			<view @tap="submit()">回复/发布</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				guid:"",
				commentDetail:{},
				rootPaht: this.$config.ROOTPATH,
				pics:"",
				textValue:""
			}
		},
		onLoad:function(option){
			this.guid = option.guid;
			this.getCommentDetail();
		},
		methods: {
			getCommentDetail:function(){
				var that = this;
				var data = {
					guid:this.guid,
					userkey:this.$param.userkey
				}
				this.$Request.post(this.$config.getCommentDetail, data).then(res => {
					console.log(res);
					that.commentDetail = res.data;
					var imgArr = that.commentDetail.image_url;
					for(var i = 0;i < imgArr.length;i++){
						imgArr[i] = that.rootPaht + imgArr[i];
					}
					that.commentDetail.image_url = imgArr;
				});
			},
			submit:function(){
				var that = this;
				var data = {
					commentid:this.guid,
					types:"ASSESS",
					userid:this.commentDetail.user_id,
					username:this.commentDetail.user_name,
					content:this.textValue,
					imageurl:this.pics,
					ispublish:"YES"
				}
				this.$Request.post(this.$config.saveCommentInteract, data).then(res => {
					console.log(res);
				});
			}
		}
	}
</script>

<style>
</style>
