<template>
	<view>
		<dHeader :title="$lang.lang.msg.info"></dHeader>
		<view class="start-bar"></view>
		<view class="notice_info">
			<view class="notice_title">
				<text>{{noticeData[$lang.msgTitle]}}</text>
			</view>
			<view class="notice_tag">
				<text>{{getDate(noticeData.createTime)}}</text>
			</view>
			<view class="notice_content">
				<rich-text :nodes="noticeData[$lang.msgContent]"></rich-text>
			</view>
		</view>
	</view>
</template>

<script>
	import dHeader from '../../components/dHeader/index.vue'
	export default {
		components: {
			dHeader
		},
		data() {
			return {
				noticeData:{
				}
			}
		},
		onLoad(op){
			if(op.id){
				this.getData(op.id)
				this.setReaded(op.id)
			}
		},
		methods: {
			getData(id){
				this.$request.get('/app-api/ecw/internal-message/get',{id:id}).then(res => {
					if(res.code==0&&res.data){
						this.noticeData = res.data
					}
				})
			},
			setReaded(id){
				this.$request.get('/app-api/ecw/internal-message/redInternalMessage',{messageId:id}).then(res=>{

				})
			},
			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{
	text-align: left;
	padding-bottom: 12upx;
	font-size: 30upx;
	font-weight: bold;
}
.notice_tag{
	padding-bottom: 12upx;
	width: 100%;
	text-align: left;
	font-size: 24upx;
}
</style>
