|
|
|
@ -2,7 +2,7 @@
|
|
|
|
|
* @Author: ch
|
|
|
|
|
* @Date: 2022-05-18 14:54:47
|
|
|
|
|
* @LastEditors: ch
|
|
|
|
|
* @LastEditTime: 2022-06-13 21:23:02
|
|
|
|
|
* @LastEditTime: 2022-06-13 21:56:37
|
|
|
|
|
* @Description: file content
|
|
|
|
|
*/
|
|
|
|
|
import { CreateUUID, FormatDate, ToAsyncAwait } from "@/plugins/utils";
|
|
|
|
@ -186,6 +186,12 @@ class MsbIm {
|
|
|
|
|
// 不在当前会话窗口则向会话消息加1条未读
|
|
|
|
|
if (ctx.sessionId !== this.curSessionId) {
|
|
|
|
|
curHisData.unreadCount++;
|
|
|
|
|
} else {
|
|
|
|
|
this.setRead({
|
|
|
|
|
content: {
|
|
|
|
|
sessionId: this.curSessionId,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
newData = historyData;
|
|
|
|
|
} else {
|
|
|
|
@ -270,24 +276,24 @@ class MsbIm {
|
|
|
|
|
return Promise.reject(error);
|
|
|
|
|
}
|
|
|
|
|
const { content } = result;
|
|
|
|
|
let newData = [];
|
|
|
|
|
// let newData = [];
|
|
|
|
|
|
|
|
|
|
content.sessionVOS.forEach((item) => {
|
|
|
|
|
if (item.lastMessage) {
|
|
|
|
|
item.lastMessage.payload = JSON.parse(item.lastMessage.payload || {});
|
|
|
|
|
}
|
|
|
|
|
let historyData = this.sessionData;
|
|
|
|
|
let hisIndex = historyData.findIndex((i) => i.id === item.id);
|
|
|
|
|
if (hisIndex >= 0) {
|
|
|
|
|
historyData[hisIndex].lastMessage = item.lastMessage;
|
|
|
|
|
historyData[hisIndex].unreadCount++;
|
|
|
|
|
newData.push(historyData);
|
|
|
|
|
} else {
|
|
|
|
|
item.messageList = [];
|
|
|
|
|
newData = [...newData, item];
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.setSessionData(newData);
|
|
|
|
|
// content.sessionVOS.forEach((item) => {
|
|
|
|
|
// if (item.lastMessage) {
|
|
|
|
|
// item.lastMessage.payload = JSON.parse(item.lastMessage.payload || {});
|
|
|
|
|
// }
|
|
|
|
|
// let historyData = this.sessionData;
|
|
|
|
|
// let hisIndex = historyData.findIndex((i) => i.id === item.id);
|
|
|
|
|
// if (hisIndex >= 0) {
|
|
|
|
|
// historyData[hisIndex].lastMessage = item.lastMessage;
|
|
|
|
|
// historyData[hisIndex].unreadCount++;
|
|
|
|
|
// newData.push(historyData[hisIndex]);
|
|
|
|
|
// } else {
|
|
|
|
|
// item.messageList = [];
|
|
|
|
|
// newData = [...newData, item];
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
this.setSessionData(content.sessionVOS);
|
|
|
|
|
return Promise.resolve(result);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|