|
@@ -469,6 +469,7 @@ export const useWebSocketStore = defineStore("webSocketStore", {
|
|
|
// 更新缓存里面的会话列表 type:0 发送者 1:接收者
|
|
|
updateSessionList(payload,type = 0) {
|
|
|
const message = {...payload};
|
|
|
+ console.log('缓存中的列表数据',message)
|
|
|
const systemStore = useSystemStore();
|
|
|
const selfUuid = useWalletStore().account; // 当前用户ID
|
|
|
let sessions = systemStore.ImsessionList ? [...systemStore.ImsessionList] : [];
|
|
@@ -511,13 +512,16 @@ export const useWebSocketStore = defineStore("webSocketStore", {
|
|
|
// }
|
|
|
// }
|
|
|
let unReadNum = 0;
|
|
|
+ const ts = message.timestamp || Math.floor(Date.now() / 1000);
|
|
|
+ const time = new Date(ts).toISOString().replace("T", " ").split(".")[0];
|
|
|
if (index > -1) {
|
|
|
unReadNum = sessions[index].unReadNum + 1;
|
|
|
// 更新已有会话
|
|
|
const updated = {
|
|
|
...sessions[index],
|
|
|
newMsg: lastMsg,
|
|
|
- time: message.timestamp || Math.floor(Date.now() / 1000),
|
|
|
+ createDate: time,
|
|
|
+ createdAt: time,
|
|
|
unReadNum: type == 0 ? 0 : unReadNum
|
|
|
};
|
|
|
sessions.splice(index, 1);
|
|
@@ -530,7 +534,8 @@ export const useWebSocketStore = defineStore("webSocketStore", {
|
|
|
name: message.toUsername || message.fromUsername || message.to || message.from,
|
|
|
type: message.messageType == 2?'group':'user',
|
|
|
newMsg: lastMsg,
|
|
|
- time: message.timestamp || Math.floor(Date.now() / 1000),
|
|
|
+ createDate: time,
|
|
|
+ createdAt: time,
|
|
|
avatar: message.avatar || '',
|
|
|
unReadNum: type == 0 ? 0 : unReadNum
|
|
|
};
|