fix:消息位置错误

feat-im-0607-ch
ch 3 years ago
parent 6f4f8891fa
commit 68736ab913

@ -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 22:14:45 * @LastEditTime: 2022-06-14 11:24:01
* @Description: file content * @Description: file content
*/ */
import '@/utils/poto-req'; import '@/utils/poto-req';
@ -283,6 +283,11 @@ class MsbIm {
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 hisIndex = historyData.findIndex((i) => i.id === item.id);
if (hisIndex < 0) {
item.messageList = [];
}
// 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) {
@ -304,6 +309,7 @@ class MsbIm {
async getHistoryMsg() { async getHistoryMsg() {
const curSessionIdx = this.sessionData.findIndex((i) => i.id === this.curSessionId); const curSessionIdx = this.sessionData.findIndex((i) => i.id === this.curSessionId);
const curSession = this.sessionData[curSessionIdx]; const curSession = this.sessionData[curSessionIdx];
console.log(curSession, this.curSessionId, 'this.curSessionId');
const msgList = curSession.messageList || []; const msgList = curSession.messageList || [];
const par = { const par = {
traceId: CreateUUID(), traceId: CreateUUID(),

@ -3,7 +3,7 @@
class="message-item" class="message-item"
:class="{ :class="{
[`--${messageType[props.message.type]}`]: true, [`--${messageType[props.message.type]}`]: true,
'--self': props.message.fromId !== props.session.fromId, '--self': props.message.fromId == props.session.fromId,
}" }"
> >
<!-- --> <!-- -->

Loading…
Cancel
Save