Compare commits
4 Commits
d9f56e0fbb
...
c7f8afcde4
Author | SHA1 | Date |
---|---|---|
|
c7f8afcde4 | |
|
0a6bc47efe | |
|
1d2efd6397 | |
|
61dd26ab64 |
|
@ -1463,11 +1463,32 @@ const util = {
|
|||
userID: userinfo.id + '',
|
||||
userSig: imSig,
|
||||
}).then(rs => {
|
||||
util.updateMyProfile(userinfo)
|
||||
console.log('im login success', rs)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 更新im个人资料
|
||||
updateMyProfile(userinfo) {
|
||||
// 验证sdk是否准备完毕
|
||||
let isReady = uni.$chat.isReady();
|
||||
if (!isReady) {
|
||||
setTimeout(function () {
|
||||
util.updateMyProfile(userinfo);
|
||||
}, 800);
|
||||
return
|
||||
}
|
||||
|
||||
let obj = {
|
||||
nick: userinfo.userNickname,
|
||||
avatar: userinfo.avatar
|
||||
}
|
||||
uni.$chat.updateMyProfile(obj).then(res => {
|
||||
// console.log(res);
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
* @param {Function} cb 回调函数
|
||||
|
|
|
@ -111,6 +111,7 @@ function getList() {
|
|||
|
||||
uni.$chat.getConversationList().then(rs => {
|
||||
let res = rs.data.conversationList
|
||||
console.log(res);
|
||||
let arr = []
|
||||
res.forEach(item => {
|
||||
let obj = {}
|
||||
|
@ -172,16 +173,16 @@ function handleList(list) {
|
|||
list.forEach(item => {
|
||||
item.MsgTime = handleDate(item.MsgTime)
|
||||
|
||||
let type = item.Type == 1 ? `C2C${item.To_Account}` : `GROUP${item.GroupId}`;
|
||||
let type = item.type == 'C2C' ? `C2C${item.To_Account}` : `GROUP${item.GroupId}`;
|
||||
uni.$chat.getConversationProfile(type).then(rs => {
|
||||
let res = rs.data.conversation;
|
||||
|
||||
item.chatText = res.lastMessage.messageForShow;
|
||||
item.unreadCount = res.unreadCount;
|
||||
if (item.Type == 1) {
|
||||
if (item.type == 'C2C') {
|
||||
item.avatar = res.userProfile.avatar;
|
||||
item.name = res.userProfile.nick;
|
||||
} else if (item.Type == 2) {
|
||||
} else if (item.type == 'GROUP') {
|
||||
item.avatar = res.groupProfile.avatar;
|
||||
item.name = res.groupProfile.name;
|
||||
item.num = res.groupProfile.memberCount;
|
||||
|
@ -255,7 +256,7 @@ function delMsg(item) {
|
|||
return
|
||||
}
|
||||
|
||||
let conversationId = item.Type == 1 ? `C2C${item.userID}` : `GROUP${item.groupID}`;
|
||||
let conversationId = item.type == 'C2C' ? `C2C${item.userID}` : `GROUP${item.groupID}`;
|
||||
|
||||
uni.$chat.deleteConversation(conversationId).then(rs => {
|
||||
getList()
|
||||
|
@ -273,7 +274,7 @@ function setRead(item) {
|
|||
return
|
||||
}
|
||||
|
||||
let conversationId = item.Type == 1 ? `C2C${item.userID}` : `GROUP${item.groupID}`;
|
||||
let conversationId = item.type == 'C2C' ? `C2C${item.userID}` : `GROUP${item.groupID}`;
|
||||
uni.$chat.setMessageRead({
|
||||
conversationID: conversationId,
|
||||
}).then(rs => {
|
||||
|
|
Loading…
Reference in New Issue