diff --git a/src/pages/user/notice/notice.vue b/src/pages/user/notice/notice.vue index cb1d838dd78784e49ea522f7356df49c16516181..d020d115a406d179e950c5669eaa62fdb07a961e 100644 --- a/src/pages/user/notice/notice.vue +++ b/src/pages/user/notice/notice.vue @@ -103,6 +103,7 @@ export default { pageSize: 10, currentPage: 1, initDisabled: false, + allMeassageCount: 0, }), computed: { ...mapState({ @@ -145,6 +146,8 @@ export default { if (data.success === 1) { if (unread) { this.setUnreadMessageCount(data.data.total || 0); + } else { + this.allMeassageCount = data.data.total; } typeof callback === "function" && callback(data.data); } @@ -201,7 +204,6 @@ export default { this.initList(); // 刷新列表 if (!this.unread) { - console.log("刷新未读消息数"); this.getMessage({ unread: true, }); @@ -246,14 +248,27 @@ export default { this.removeAction([item.id]); }, readAll() { + if (this.unreadMessageCount === 0) { + this.$message.warning("暂无未读消息"); + return; + } + this.readAction([]); }, removeAll() { + if (this.allMeassageCount === 0) { + this.$message.warning("暂无消息通知"); + return; + } + this.removeAction([]); }, }, created() { this.initList(); + this.getMessage({ + unread: false, // 初始化消息总数 + }); }, };