|
|
@ -104,7 +104,6 @@ |
|
|
lazy-load="true"></image> |
|
|
lazy-load="true"></image> |
|
|
</view> |
|
|
</view> |
|
|
</scroll-view> |
|
|
</scroll-view> |
|
|
<view v-if="showKeyBoard"></view> |
|
|
|
|
|
</view> |
|
|
</view> |
|
|
<!-- @用户时选择成员 --> |
|
|
<!-- @用户时选择成员 --> |
|
|
<chat-at-box ref="atBox" :ownerId="group.ownerId" :members="groupMembers" |
|
|
<chat-at-box ref="atBox" :ownerId="group.ownerId" :members="groupMembers" |
|
|
@ -133,6 +132,7 @@ export default { |
|
|
chatTabBox: 'none', |
|
|
chatTabBox: 'none', |
|
|
showRecord: false, |
|
|
showRecord: false, |
|
|
keyboardHeight: 300, |
|
|
keyboardHeight: 300, |
|
|
|
|
|
chatMainHeight: 0, // 聊天窗口高度 |
|
|
atUserIds: [], |
|
|
atUserIds: [], |
|
|
needScrollToBottom: false, // 需要滚动到底部 |
|
|
needScrollToBottom: false, // 需要滚动到底部 |
|
|
showMinIdx: 0, // 下标小于showMinIdx的消息不显示,否则可能很卡 |
|
|
showMinIdx: 0, // 下标小于showMinIdx的消息不显示,否则可能很卡 |
|
|
@ -355,6 +355,7 @@ export default { |
|
|
}, |
|
|
}, |
|
|
switchChatTabBox(chatTabBox) { |
|
|
switchChatTabBox(chatTabBox) { |
|
|
this.chatTabBox = chatTabBox; |
|
|
this.chatTabBox = chatTabBox; |
|
|
|
|
|
this.reCalChatMainHeight(); |
|
|
if (chatTabBox != 'tools' && this.$refs.fileUpload) { |
|
|
if (chatTabBox != 'tools' && this.$refs.fileUpload) { |
|
|
this.$refs.fileUpload.hide() |
|
|
this.$refs.fileUpload.hide() |
|
|
} |
|
|
} |
|
|
@ -683,6 +684,7 @@ export default { |
|
|
if (this.isShowKeyBoard) { |
|
|
if (this.isShowKeyBoard) { |
|
|
this.keyboardHeight = keyboardHeight; |
|
|
this.keyboardHeight = keyboardHeight; |
|
|
} |
|
|
} |
|
|
|
|
|
this.reCalChatMainHeight(); |
|
|
}); |
|
|
}); |
|
|
// #endif |
|
|
// #endif |
|
|
// #ifndef H5 |
|
|
// #ifndef H5 |
|
|
@ -691,9 +693,31 @@ export default { |
|
|
if (this.isShowKeyBoard) { |
|
|
if (this.isShowKeyBoard) { |
|
|
this.keyboardHeight = res.height; // 获取并保存键盘高度 |
|
|
this.keyboardHeight = res.height; // 获取并保存键盘高度 |
|
|
} |
|
|
} |
|
|
|
|
|
this.reCalChatMainHeight(); |
|
|
}); |
|
|
}); |
|
|
// #endif |
|
|
// #endif |
|
|
}, |
|
|
}, |
|
|
|
|
|
reCalChatMainHeight() { |
|
|
|
|
|
const sysInfo = uni.getSystemInfoSync(); |
|
|
|
|
|
let h = sysInfo.windowHeight; |
|
|
|
|
|
// 减去标题栏高度 |
|
|
|
|
|
h -= 50; |
|
|
|
|
|
// #ifdef H5 |
|
|
|
|
|
// h5的sysInfo.windowHeight默认就已经减去键盘高度了 |
|
|
|
|
|
if (this.chatTabBox != 'none') { |
|
|
|
|
|
h -= this.keyboardHeight; |
|
|
|
|
|
} |
|
|
|
|
|
// #endif |
|
|
|
|
|
// #ifndef H5 |
|
|
|
|
|
// 减去状态栏高度 |
|
|
|
|
|
h -= sysInfo.statusBarHeight; |
|
|
|
|
|
if (this.isShowKeyBoard || this.chatTabBox != 'none') { |
|
|
|
|
|
h -= this.keyboardHeight; |
|
|
|
|
|
} |
|
|
|
|
|
// #endif |
|
|
|
|
|
console.log("h:", h) |
|
|
|
|
|
this.chatMainHeight = h; |
|
|
|
|
|
}, |
|
|
generateId() { |
|
|
generateId() { |
|
|
// 生成临时id |
|
|
// 生成临时id |
|
|
return String(new Date().getTime()) + String(Math.floor(Math.random() * 1000)); |
|
|
return String(new Date().getTime()) + String(Math.floor(Math.random() * 1000)); |
|
|
@ -745,26 +769,6 @@ export default { |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
return atUsers; |
|
|
return atUsers; |
|
|
}, |
|
|
|
|
|
chatMainHeight() { |
|
|
|
|
|
const sysInfo = uni.getSystemInfoSync(); |
|
|
|
|
|
let h = sysInfo.windowHeight; |
|
|
|
|
|
// 减去标题栏高度 |
|
|
|
|
|
h -= 50; |
|
|
|
|
|
// #ifdef H5 |
|
|
|
|
|
// h5的sysInfo.windowHeight默认就已经减去键盘高度了 |
|
|
|
|
|
if (this.chatTabBox != 'none') { |
|
|
|
|
|
h -= this.keyboardHeight; |
|
|
|
|
|
} |
|
|
|
|
|
// #endif |
|
|
|
|
|
// #ifndef H5 |
|
|
|
|
|
// 减去状态栏高度 |
|
|
|
|
|
h -= sysInfo.statusBarHeight; |
|
|
|
|
|
if (this.isShowKeyBoard || this.chatTabBox != 'none') { |
|
|
|
|
|
h -= this.keyboardHeight; |
|
|
|
|
|
} |
|
|
|
|
|
// #endif |
|
|
|
|
|
return h; |
|
|
|
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
watch: { |
|
|
watch: { |
|
|
@ -810,6 +814,8 @@ export default { |
|
|
this.isReceipt = false; |
|
|
this.isReceipt = false; |
|
|
// 监听键盘高度 |
|
|
// 监听键盘高度 |
|
|
this.listenKeyBoard(); |
|
|
this.listenKeyBoard(); |
|
|
|
|
|
// 计算聊天窗口高度 |
|
|
|
|
|
this.$nextTick(()=>this.reCalChatMainHeight()) |
|
|
}, |
|
|
}, |
|
|
onShow() { |
|
|
onShow() { |
|
|
if (this.needScrollToBottom) { |
|
|
if (this.needScrollToBottom) { |
|
|
|