<template>
	<view class="top">
		<text class="iconfont icon-youjiantou" @click="goBack()"></text>
		<text>公告详情</text>
	</view>
	<view class="announcement_detail_wrapper container">
		<view class="content">
			<view class="title">
				<view v-html="announcementInfo.title"></view>
			</view>
			<view class="date">
				发布时间：{{announcementInfo.announcementAt}}
			</view>
			<view v-html="announcementInfo.content"></view>
			<!-- <rich-text :nodes="announcementInfo.content"></rich-text> -->
		</view>
	</view>
</template>

<script>
	import api from "../../api/api";
	import common from '../../common/common';
	export default{
		data(){
			return{
				announcementInfo:{
					announcementAt:null,
					title:null,
					content:null
				},
				id:null
			}
		},
		name:'announcement_detail',
		components:{
		},
		onLoad(options){
			this.id = options.id;
			this.getAnnouncementDetail();
		},
		methods:{
			getAnnouncementDetail(){
				api.announcementQuery({id:this.id}).then((res)=>{
					if(res['success']){
						this.announcementInfo = res['data']['announcementInfoList'][0];
					}
				})
			},
			matchReg(str){
			    let reg=/<\/?.+?\/?>/g;
			    return str.replace(reg,'');
			},
			goBack(){
				uni.navigateTo({
					url:'../announcement/announcement'
				})
			}
		}
	}
</script>

<style lang="scss">
	.top{
		display: flex;
		height: 80rpx;
		justify-content: space-between;
		align-items: center;
		position: relative;
		width: 95%;
		margin: 0 auto;
		.icon-youjiantou{
			display: inline-block;
			transform: rotate(180deg);
			font-size: 30rpx;
			z-index: 1;
		}
		text:nth-child(2){
			width: 100%;
			text-align: center;
			position: absolute;
		}
	}
	.announcement_detail_wrapper{
		padding: 20rpx 16rpx;
		.title{
			font-size: 48rpx;
		}
		.date{
			color: #8d9599;
			margin: 20rpx 0;
			border-bottom: 2rpx #F8F8F8 solid;
			padding-bottom: 20rpx;
		}
		.content{
			margin-top: 20rpx;
			padding: 20rpx;
			background: #fff;
			word-break: break-word;
		}
	}
</style>