<template>
	<view class="post-item">
		<view class="post-list-item">
			<view @click.stop="toUser('跳转到用户个人空间')">
				<up-avatar :src="src" size="50"></up-avatar>
			</view>
			<view class="center">
				<view class="post-top-box">
					<view class="uname">
						<text v-if="userType == 1" class="official">官方</text>
						<text class="username">{{ username.substring(0, 10) }}</text>
					</view>
					<view class="">
						<text v-if="postTop>0" class="officials">置顶</text>
						<text v-if="poststatus==1" class="officials">审核中</text>
						<text v-if="poststatus==2" class="officials">已下架</text>
					</view>
				</view>
				<view>
					<text class="time">{{createTime}}</text>
				</view>
			</view>
		</view>
		<view class="post-content">
			<rich-text class="post-text" :nodes="postcontent"></rich-text>
			<block v-if="posttype == 1">
				<up-album :urls="urls2" multipleSize="95" space="3"></up-album>
			</block>
		</view>
		<!-- 位置 -->
		<view class="address" v-if="postaddress">
			<u-icon class="icon" name="map-fill"></u-icon>
			<text>{{ postaddress }}</text>
		</view>
		<!-- 底部 -->
		<view class="post-list-bottom">
			<view class="p-item margin50">
				<!-- <text class="iconfont icon-quanzi"></text> -->
				<u-icon name="share"></u-icon>
				<text class="count">{{ readCount }}</text>
			</view>
			<view v-show="isLike" class="p-item" @click.stop="cancelCollection('取消点赞')">
				<u-icon name="heart-fill" color="#cc0000"></u-icon>
				<text class="count">{{ likeCount }}</text>
			</view>
			<view v-show="!isLike" class="p-item" @click.stop="addCollection('点赞')">
				<u-icon name="heart"></u-icon>
				<text class="count">{{ likeCount }}</text>
			</view>
			<view class="p-item margin50">
				<!-- <text class="iconfont icon-pinglun"></text> -->
				<u-icon name="chat"></u-icon>
				<text class="count">{{ commentCount }}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
	  props: {
	    talkPost: {
	      type: Object,
	      required: true
	    }
	  },
	  methods: {
	    toUser(message) {
	      // 跳转到用户个人空间的逻辑
	      console.log(message);
	    },
	    cancelCollection(message) {
	      // 取消点赞的逻辑
	      console.log(message);
	    },
	    addCollection(message) {
	      // 点赞的逻辑
	      console.log(message);
	    }
	  }
	};
</script>

<style>
</style>