提交 75900adf 编写于 作者: DCloud_JSON's avatar DCloud_JSON

优化 仅在会话列表点开“群”会话时显示 loading

上级 62d0da93
...@@ -551,48 +551,23 @@ ...@@ -551,48 +551,23 @@
async toChat(param) { async toChat(param) {
this.chatInfoIsShow = false; this.chatInfoIsShow = false;
// console.log('toChat param',param); // console.log('toChat param',param);
let conversation_id = '' let conversation_id = getConversationId(param)
if (typeof param == 'string') {
conversation_id = param
} else {
if (param.conversation_id) {
conversation_id = param.conversation_id
} else if (param.group_id) {
conversation_id = 'group_' + param.group_id
} else if (param.user_id || param.friend_uid) {
conversation_id = (await uniIm.conversation.get(param)).id
// console.log('conversation_id',conversation_id)
// // #ifdef H5
// setTimeout(async ()=>{
// const query = uni.createSelectorQuery().in(this);
// query.select('#'+conversation_id).boundingClientRect(data => {
// if(!data){
// // console.log('找不到 showMsgByIndex #'+conversation_id);
// return
// }else{
// // console.log(data);
// }
// let listHeight = document.querySelector('#user-list-box').clientHeight
// if(data.top - 70 < listHeight){
// return
// }
// this.listScrollTop = ''
// this.$nextTick(()=>{
// this.listScrollTop = currentScrollTop - listHeight + data.top + data.height
// // console.log('this.listScrollTop',this.listScrollTop);
// })
// }).exec()
// },0);
// // #endif
} else {
throw new Error("toChat param is error")
}
}
this.keyword = '' this.keyword = ''
this.filteredConversationId = false this.filteredConversationId = false
uniIm.currentConversationId = conversation_id uniIm.currentConversationId = conversation_id
console.log('conversation_id',conversation_id);
if(conversation_id.indexOf('group_') === 0){
uni.showLoading({
title: '加载中',
mask: false
});
const conversation = await uniIm.conversation.get(conversation_id)
uni.hideLoading()
}
if (this.isWidescreen) { // 若为宽屏,则切换右侧的组件 if (this.isWidescreen) { // 若为宽屏,则切换右侧的组件
this.$nextTick(() => { this.$nextTick(() => {
let chatViewRef = this.$refs['chat-view'] let chatViewRef = this.$refs['chat-view']
...@@ -606,6 +581,22 @@ ...@@ -606,6 +581,22 @@
animationDuration: 300 animationDuration: 300
}) })
} }
function getConversationId(param){
if (typeof param == 'string') {
return param
} else {
if (param.conversation_id) {
return param.conversation_id
} else if (param.group_id) {
return 'group_' + param.group_id
} else if (param.user_id || param.friend_uid) {
return uniIm.utils.getConversationId(param.user_id || param.friend_uid)
} else {
throw new Error("toChat param is error")
}
}
}
}, },
showChatInfo() { showChatInfo() {
this.chatInfoIsShow = !this.chatInfoIsShow this.chatInfoIsShow = !this.chatInfoIsShow
......
...@@ -118,12 +118,12 @@ export default { ...@@ -118,12 +118,12 @@ export default {
// 指定获取某个id的群会话时,判断如果群会话的 群成员为空就从云端拉取 // 指定获取某个id的群会话时,判断如果群会话的 群成员为空就从云端拉取
if (conversationData.group_id && Object.keys(conversationData.group_member).length == 0 && !conversationData if (conversationData.group_id && Object.keys(conversationData.group_member).length == 0 && !conversationData
.leave) { .leave) {
uni.showLoading({ // uni.showLoading({
title: '加载中', // title: '加载中',
mask: true // mask: true
}); // });
await $group.loadMember(conversationData.group_id) await $group.loadMember(conversationData.group_id)
uni.hideLoading() // uni.hideLoading()
} }
// console.log('conversationData*-*--*-**-',conversationData) // console.log('conversationData*-*--*-**-',conversationData)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册