feat: 新增消息通知模块

This commit is contained in:
橙子
2024-05-23 23:40:55 +08:00
parent 695989969d
commit ef220a5b36
20 changed files with 528 additions and 85 deletions

View File

@@ -0,0 +1,33 @@
import { defineStore } from "pinia";
const chatStore = defineStore("notice", {
state: () => ({
noticeList: []
}),
getters: {
noticeForNoReadCount:(state)=>{
return state.noticeList.filter(x => x.isRead ==false).length;
}
},
actions:
{
addNotice(msg) {
this.noticeList.unshift(msg);
},
addNotices(msgs) {
msgs.forEach(item => {
this.addNotice(item);
});
},
setNotices(msgs) {
this.noticeList=msgs;
},
removeNotice(id)
{
this.noticeList = this.noticeList.filter(obj => obj.id != id);
}
},
});
export default chatStore;