<template>
	<view class="">
		<view class="flztoa jhbbre">
			<view class="fzctob">
				<image :src="info.avatarUrl"
					style="width: 92rpx;min-width: 92rpx;height: 92rpx;border-radius: 200rpx;margin-right: 30rpx;"
					mode=""></image>
				<view class="">
					<text>{{info.nickName}}</text>
				</view>
			</view>
			<!-- <image src="/static/index/ind1.png" style="width: 116rpx;height: 48rpx;min-width: 116rpx;" mode=""></image> -->
		</view>

		<view class="jhwdmmt">
			<view class="shidongt">
				<view class="shibbert">
					<view class="shikwer">
						<text>{{info.content}}</text>
						<!-- <text class="fyctoc" style="color: #374B6E;">展开</text> -->
					</view>

					<view class="flztoa" style="margin-top: 46rpx;">
						<view class="fzctob" >
               <image @click="like" :src="info.is_like == 1?'/static/index/w1.png':'/static/index/w2.png'" style="width: 48rpx;height: 48rpx;min-width: 48rpx;" mode=""></image>
							<text class="shitxty">{{info.like_num}}</text>
							<view style="margin-left: 40rpx;" @click="focus=true">
								<image src="/static/index/w3.png" style="width: 48rpx;height: 48rpx;min-width: 48rpx;"
									mode=""></image>
							</view>
						</view>
						<view class="">
							<text class="shitxtya">{{$u.timeFormat(info.create_time, 'yyyy:mm:dd  hh:MM:ss')}}</text>
						</view>
					</view>
				</view>
			</view>
		</view>

		<view class="jhwdmmt">
			<view class="indhuyr">
				<view class="indjbrr"></view>
				<text>全部评论({{info.comment_num}})</text>
			</view>
			<view class="shidongt" v-for="(item,index) in info.comment" :key="index">
				<view class="shibbert">
					<view class="hfikwer">
						<view class="hfuyerrt"><text>{{item.nickName}}</text></view>
						<text>{{item.content}}</text>
					</view>
				</view>
			</view>
		</view>
		<view class="flztoa hfddwevde">
			<view class="hfddwerr">
				<input type="text" :focus="focus" value="" placeholder-style="color:#333333;font-size: 28rpx;"
					placeholder="您好！请问有什么可以帮助您的。" v-model="content" />
			</view>
			<view class="hfddwett" @click="addcomment">
				<text>发送</text>
			</view>
		</view>

	</view>
</template>
<style>
	page {
		background: #FAFAFA;
	}
</style>
<script>
	export default {
		data() {
			return {
				xqaxuye: false,
				info: {},
				user_id:'',
				content:'',
				focus:false
			}
		},
		onLoad(e) {
			this.getinfo(e.id, e.user_id)
			this.user_id = e.user_id

		},
		methods: {
			getinfo(id, user_id) {
				this.$post({
					data: {
						do: 'QuestionIndex',
						data: {
							id: id,
							user_id: user_id
						}
					}
				}).then(res => {
					this.info = res.message
				})
			},
			//点赞
			like(){
				let that = this;
				that.$post({
					data: {
						do: 'QuestionLike',
						data: {
							question_id: that.info.id,
							user_id: that.user_id
						}
					}
				}).then(res => {
					that.getinfo(that.info.id,that.user_id);
				})
			},
			//添加评论
			addcomment(){
				let that = this;
				that.$post({
					data: {
						do: 'QuestionComment',
						data: {
							questions_id: that.info.id,
							user_id: that.user_id,
							content:that.content,
							msg_id:0
						}
					}
				}).then(res => {
					that.getinfo(that.info.id,that.user_id);
					that.content = '';
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.jhbbre {
		padding: 20rpx 24rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 0rpx 20rpx 2rpx rgba(0, 0, 0, 0.10196078431372549);
		font-size: 36rpx;
		font-weight: 400;
		color: #333333;
	}
</style>
