|
|
@ -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-14 10:52:01
|
|
|
|
* @LastEditTime: 2022-06-14 17:24:14
|
|
|
|
* @Description: file content
|
|
|
|
* @Description: file content
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
import { CreateUUID, FormatDate, ToAsyncAwait } from "@/common/utils";
|
|
|
|
import { CreateUUID, FormatDate, ToAsyncAwait } from "@/common/utils";
|
|
|
@ -34,6 +34,7 @@ const fromatPotoReq = (traceId, traceType, content) => {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MsbIm {
|
|
|
|
class MsbIm {
|
|
|
|
defaultOption = {
|
|
|
|
defaultOption = {
|
|
|
|
ioKey: 'traceId',
|
|
|
|
ioKey: 'traceId',
|
|
|
@ -200,7 +201,7 @@ class MsbIm {
|
|
|
|
...historyData,
|
|
|
|
...historyData,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fromAvatar: ctx.session.fromAvatar,
|
|
|
|
fromAvatar: ctx.session.fromAvatar,
|
|
|
|
fromId: ctx.fromId,
|
|
|
|
fromId: ctx.session.fromId,
|
|
|
|
fromNickname: ctx.session.fromNickname,
|
|
|
|
fromNickname: ctx.session.fromNickname,
|
|
|
|
id: ctx.sessionId,
|
|
|
|
id: ctx.sessionId,
|
|
|
|
lastMessage: ctx,
|
|
|
|
lastMessage: ctx,
|
|
|
@ -308,7 +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');
|
|
|
|
console.log(curSession, this.curSessionId, 'this.curSessionId');
|
|
|
|
const msgList = curSession.messageList || [];
|
|
|
|
const msgList = curSession.messageList || [];
|
|
|
|
const par = {
|
|
|
|
const par = {
|
|
|
|
traceId: CreateUUID(),
|
|
|
|
traceId: CreateUUID(),
|
|
|
@ -381,6 +382,7 @@ class MsbIm {
|
|
|
|
msgCtx.payload = JSON.parse(msgCtx.payload);
|
|
|
|
msgCtx.payload = JSON.parse(msgCtx.payload);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 点发送,立即把消息加入消息列表,标记为发送中状态
|
|
|
|
// 点发送,立即把消息加入消息列表,标记为发送中状态
|
|
|
|
|
|
|
|
curSession.lastMessage = msgCtx;
|
|
|
|
curSession.messageList.push(msgCtx);
|
|
|
|
curSession.messageList.push(msgCtx);
|
|
|
|
this.setSessionData(this.sessionData);
|
|
|
|
this.setSessionData(this.sessionData);
|
|
|
|
|
|
|
|
|
|
|
@ -399,6 +401,7 @@ class MsbIm {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let newData = [...this.sessionData];
|
|
|
|
let newData = [...this.sessionData];
|
|
|
|
|
|
|
|
curSession.lastMessage = msgCtx;
|
|
|
|
newData[index] = curSession;
|
|
|
|
newData[index] = curSession;
|
|
|
|
this.setSessionData(newData);
|
|
|
|
this.setSessionData(newData);
|
|
|
|
if (error) {
|
|
|
|
if (error) {
|
|
|
|