私聊中头像错误展示

This commit is contained in:
2022-02-16 16:58:45 +08:00
parent fe9b79a18d
commit 255a727d32
8 changed files with 43 additions and 38 deletions

View File

@@ -71,14 +71,14 @@ const connect = (token, userInfo, callback) => {
})
})
},
fail: () => {
fail: () => {
// 程序是首次运行,初始化加载好友和群组信息
Promise.all([getFriends(), getMyGroups()]).then(result => {
Promise.all([getFriends(), getMyGroups()]).then(result => {
result.map(contacts => {
contacts.map(item => {
store.dispatch('initContact', item)
})
})
})
uni.setStorageSync(FK, userInfo.targetId)
})
}
@@ -141,16 +141,16 @@ const addListeners = () => {
}).catch(err => {
console.log('ERR', err)
})
}
if (!store.getters.contactIsExist(message.senderUserId)) {
getUserInfo(message.senderUserId).then(res => {
store.dispatch('initContact', res)
}).catch(err => {
console.log('ERR', err)
})
}
if (!store.getters.contactIsExist(message.senderUserId)) {
getUserInfo(message.senderUserId).then(res => {
store.dispatch('initContact', res)
}).catch(err => {
console.log('ERR', err)
})
}
newMessage(message)
} else if (message.objectName === RongIMLib.ObjectName.ProfileNotification) {
} else if (message.objectName === RongIMLib.ObjectName.ProfileNotification) {
// 更新会话信息
store.dispatch('updateContact', JSON.parse(message.content.data))
// 调用完更新之后,删除这条消息

View File

@@ -151,14 +151,15 @@ const sentImage = (conversationType, targetId, imageUrl, user, callback) => {
})
}
const sentGif = (conversationType, targetId, gifUrl, time, callback) => {
const sentGif = (conversationType, targetId, gifUrl, time, user, callback) => {
const msg = {
conversationType: conversationType,
targetId: String(targetId),
content: {
objectName: 'RC:GIFMsg',
local: 'file:///' + plus.io.convertLocalFileSystemURL(gifUrl),
duration: time
duration: time,
userInfo: user
}
}
RongIMLib.sendMediaMessage(msg, {
@@ -177,14 +178,15 @@ const sentGif = (conversationType, targetId, gifUrl, time, callback) => {
})
}
const sendFile = (conversationType, targetId, fileUrl, time, callback) => {
const sendFile = (conversationType, targetId, fileUrl, time, user, callback) => {
const msg = {
conversationType: conversationType,
targetId: String(targetId),
content: {
objectName: 'RC:FileMsg',
local: 'file:///' + plus.io.convertLocalFileSystemURL(fileUrl),
duration: time
duration: time,
userInfo: user
}
}
RongIMLib.sendMediaMessage(msg, {
@@ -204,7 +206,7 @@ const sendFile = (conversationType, targetId, fileUrl, time, callback) => {
}
export default {
getMessageList,
getMessageList,
getPendingList,
sentText,
sentVoice,