<template>
	<view class="">
		<!-- 禁用弹窗 -->
			 <restrictedTip ref="restrictedTip"/>
		<!-- #ifdef APP -->
		<view class="top">
			<text class="iconfont icon-youjiantou zuojiantou" @click="goBack()"></text>
			<text  class="commonTitle">消息详情</text>
		</view>
		<!-- #endif -->
		
		<view class="announcement_detail_wrapper container">
			<view class="content">
				<view class="title">
					{{systemMsgInfo.title}}
				</view>
				<view class="date">
					发布时间：{{systemMsgInfo.createdAt}}
				</view>
				<view style="font-size: 25rpx;" v-html="systemMsgInfo.context"></view>
			</view>
		</view>
	</view>
	
</template>

<script>
	import api from "../../api/api";
	import common from '../../common/common';
	import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
	import restrictedTip from '@/components/commonPopup/restrictedTip.vue';
	export default{
		data(){
			return{
				systemMsgInfo:{
					announcementAt:null,
					title:null,
					content:null
				},
				id:null
			}
		},
		name:'system_msg_detail',
		components:{restrictedTip,},
		onLoad(options){
			this.id = options.id;
			this.getSystemMsgDetail();
		},
		onShow() {
			if(uni.getStorageSync('loginType')=='codelogin'){
							this.queryInfo()
						}
			// #ifdef H5
						initJssdkShare(() => {
						  setWechatShare();
						}, window.location.href);
						// #endif
		},
		methods:{
			queryInfo() {
							api.queryInfo({userId:uni.getStorageSync('cffp_userId')}).then(res=>{
								// 保存用户得个人信息
								if (res['success']) {
									delete res.data.commonResult
									
									const cffp_userInfo = {
										...res.data
									}
									// 账号禁用用户
									if(res.data.userIsActive&&res.data.userIsActive==2){
										this.$refs.restrictedTip.open()
										uni.setStorageSync('userIsActive',String(res.data.userIsActive))
										return
									}
									if(res.data.userIsActive&&res.data.userIsActive!=2){
										this.$refs.restrictedTip.close()
										uni.removeStorageSync('userIsActive')
									}
									
									uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo));
									uni.setStorageSync('user_mobile', res.data.mobile)
									
								}
								
							})
						},
			getSystemMsgDetail(){
				api.querySystemMessageDetail({systemMessageId:this.id}).then((res)=>{
					if(res['success']){
						this.systemMsgInfo = res['data']['systemMessageInfo']
					}
				})
			},
			goBack(){
				uni.navigateTo({
					url:'../systemMsg/system_msg'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.top{
		display: flex;
		height: 80rpx;
		justify-content: space-between;
		align-items: center;
		position: relative;
		width: 95%;
		margin: 0 auto;
		.zuojiantou{
			left: 0;
		}
		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;
			font-size: 24rpx;
		}
		.content{
			// margin-top: 20rpx;
			padding: 20rpx;
			background: #fff;
			word-break: break-word;
			border-radius: 10rpx;
		}
	}
</style>