<template>
	<view class="uni-wrap">
		<uni-section class="mb-10" :title="annoDetail.announcementTitle" :sub-title="subTitle">
			<view class="uni-common-mt article" style="background: #fff; padding: 20rpx">
				<rich-text :nodes="annoDetail.announcementBody"></rich-text>
			</view>
		</uni-section>
	</view>
</template>

<script>
import { getDetialisById, announcementReat } from '@/api/index/index.js';

export default {
	data() {
		return {
			annoDetail: {
				createBy: null,
				createTime: '2024-03-04 09:19:49',
				updateBy: null,
				updateTime: null,
				remark: null,
				id: '2',
				announcementTitle: '123',
				announcementBody: '<p><strong>这是内容</strong></p><p><strong><em>真的是内容</em></strong></p><p><strong><em><u>还是内容</u></em></strong></p><p><strong><em><u><span class="ql-cursor">\ufeff</span></u></em></strong><img src="/dev-api/profile/upload/2024/03/04/程序员_20240304091946A002.jpg"></p>',
				validityStartTime: '2024-03-03',
				validityEndTime: '2024-03-05',
				announcementImg: '/profile/upload/2024/03/04/程序员_20240304091901A001.jpg'
			},
			queryData:{
				userId: getApp().globalData.userId,
				annoId: null,
			}
		};
	},
	computed: {
	    subTitle () {
	      return this.annoDetail.updateBy !== null ? `${this.annoDetail.createTime} - ${this.annoDetail.updateBy}` : `${this.annoDetail.createTime} - ${this.annoDetail.createBy}`
	    }
	  },
	/**
	 * 生命周期函数--监听页面加载
	 */
	onLoad(options) {
		this.queryData.annoId = options.id
		this.getDetails(options.id);
		this.setDataType();
	},
	methods: {
		getDetails(annoId) {
			getDetialisById(annoId).then((res) => {
				this.annoDetail = res.data;
			});
		},
		setDataType(){
			announcementReat(this.queryData).then(res=>{
				console.log(res.msg)
			})
		}
	}
};
</script>

<style lang="scss">
$uni-success: #18bc37 !default;

.uni-wrap {
	flex-direction: column;
	/* #ifdef H5 */
	height: calc(100vh - 44px);
	/* #endif */
	/* #ifndef H5 */
	height: 100vh;
	/* #endif */
	flex: 1;
}

.mb-10 {
	margin-bottom: 10px;
}

.decoration {
	width: 6px;
	height: 6px;
	margin-right: 4px;
	border-radius: 50%;
	background-color: $uni-success;
}
</style>
