<template>
	<div>
		<template v-if="!showDetail">
			<div class="noticeInfo-item" v-for="(item,index) in dataArr" :key="index" @click="goDetail(index)">
				<div class="notice-title">
					<img src="../../static/img/kindergartenIntroduce/icon-notice.png" alt="">
					<div class="clips1">{{item.Title}}</div>
				</div>
				<div class="noticeInfo-time flex-s0">{{item.PublishTime.split(' ')[0]}}</div>
			</div>
		</template>
		<newsInformationDetail v-if="showDetail" :dataObj="dataObj" @backNews="backNews"></newsInformationDetail>
	</div>
</template>

<script>
	import newsInformationDetail from '@/components/newsInformationDetail.vue';
	export default {
		components:{
			newsInformationDetail
		},
		name: 'noticeInfo',
		data() {
			return {
				dataArr:[],
				showDetail:false,
				dataObj:{}
			}
		},
		methods: {
			// 查看详情
			goDetail(e) {
				this.dataObj = this.dataArr[e];
				this.showDetail = true
				this.classnewsdetailsEv(this.dataObj.Guid);
			},
			// 继承详情返回事件
			backNews(e){
				this.showDetail = e;
			},
			async getnoticeEv() {
				let data = await this.$axios({
					// 调用 serviceAPI
					url: this.$https.getnotice,
					methods: "get",
					params: {
						EquipmentID: "yaohaotest001",
					},
				});
				this.dataArr = data.data.data;
				// console.log(data.data.data);
			},
			async classnewsdetailsEv(guid) {
				let data = await this.$axios({
					// 调用 serviceAPI
					url: this.$https.classnewsdetails,
					methods: "get",
					params: {
						EquipmentID: "yaohaotest001",
						Guid:guid
					},
				});
				this.dataObj = data.data.data;
				console.log(this.dataObj);
			},
		},
		mounted() {
			this.getnoticeEv();
		}
	}
</script>

<style>
</style>
