<template>
	<div>
		<common @asynCallBack="asynCallBack"></common>
		<top-header :pageTitle="pageTitle" headerClass="vongi-bar" :leftShow="false"></top-header>

		<div class="mui-content margin49">
			<ul class="mui-table-view vongi-news">
				<li class="mui-table-view-cell mui-media">
					<router-link :to="{name:'CommonNotice'}">
						<img class="mui-media-object mui-pull-left" src="~$project/assets/img/bell1.png">
						<div class="mui-media-body">
							<h3 class="flew-sp">通知公告<span class="mui-h6" v-text="lastNotice.createTime"></span></h3>
							<p class='mui-ellipsis' v-text="lastNotice.title"></p>
						</div>
						<!-- <span class="mui-badge mui-badge-danger">5</span> -->
					</router-link>
				</li>
			</ul>
			<ul class="mui-table-view vongi-news">
				<li class="mui-table-view-cell mui-media kfz">
					<a href="javascript:;">
						<img class="mui-media-object mui-pull-left" src="~$project/assets/img/kaoqin1.png">
						<div class="mui-media-body">
							<h3 class="flew-sp">考勤消息<span class="mui-h6">09.20</span></h3>
							<p class='mui-ellipsis'>考勤打卡提醒</p>
						</div>
					</a>
				</li>
				<li class="mui-table-view-cell mui-media kfz">
					<a href="javascript:;">
						<img class="mui-media-object mui-pull-left" src="~$project/assets/img/audit1.png">
						<div class="mui-media-body">
							<h3 class="flew-sp">通知公告<span class="mui-h6">09.20</span></h3>
							<p class='mui-ellipsis'>9月园区活动通知</p>
						</div>
					</a>
				</li>
				<li class="mui-table-view-cell mui-media kfz">
					<a href="javascript:;">
						<img class="mui-media-object mui-pull-left" src="~$project/assets/img/home1.png">
						<div class="mui-media-body">
							<h3 class="flew-sp">通知公告<span class="mui-h6">09.20</span></h3>
							<p class='mui-ellipsis'>9月园区活动通知</p>
						</div>
					</a>
				</li>
			</ul>
		</div>

		<nav-menu :router="[{name:'Master'},{name:'MasterMessage'},{name:'MasterCenter'}]"></nav-menu>

		<loading :visible="isLoading"></loading>
	</div>
</template>

<script>
	import * as API_Notice from '@/apis/Common/notice'
	import Common from '$project/components/Common.vue'
	import Loading from '$project/components/Loading.vue'
	import TopHeader from '$project/components/TopHeader.vue'
	import NavMenu from '@/components/NavMenu.vue'
	import {
		mapGetters,
		mapMutations
	} from 'vuex'
	export default {
		name: 'MasterMessage',
		components: {
			Common,
			Loading,
			TopHeader,
			NavMenu
		},
		data() {
			return {
				pageTitle: '消息',

				isLoading: false,

				lastNotice: {}
			}
		},
		created() {

		},
		methods: {
			//获取最新一条通知消息
			getLastNotice() {
				this.isLoading = true;
				API_Notice.getNoticeList({
					pageIndex: 1,
					pageSize: 1,
				}).then(response => {
					let data = response.data;
					if (data.length > 0) {
						this.lastNotice = data[0];
					}
					this.isLoading = false;
				}).catch(error => {
					this.isLoading = false;
					mui.toast(error);
				})
			},
			asynCallBack() {},
		},
		mounted() {
			//获取最新一条通知消息
			this.getLastNotice();
		},
		destroyed() {

		},
		computed: {
			...mapGetters({
				openId: 'wx_openid',
				token: 'token',
				person_data: 'person_data',
				company_data: 'company_data',
			})
		}
	}
</script>

<style scoped src="$project/assets/css/xpgj.css"></style>
<style scoped src="$project/assets/css/iconfont.css"></style>
<style scoped>
</style>
