wangjunchen 3 years ago
parent
commit
1b9637a70d
1 changed files with 11 additions and 8 deletions
  1. 11 8
      pages/index/notice.vue

+ 11 - 8
pages/index/notice.vue

@@ -7,7 +7,7 @@
 		<transition name="el-fade-in-linear" @mousewheel.prevent @touchmove.prevent>
 			<view class="model-type flex-center" v-show="noticeModel">
 				<view class="model-content">
-					<view class="close-icon" @click="noticeModel = false"></view>
+					<view class="close-icon" @click="emitNoticeModel"></view>
 					<view class="text">Bulletin</view>
 					<view class="contents infinite-list" v-infinite-scroll="nextPage">
 						<view 
@@ -63,14 +63,14 @@
 		data() {
 			return {
 				loading: false,
-				noticeModel: false,
+				// noticeModel: false,
 				page: 1,
 				items: null,
 				detailModel: false
 			}
 		},
 		computed: {
-			...mapState(['noticeList', 'noticeOpen', 'newNoticeList', 'userId']),
+			...mapState(['noticeList', 'noticeOpen', 'newNoticeList', 'userId','noticeModel']),
 			noticeMax () {
 				if (this.noticeList) {
 					return this.noticeList.sort((a, b) => { return a.notice_id > b.notice_id ? -1 : 1;})
@@ -87,9 +87,10 @@
 			},
 			noticeOpen:  {
 				handler(n, o) {
+					console.log('11113',n, o);
 				  if (n) {
 					  setTimeout(() => {
-						this.noticeModel = true
+						  this.setNoticeModel(true)
 						this.noticeDetail(this.noticeMax[0], 0)
 						this.setNoticeOpen(false)
 					  }, 200)
@@ -102,11 +103,11 @@
 		mounted(){
 		},
 		methods: {
-			...mapMutations(['setNoticeList', 'setNoticeOpen']),
+			...mapMutations(['setNoticeList', 'setNoticeOpen','setNoticeModel']),
 			...mapActions(['gainUserData', 'gainNoticeList']),
 			skipOpenNo () {
 				if (!!this.userId) return;
-				this.noticeModel = true;
+				this.setNoticeModel(true)
 			},
 			
 			init(){
@@ -129,7 +130,7 @@
 				}).then((res) => {
 					if (res && res.status == 200) {
 						this.items = {...res.data, ...item};
-						this.noticeModel = false;
+						this.setNoticeModel(false)
 						this.detailModel = true;
 					}
 				})
@@ -137,7 +138,7 @@
 			
 			// 返回公告列表
 			returnList() {
-				this.noticeModel = true;
+				this.setNoticeModel(true)
 				this.detailModel = false;
 			},
 			
@@ -146,6 +147,8 @@
 					path: name,
 					query: params
 				})
+			},emitNoticeModel(){
+				this.setNoticeModel(false)
 			}
 		},
 	}