feat: 完善聊天模块

This commit is contained in:
橙子
2024-04-06 18:28:32 +08:00
parent 43b4032bbb
commit 6aedff75f1
17 changed files with 507 additions and 110 deletions

View File

@@ -1,25 +1,28 @@
import { defineStore } from "pinia";
const chatStore = defineStore("chat", {
state: () => ({
userList: [],
msgList: []
}),
// getters: {
// userListData: (state) => state.userList,
// },
actions: {
// 设置在线总数
getters: {
allMsgContext: (state) => state.msgList.filter(x=>x.messageType=="All"),
personalMsgContext: (state) => state.msgList.filter(x=>x.messageType=="Personal"),
},
actions:
{
setMsgList(value) {
this.msgList = value;
},
addMsg(msg) {
this.msgList.push(msg);
},
setUserList(value) {
this.userList = value;
},
addUser(user)
{
addUser(user) {
this.userList.push(user);
},
delUser(userId)
{
delUser(userId) {
this.userList = this.userList.filter(obj => obj.userId != userId);
}
},