<template>
	<view class="container">
		<uni-title type="h1" class="title" align="center" :title="info.title || info.noticeTitle"></uni-title>
		<text class="time">创建时间：{{ info.createTime }}</text>
		<rich-text image-menu-prevent="true" :nodes="info.content || info.noticeContent" class="content"></rich-text>
		<!-- <view class="content" v-html="info.content || info.noticeContent"></view> -->
	</view>
</template>

<script>
	import request from '../../api/cms.js';
	import requestNotice from '../../api/system.js';
	import { BASE_URL } from '../../env.js';
	export default {
		onLoad: function (option) {
			this.id = option.id;
			this.noticeId = option.noticeId;
		},
		data() {
			return {
				id: '',
				info: null,
				noticeId: ''
			}
		},
		async mounted() {
			let res = {};
			if (this.id && this.id !== '') {
				res = await request.getArticleDetail({ id: this.id });
			}
			if (this.noticeId && this.noticeId !== '') {
				res = await requestNotice.getSystemNoticeDetails({ id: this.noticeId });
			}
			this.info = res.data;
			if (this.id && this.id !== '') await request.addBlogViews({ id: this.id });
		},
		methods: {}
	}
</script>

<style>
	.time {
		width: 100%;
		text-align: center;
		display: block;
		font-size: 12px;
	}
	.content {
		display: block;
		width: 90%;
		margin: 10px auto;
	}
	.title {
		width: 90%;
		margin: 0 auto;
		display: block;
	}
	.uni-title__base {
		line-height: 1.2em !important;
	}
</style>
