<template>
	<view>
		<dHeader :title="$lang.lang.notice.info"></dHeader>
		<view class="start-bar"></view>
		<view class="notice_info">
			<view class="notice_title">
				<text>{{$lang.locale=='zh'?noticeData.title:$lang.locale=='en'?noticeData.titleEn:noticeData.titleFr}}</text>
			</view>
			<view class="notice_tag">
				<text>{{$lang.lang.notice.type}}</text>
			</view>
			<view class="notice_tag">
				<text>{{getDate(noticeData.createTime)}}</text>
			</view>
			<view class="notice_content">
				<rich-text :nodes="$lang.locale=='zh'?noticeData.content:$lang.locale=='en'?noticeData.contentEn:noticeData.contentFr"></rich-text>
			</view>
		</view>
	</view>
</template>

<script>
	import dHeader from '../../components/dHeader/index.vue'
	export default {
		components: {
			dHeader
		},
		data() {
			return {
				noticeData:{
				}
			}
		},
		onLoad(op){
			console.log(op)
			if(op.id){
				this.getData(op.id)
			}
		},
		methods: {
			getData(id){
				this.$request.get('/app-api/system/notice/get',{id:id}).then(res => {
					if(res.code==0&&res.data){
						this.noticeData = res.data
					}
				})
			},
			getDate(time) {
				const date = new Date(time);
				let year = date.getFullYear();
				let month = date.getMonth() + 1;
				let day = date.getDate();
				let hour = date.getHours()
				let min = date.getMinutes()
				let sec = date.getSeconds()
				hour = hour > 9 ? hour : '0' + hour;
				month = month > 9 ? month : '0' + month;
				day = day > 9 ? day : '0' + day;
				min = min > 9 ? min : '0' + min;
				sec = sec > 9 ? sec : '0' + sec;
				
				return `${year}-${month}-${day} ${hour}:${min}:${sec}`;
			},
		}
	}
</script>

<style>
page{
	background: var(--bColor);
}
.notice_info{
	padding-top: 180upx;
	width: 92%;
	margin: 0 auto;
}
.notice_title{
	padding-bottom: 12upx;
	font-size: 30upx;
	font-weight: bold;
}
.notice_tag{
	padding-bottom: 12upx;
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 24upx;
}
</style>
