<template>
	<view>
		<view>id:{{noticeDetail.id}}</view>
		<view>标题:{{noticeDetail.title}}</view>
		<view>内容:{{noticeDetail.content}}</view>
		<view>图片:{{noticeDetail.img}}</view>
		<view>创建时间:{{noticeDetail.createTime}}</view>
	</view>
</template>

<script>
	import {
		getNoticeDetails
	} from '@/api/userInfo.js'
	export default {
		data() {
			return {
				noticeDetail:{
					id: 0,
					title: '',
					content: '',
					img: '',
					createTime: ''
				}
			}
		},
		onLoad: function(option) { //option为object类型，会序列化上个页面传递的参数
			this.noticeDetail.id = option.id
			//console.log('this.id',this.id)
			this.getNoticeDetails();
		},
		methods: {
			
			// 查询公告详情
			async getNoticeDetails() {
				const res = await getNoticeDetails(this.noticeDetail.id)
				console.log('res', res)
				if (res.data.code === 200) {
					this.noticeDetail = res.data.data
				} else {
					uni.showModal({
						content: '公告详情数据加载失败！',
						showCancel: false
					});
				}
			},
		}
	}
</script>

<style>

</style>
