Compare commits
No commits in common. "c7f8afcde4024ef3266bec150c9000fc288dc282" and "d9f56e0fbbc0c14a6e24e30c48459296231b5c0f" have entirely different histories.
c7f8afcde4
...
d9f56e0fbb
|
@ -66,14 +66,14 @@ const util = {
|
||||||
showCancel: obj.showCancel,
|
showCancel: obj.showCancel,
|
||||||
cancelText: obj.cancelText,
|
cancelText: obj.cancelText,
|
||||||
success: res => {
|
success: res => {
|
||||||
obj.success ? obj.success(res) : () => { }
|
obj.success ? obj.success(res) : () => {}
|
||||||
resolve(res)
|
resolve(res)
|
||||||
},
|
},
|
||||||
fail: err => {
|
fail: err => {
|
||||||
obj.fail ? obj.fail(err) : () => { }
|
obj.fail ? obj.fail(err) : () => {}
|
||||||
reject(err)
|
reject(err)
|
||||||
},
|
},
|
||||||
complete: res => { }
|
complete: res => {}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -920,7 +920,7 @@ const util = {
|
||||||
const file_suffix = util.config[{
|
const file_suffix = util.config[{
|
||||||
'file': 'file_suffix',
|
'file': 'file_suffix',
|
||||||
'audio': 'audio_suffix',
|
'audio': 'audio_suffix',
|
||||||
}[type]]
|
} [type]]
|
||||||
let result = ''
|
let result = ''
|
||||||
if (url) result = file_suffix.find(item => item.id === url.split('.').pop().toLowerCase())
|
if (url) result = file_suffix.find(item => item.id === url.split('.').pop().toLowerCase())
|
||||||
return result
|
return result
|
||||||
|
@ -1165,7 +1165,7 @@ const util = {
|
||||||
util.alert("您拒绝了授权");
|
util.alert("您拒绝了授权");
|
||||||
|
|
||||||
// 失败
|
// 失败
|
||||||
obj.fail ? obj.fail(res) : (res) => { };
|
obj.fail ? obj.fail(res) : (res) => {};
|
||||||
},
|
},
|
||||||
complete() {
|
complete() {
|
||||||
// 结束
|
// 结束
|
||||||
|
@ -1463,32 +1463,11 @@ const util = {
|
||||||
userID: userinfo.id + '',
|
userID: userinfo.id + '',
|
||||||
userSig: imSig,
|
userSig: imSig,
|
||||||
}).then(rs => {
|
}).then(rs => {
|
||||||
util.updateMyProfile(userinfo)
|
|
||||||
console.log('im login success', rs)
|
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 回调函数
|
* @param {Function} cb 回调函数
|
||||||
|
@ -1749,7 +1728,7 @@ const util = {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
showToastAndRedirect(title, icon = 'none', fun = () => { }) {
|
showToastAndRedirect(title, icon = 'none', fun = () => {}) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title,
|
title,
|
||||||
icon,
|
icon,
|
||||||
|
|
|
@ -111,7 +111,6 @@ function getList() {
|
||||||
|
|
||||||
uni.$chat.getConversationList().then(rs => {
|
uni.$chat.getConversationList().then(rs => {
|
||||||
let res = rs.data.conversationList
|
let res = rs.data.conversationList
|
||||||
console.log(res);
|
|
||||||
let arr = []
|
let arr = []
|
||||||
res.forEach(item => {
|
res.forEach(item => {
|
||||||
let obj = {}
|
let obj = {}
|
||||||
|
@ -173,16 +172,16 @@ function handleList(list) {
|
||||||
list.forEach(item => {
|
list.forEach(item => {
|
||||||
item.MsgTime = handleDate(item.MsgTime)
|
item.MsgTime = handleDate(item.MsgTime)
|
||||||
|
|
||||||
let type = item.type == 'C2C' ? `C2C${item.To_Account}` : `GROUP${item.GroupId}`;
|
let type = item.Type == 1 ? `C2C${item.To_Account}` : `GROUP${item.GroupId}`;
|
||||||
uni.$chat.getConversationProfile(type).then(rs => {
|
uni.$chat.getConversationProfile(type).then(rs => {
|
||||||
let res = rs.data.conversation;
|
let res = rs.data.conversation;
|
||||||
|
|
||||||
item.chatText = res.lastMessage.messageForShow;
|
item.chatText = res.lastMessage.messageForShow;
|
||||||
item.unreadCount = res.unreadCount;
|
item.unreadCount = res.unreadCount;
|
||||||
if (item.type == 'C2C') {
|
if (item.Type == 1) {
|
||||||
item.avatar = res.userProfile.avatar;
|
item.avatar = res.userProfile.avatar;
|
||||||
item.name = res.userProfile.nick;
|
item.name = res.userProfile.nick;
|
||||||
} else if (item.type == 'GROUP') {
|
} else if (item.Type == 2) {
|
||||||
item.avatar = res.groupProfile.avatar;
|
item.avatar = res.groupProfile.avatar;
|
||||||
item.name = res.groupProfile.name;
|
item.name = res.groupProfile.name;
|
||||||
item.num = res.groupProfile.memberCount;
|
item.num = res.groupProfile.memberCount;
|
||||||
|
@ -256,7 +255,7 @@ function delMsg(item) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let conversationId = item.type == 'C2C' ? `C2C${item.userID}` : `GROUP${item.groupID}`;
|
let conversationId = item.Type == 1 ? `C2C${item.userID}` : `GROUP${item.groupID}`;
|
||||||
|
|
||||||
uni.$chat.deleteConversation(conversationId).then(rs => {
|
uni.$chat.deleteConversation(conversationId).then(rs => {
|
||||||
getList()
|
getList()
|
||||||
|
@ -274,7 +273,7 @@ function setRead(item) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let conversationId = item.type == 'C2C' ? `C2C${item.userID}` : `GROUP${item.groupID}`;
|
let conversationId = item.Type == 1 ? `C2C${item.userID}` : `GROUP${item.groupID}`;
|
||||||
uni.$chat.setMessageRead({
|
uni.$chat.setMessageRead({
|
||||||
conversationID: conversationId,
|
conversationID: conversationId,
|
||||||
}).then(rs => {
|
}).then(rs => {
|
||||||
|
|
Loading…
Reference in New Issue