fix:获取会话列表直接重新赋值

feat-im-0607-ch
ch 2 years ago
parent d89e0d2d81
commit ba300da45a

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-05-18 14:54:47
* @LastEditors: ch
* @LastEditTime: 2022-06-13 21:40:12
* @LastEditTime: 2022-06-13 21:53:01
* @Description: file content
*/
import '@/utils/poto-req';
@ -277,24 +277,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[hisIndex]);
} 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);
}
/**

Loading…
Cancel
Save