|
@@ -612,12 +612,28 @@ export const useWebSocketStore = defineStore("webSocketStore", {
|
|
|
if(message.isTemp){
|
|
|
lastMsg = '[阅后即焚]';
|
|
|
}
|
|
|
+ // 额外数据
|
|
|
+ const ext = {};
|
|
|
+
|
|
|
+ // 修改群公告信息
|
|
|
+ if (message.nickname) {
|
|
|
+ ext.nickname = message.nickname
|
|
|
+ }
|
|
|
+ if (message.notice) {
|
|
|
+ ext.notice = message.notice
|
|
|
+ }
|
|
|
+ if (message.slience || message.slience === 0) {
|
|
|
+ ext.slience = message.slience
|
|
|
+ }
|
|
|
+ if (message.stick || message.stick === 0) {
|
|
|
+ ext.stick = message.stick
|
|
|
+ }
|
|
|
|
|
|
// 更新
|
|
|
if(index >= 0){
|
|
|
systemStore.ImsessionList = systemStore.ImsessionList.map((item, i)=>{
|
|
|
if(i == index){
|
|
|
- return {...item, unReadNum: item.unReadNum + 1, message: lastMsg, lastTime: time};
|
|
|
+ return { ...item, ...ext, unReadNum: item.unReadNum + 1, message: lastMsg, lastTime: time};
|
|
|
}
|
|
|
return item;
|
|
|
})
|
|
@@ -817,7 +833,7 @@ export const useWebSocketStore = defineStore("webSocketStore", {
|
|
|
// 恢复会话权限
|
|
|
this.funRestoreDelAuth(message.to);
|
|
|
// 刷新/更新会话列表
|
|
|
- this.needRefreshIm += 1;
|
|
|
+ this.chatRefresh += 1;
|
|
|
}
|
|
|
},
|
|
|
// 删除好友操作
|
|
@@ -925,19 +941,25 @@ export const useWebSocketStore = defineStore("webSocketStore", {
|
|
|
}
|
|
|
},
|
|
|
// 群成员列表
|
|
|
- async fetchGroupMembers(){
|
|
|
- if (this.toUserInfo.type == 'group'){
|
|
|
- if (this.groupMembersList[this.toUserInfo.uuid]) {
|
|
|
- return this.groupMembersList[this.toUserInfo.uuid]
|
|
|
- }
|
|
|
- try {
|
|
|
- const res = await groupList(this.toUserInfo.uuid);
|
|
|
- this.groupMembersList[this.toUserInfo.uuid] = res.data || [];
|
|
|
- return res.data
|
|
|
- } catch (e) {
|
|
|
- console.error('获取群成员失败', e);
|
|
|
- return []
|
|
|
- }
|
|
|
+ async fetchGroupMembers(force = false) {
|
|
|
+ if (this.toUserInfo.type !== 'group') {
|
|
|
+ return []
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果已有缓存且不强制刷新,直接返回
|
|
|
+ if (!force && this.groupMembersList[this.toUserInfo.uuid]) {
|
|
|
+ return this.groupMembersList[this.toUserInfo.uuid]
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ const res = await groupList(this.toUserInfo.uuid)
|
|
|
+ const members = res.data || []
|
|
|
+ // 更新缓存
|
|
|
+ this.groupMembersList[this.toUserInfo.uuid] = members
|
|
|
+ return members
|
|
|
+ } catch (e) {
|
|
|
+ console.error('获取群成员失败', e)
|
|
|
+ return []
|
|
|
}
|
|
|
}
|
|
|
},
|