修改消息拉取记录

This commit is contained in:
2023-12-04 22:25:19 +08:00
parent 6f690c1987
commit d2a3af7f1f
4 changed files with 262 additions and 110 deletions

View File

@@ -2,7 +2,7 @@ import http from '@/common/request'
import browser from '@/common/browser'
import store from '../store'
import pinyin from '@/common/pinyin.js';
import dayjs from "dayjs"
import dayjs from "dayjs"
import localForage from 'localforage';
@@ -346,7 +346,7 @@ export default {
*/
const _userId = uni.getStorageSync("userId")
this.pushInMsg({
type: resbody.msgContent.msgType == 'ALERT' ? 3 : 1, //显示类型 1左侧 2右侧 3中间
msgContent: resbody.msgContent.content, //msg内容
@@ -466,11 +466,11 @@ export default {
store.dispatch('getChatList');
var chatWindowData = store.state.chatDatalist[userId].list
var chatListInfo = store.state.chatlist[userId]
var data2 = this.getKeyObjectStorage(store.state.userInfo.userId + '_' +
'chatlistData')
// var _num=data2[userId].num||
// 找到数组中对象属性值一样的对象并返回
function arrfindobject({
arr,
@@ -682,7 +682,7 @@ export default {
// TODO
// 发送完成之后设置消息状态
//TODO
//TODO
// msgSendType = 'error';
msgOffline.sendtype = msgSendType;
msgOffline.msgId = "1231"
@@ -693,10 +693,23 @@ export default {
if (msgSendType == 'error') {
chatWindowData.push(msgNotSend);
}
// TODO 内网环境下特殊配置,消息返送出去之后不直接存储
/*
store.dispatch('updateChatById', {
userId: userId,
data: chatWindowData
});
});
*/
setTimeout(() => {
store.dispatch('updateChartHistoryFromServerLimit5', {
userId: userId,
data: {
}
});
}, 500)
store.dispatch('updateChatListInfoById', {
userId: userId,
data: msgList
@@ -995,20 +1008,20 @@ export default {
}
titleObj.buttons[index].text = text;
currentWebview.setStyle({
titleNView: titleObj
titleNView: titleObj
});
// #endif
},
formatMessage(msg){
msg.pushType="MSG"
var msgType="TEXT"
formatMessage(msg) {
msg.pushType = "MSG"
var msgType = "TEXT"
var data = store.state.addressList
const fromUserData=data.find(item=>item.userId==msg.fromId)
const _data=JSON.parse(msg.messageBody)
const fromUserData = data.find(item => item.userId == msg.fromId)
const _data = JSON.parse(msg.messageBody)
// try{
// console.log("=======================formatMessage")
// console.log(_data)
@@ -1018,27 +1031,27 @@ export default {
// console.error(e)
// //TODO handle the exception
// }
msg.msgContent={
msgType:_data.msgType,
content:_data.content,
disturb:false,
top:false,
msg.msgContent = {
msgType: _data.msgType,
content: _data.content,
disturb: false,
top: false,
}
msg.windowType="SINGLE"
msg.createTime=msg.messageTime;
msg.userId=msg.fromId;
msg.fromInfo={
userId:msg.fromId,
userType:1,
nickName:fromUserData?fromUserData.realname:msg.fromId,
portrait:"https://shudong2022.oss-cn-hangzhou.aliyuncs.com/common/user/logo.png"
msg.windowType = "SINGLE"
msg.createTime = msg.messageTime;
msg.userId = msg.fromId;
msg.fromInfo = {
userId: msg.fromId,
userType: 1,
nickName: fromUserData ? fromUserData.realname : msg.fromId,
portrait: "https://shudong2022.oss-cn-hangzhou.aliyuncs.com/common/user/logo.png"
};
msg.groupInfo={};
msg.msgId=msg.messageKey;
msg.groupInfo = {};
msg.msgId = msg.messageKey;
return msg
},
debounce(func, wait = 1000, immediate = true) {
/**