头像 昵称

feature/im-0602-ch
ch 3 years ago
parent d5ec34c4da
commit ecd5c60430

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-05-18 14:54:47
* @LastEditors: ch
* @LastEditTime: 2022-06-12 13:43:09
* @LastEditTime: 2022-06-13 20:56:46
* @Description: file content
*/
import { CreateUUID, FormatDate, ToAsyncAwait } from "@/common/utils";
@ -192,13 +192,13 @@ class MsbIm {
newData = [
...historyData,
{
fromAvatar: ctx.fromAvatar,
fromAvatar: ctx.session.fromAvatar,
fromId: ctx.fromId,
fromNickname: ctx.fromNickname,
fromNickname: ctx.session.fromNickname,
id: ctx.sessionId,
lastMessage: ctx,
messageList: [ctx],
updateTimeStamp : ctx.createTimeStamp,
updateTimeStamp: ctx.createTimeStamp,
unreadCount: 1,
},
];
@ -269,6 +269,7 @@ class MsbIm {
return Promise.reject(error);
}
const { content } = result;
let newData = [];
content.sessionVOS.forEach((item) => {
if (item.lastMessage) {
@ -279,13 +280,14 @@ class MsbIm {
if (hisIndex >= 0) {
historyData[hisIndex].lastMessage = item.lastMessage;
historyData[hisIndex].unreadCount++;
this.setSessionData(historyData);
newData.push(historyData);
} else {
item.messageList = [];
const newData = [...historyData, item];
this.setSessionData(newData);
newData = [...newData, item];
}
});
this.setSessionData(newData);
return Promise.resolve(result);
}
/**
@ -364,10 +366,12 @@ class MsbIm {
sendStatus: 'loading',
};
if (typeof msgCtx.payload === 'string') {
msgCtx.payload = JSON.parse(msgCtx.payload)
msgCtx.payload = JSON.parse(msgCtx.payload);
}
// 点发送,立即把消息加入消息列表,标记为发送中状态
curSession.messageList.push(msgCtx);
this.setSessionData(this.sessionData);
// 超过时间未返回视为发送失败
this.timerStatus(msgCtx);

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-28 15:38:23
* @LastEditors: ch
* @LastEditTime: 2022-05-17 11:44:50
* @LastEditTime: 2022-06-13 20:49:32
* @Description: file content
-->
<template>
@ -38,7 +38,7 @@ export default {
nickname : this.userInfo.nickname
});
if(error){
ui.$u.totas(error.message);
uni.$u.toast(error.message);
return false;
}
this.$store.commit('SET_USER_INFO', {...this.userInfo});

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-28 15:38:23
* @LastEditors: ch
* @LastEditTime: 2022-05-24 09:57:14
* @LastEditTime: 2022-06-13 20:59:54
* @Description: file content
-->
<template>
@ -106,7 +106,7 @@ export default {
const avatar = `${oss.host}/${oss.dir}${fileName}`;
const {error, result} = await ApiPutUser({avatar});
if(error){
ui.$u.totas(error.message);
uni.$u.toast(error.message);
return false
}
this.$store.commit('SET_USER_INFO', {...this.userInfo, avatar});

Loading…
Cancel
Save