<template>
	<view class="new-detail">
		<view class="title">
			{{title}}
		</view>
		<view class="info-box">
			<text>{{time}}</text>
		</view>
		<view class="content">
			<u-parse :html="content"></u-parse>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title:'',
				time:'',
				clicks:'',
				content:'',
			}
		},
		onLoad(option){
			if (option?.obj) {
				let data = JSON.parse(decodeURIComponent(option.obj));
				this.id = data.id;
				this.time = data.createdAt;
				this.title = data.title;
				// this.content = data.message;
				this.readNew(data.id);
			}
		},
		methods:{
			readNew(id){
				this.$api.newApi.getNoticeDetail({id:id}).then((res)=>{
					console.log("当前获取消息详情",res)
					if(res.code == 0){
						this.clicks = res.data.clicks;
						this.content = res.data.content
					}else{
						uni.showToast({
						    title: res.msg,
								icon:"none",
						    duration: 2000
						});
					}
				}).catch(()=>{
					this.$u.toast('服务器开小差了呢，请您稍后再试')
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.new-detail{
		padding: 20rpx;
		.title{
			font-weight: bold;
			font-size: 38rpx;
		}
		.info-box{
			margin: 20rpx 0;
			display: flex;
			justify-content: space-between;
			align-items: center;
			text{
				color: #999;
				font-size: 24rpx;
			}
		}
		.content{
			text-indent: 56rpx;
			font-size: 30rpx;
			color: #666;
		}
	}
	
</style>