<template>
	<view class="notice-detail-content">
		<uni-card v-bind:title="noticeDetail.title">
			<text class="uni-body">{{noticeDetail.content}}</text></br>
			<view class="bottom">
				<text>成都次元节点网络科技有限公司</text></br>
				<text class="uni-body">{{noticeDetail.createTime}}</text>
			</view>
		</uni-card>
	</view>
</template>

<script>
	import {
		getNoticeDetails
	} from '@/api/userInfo.js'
	export default {
		data() {
			return {
				noticeDetail:{
					id: 0,
					title: '',
					content: '',
					img: '',
					createTime: '',
					userInfo:{}
				}
			}
		},
		created() {
			const userInfo = uni.getStorageSync('userInfo')
			if (!userInfo) {
				console.log('havent userInfo')
				uni.showModal({
					content: '艺术家账户过期,请重新登录！',
					showCancel: false,
					success() {
						//没有缓存则跳转登录页面
						uni.reLaunch({
							url: '/pages/login/login'
						});
					}
				});
			} else {
				this.userInfo = userInfo;
				console.log('have userInfo')
			}
		},
		onLoad: function(option) { //option为object类型，会序列化上个页面传递的参数
			this.noticeDetail.id = option.id
			//console.log('this.id',this.id)
			this.getNoticeDetails();
		},
		methods: {
			
			// 查询公告详情
			async getNoticeDetails() {
				let that = this;
				const res = await getNoticeDetails(that.noticeDetail.id)
				console.log('res', res)
				if (res.data.code === 200) {
					that.noticeDetail = res.data.data
				} else {
					uni.showModal({
						content: '公告详情数据加载失败！',
						showCancel: false
					});
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
.notice-detail-content {

  ::v-deep .uni-card {
    min-height: calc(100vh - 80rpx);
    margin: 40rpx !important;
    background: $uni-bg-base-color;
    border-color: $uni-bg-base-color;
    padding: 0 !important;
    border-radius: 20rpx !important;
  }

  ::v-deep .uni-card__header {
    height: 60rpx;
    border-bottom-color: $uni-secondary-color;
  }

  ::v-deep .uni-card__header-content-title {
    color: $uni-white !important;
    font-size: 28rpx !important;
  }

  ::v-deep .uni-body {
    color: $uni-secondary-color;
    font-size: 24rpx;
  }

  .bottom{
    color: $uni-secondary-color;
    font-size: 24rpx;
    text-align: right;
    margin-top: 60rpx;
  }
}
</style>
