fix: update im SDK

feature/im-0611-ch
ch 3 years ago
parent 9876af66ad
commit 69abc97570

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

Loading…
Cancel
Save