fix:update IM SDK

feature/im-0602-ch
ch 3 years ago
parent e3fd51b216
commit 118282854d

@ -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:42:08 * @LastEditTime: 2022-06-13 21:55:21
* @Description: file content * @Description: file content
*/ */
import { CreateUUID, FormatDate, ToAsyncAwait } from "@/common/utils"; import { CreateUUID, FormatDate, ToAsyncAwait } from "@/common/utils";
@ -276,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[hisIndex]); // 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