Commit 25f2196c authored by 徐一鸣's avatar 徐一鸣

消息通知fixed

parent 50031e21
...@@ -103,6 +103,7 @@ export default { ...@@ -103,6 +103,7 @@ export default {
pageSize: 10, pageSize: 10,
currentPage: 1, currentPage: 1,
initDisabled: false, initDisabled: false,
allMeassageCount: 0,
}), }),
computed: { computed: {
...mapState({ ...mapState({
...@@ -145,6 +146,8 @@ export default { ...@@ -145,6 +146,8 @@ export default {
if (data.success === 1) { if (data.success === 1) {
if (unread) { if (unread) {
this.setUnreadMessageCount(data.data.total || 0); this.setUnreadMessageCount(data.data.total || 0);
} else {
this.allMeassageCount = data.data.total;
} }
typeof callback === "function" && callback(data.data); typeof callback === "function" && callback(data.data);
} }
...@@ -201,7 +204,6 @@ export default { ...@@ -201,7 +204,6 @@ export default {
this.initList(); // 刷新列表 this.initList(); // 刷新列表
if (!this.unread) { if (!this.unread) {
console.log("刷新未读消息数");
this.getMessage({ this.getMessage({
unread: true, unread: true,
}); });
...@@ -246,14 +248,27 @@ export default { ...@@ -246,14 +248,27 @@ export default {
this.removeAction([item.id]); this.removeAction([item.id]);
}, },
readAll() { readAll() {
if (this.unreadMessageCount === 0) {
this.$message.warning("暂无未读消息");
return;
}
this.readAction([]); this.readAction([]);
}, },
removeAll() { removeAll() {
if (this.allMeassageCount === 0) {
this.$message.warning("暂无消息通知");
return;
}
this.removeAction([]); this.removeAction([]);
}, },
}, },
created() { created() {
this.initList(); this.initList();
this.getMessage({
unread: false, // 初始化消息总数
});
}, },
}; };
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment