|
|
|
@ -63,7 +63,7 @@
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!--键盘高度{{keyHeight}} 输入框距离底部距离{{writeStyle}}屏幕高度{{screenHeight}}顶部聊天区域高度{{msgKeyHeight}}-->
|
|
|
|
<!-- {{ssff}}键盘高度{{keyHeight}} 输入框距离底部距离{{writeStyle}}屏幕高度{{screenHeight}}顶部聊天区域高度{{msgKeyHeight}} -->
|
|
|
|
<input v-show="!showEmojiInput" :focus="isFocus" class="msg-input-input g_flex_1" :maxlength="-1" :placeholder="isTeamMute ? t('teamMutePlaceholder') : t('chatInputPlaceHolder')" v-model="inputText" type="text" :disabled="isTeamMute" :confirm-hold="true" cursor-spacing="20" :adjust-position="pushUp" confirm-type="send" @keyboardheightchange="keyboardheightchange" @confirm="handleSendTextMsg" @blur="handleInputBlur" @input="handleInput" id="msg-input" />
|
|
|
|
<input v-show="!showEmojiInput" :focus="isFocus" class="msg-input-input g_flex_1" :maxlength="-1" :placeholder="isTeamMute ? t('teamMutePlaceholder') : t('chatInputPlaceHolder')" v-model="inputText" type="text" :disabled="isTeamMute" :confirm-hold="true" cursor-spacing="20" :adjust-position="pushUp" confirm-type="send" @keyboardheightchange="keyboardheightchange" @confirm="handleSendTextMsg" @blur="handleInputBlur" @input="handleInput" id="msg-input" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
@ -361,53 +361,74 @@ const pushUp = ref(false);
|
|
|
|
|
|
|
|
|
|
|
|
const keyHeight = ref(350);
|
|
|
|
const keyHeight = ref(350);
|
|
|
|
const msgKeyHeight = ref("100%");
|
|
|
|
const msgKeyHeight = ref("100%");
|
|
|
|
|
|
|
|
const ssff = ref(uni.getWindowInfo().safeArea.top);
|
|
|
|
|
|
|
|
|
|
|
|
// 在message-input.vue的keyboardheightchange事件中修改
|
|
|
|
console.log('安全域高度安全域高度安全域高度安全域高度安全域高度安全域高度',ssff);
|
|
|
|
const keyboardheightchange = (e) => {
|
|
|
|
|
|
|
|
keyHeight.value = e.detail.height;
|
|
|
|
|
|
|
|
uni.$emit(events.KeyboardEvent, e.detail.height);
|
|
|
|
|
|
|
|
uni.$emit("KeyboardHeight", e.detail.height);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (e.detail.height === 0) {
|
|
|
|
|
|
|
|
writeStyle.value = "bottom: 0";
|
|
|
|
|
|
|
|
uni.$emit("msgKeyHeight", "100%"); // 键盘收起时恢复全屏高度
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 隐藏其他面板
|
|
|
|
|
|
|
|
emojiVisible.value = false;
|
|
|
|
|
|
|
|
extVisible.value = false;
|
|
|
|
|
|
|
|
audioPanelVisible.value = false;
|
|
|
|
|
|
|
|
sendMoreVisible.value = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 统一计算安全区域(适配APP和小程序)
|
|
|
|
|
|
|
|
const systemInfo = uni.getSystemInfoSync();
|
|
|
|
|
|
|
|
const safeBottom = systemInfo.safeAreaInsets?.bottom || 0;
|
|
|
|
|
|
|
|
// 计算会话区域可用高度 = 屏幕高度 - 键盘高度 - 安全区域底部
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 输入框定位适配
|
|
|
|
// 在message-input.vue的keyboardheightchange事件中修改
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
// 在message-input.vue的keyboardheightchange事件中修改
|
|
|
|
const availableHeight = systemInfo.windowHeight - e.detail.height - safeBottom - 120;
|
|
|
|
const keyboardheightchange = (e) => {
|
|
|
|
uni.$emit("msgKeyHeight", availableHeight); // 传递实际可用高度
|
|
|
|
keyHeight.value = e.detail.height;
|
|
|
|
|
|
|
|
uni.$emit(events.KeyboardEvent, e.detail.height);
|
|
|
|
writeStyle.value = `bottom: calc(${e.detail.height}px + env(safe-area-inset-bottom))`;
|
|
|
|
uni.$emit('KeyboardHeight', e.detail.height);
|
|
|
|
// #endif
|
|
|
|
|
|
|
|
// #ifdef APP-PLUS
|
|
|
|
if (e.detail.height === 0) {
|
|
|
|
// 区分安卓和苹果平台
|
|
|
|
writeStyle.value = "bottom: 0";
|
|
|
|
let availableHeight, bottomValue;
|
|
|
|
uni.$emit('msgKeyHeight', '100%'); // 键盘收起时恢复全屏高度
|
|
|
|
if (systemInfo.platform === "ios") {
|
|
|
|
} else {
|
|
|
|
// 苹果设备
|
|
|
|
// 隐藏其他面板
|
|
|
|
availableHeight = systemInfo.windowHeight - e.detail.height - safeBottom;
|
|
|
|
emojiVisible.value = false;
|
|
|
|
bottomValue = e.detail.height - safeBottom - 34;
|
|
|
|
extVisible.value = false;
|
|
|
|
} else {
|
|
|
|
audioPanelVisible.value = false;
|
|
|
|
// 安卓设备
|
|
|
|
sendMoreVisible.value = false;
|
|
|
|
availableHeight = systemInfo.windowHeight - e.detail.height - safeBottom - 34;
|
|
|
|
|
|
|
|
bottomValue = e.detail.height - safeBottom;
|
|
|
|
const systemInfo = uni.getSystemInfoSync();
|
|
|
|
}
|
|
|
|
// let safeBottom = 0;
|
|
|
|
|
|
|
|
|
|
|
|
uni.$emit("msgKeyHeight", availableHeight); // 传递实际可用高度
|
|
|
|
// // #ifdef MP-WEIXIN
|
|
|
|
writeStyle.value = `bottom: ${bottomValue}px`;
|
|
|
|
// if (systemInfo.safeAreaInsets && systemInfo.safeAreaInsets.bottom) {
|
|
|
|
// #endif
|
|
|
|
// safeBottom = systemInfo.safeAreaInsets.bottom;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
};
|
|
|
|
// // #endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // #ifdef APP-PLUS
|
|
|
|
|
|
|
|
// if (systemInfo.safeAreaInsets && systemInfo.safeAreaInsets.bottom) {
|
|
|
|
|
|
|
|
// safeBottom = systemInfo.safeAreaInsets.bottom;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// // #endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // 输入框定位适配
|
|
|
|
|
|
|
|
// // #ifdef MP-WEIXIN
|
|
|
|
|
|
|
|
// if (systemInfo.platform === 'ios') {
|
|
|
|
|
|
|
|
// const availableHeight = systemInfo.windowHeight - e.detail.height - ssff.value;
|
|
|
|
|
|
|
|
// uni.$emit('msgKeyHeight', availableHeight); // 传递实际可用高度
|
|
|
|
|
|
|
|
// }else{
|
|
|
|
|
|
|
|
// const availableHeight = systemInfo.windowHeight - e.detail.height - ssff.value;
|
|
|
|
|
|
|
|
// uni.$emit('msgKeyHeight', availableHeight); // 传递实际可用高度
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const availableHeight = systemInfo.windowHeight - e.detail.height - ssff.value;
|
|
|
|
|
|
|
|
uni.$emit('msgKeyHeight', availableHeight); // 传递实际可用高度
|
|
|
|
|
|
|
|
writeStyle.value = `bottom: calc(${e.detail.height}px - env(safe-area-inset-bottom))`;
|
|
|
|
|
|
|
|
// #endif
|
|
|
|
|
|
|
|
// #ifdef APP-PLUS
|
|
|
|
|
|
|
|
// 区分安卓和苹果平台
|
|
|
|
|
|
|
|
let availableHeight, bottomValue;
|
|
|
|
|
|
|
|
if (systemInfo.platform === 'ios') {
|
|
|
|
|
|
|
|
// 苹果设备
|
|
|
|
|
|
|
|
availableHeight = systemInfo.windowHeight - e.detail.height - safeBottom;
|
|
|
|
|
|
|
|
bottomValue = e.detail.height - safeBottom - 34;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 安卓设备
|
|
|
|
|
|
|
|
availableHeight = systemInfo.windowHeight - e.detail.height - safeBottom - 34;
|
|
|
|
|
|
|
|
bottomValue = e.detail.height - safeBottom;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uni.$emit('msgKeyHeight', availableHeight); // 传递实际可用高度
|
|
|
|
|
|
|
|
writeStyle.value = `bottom: ${bottomValue}px`;
|
|
|
|
|
|
|
|
// #endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const handleInputBlur = () => {
|
|
|
|
const handleInputBlur = () => {
|
|
|
|
isFocus.value = false;
|
|
|
|
isFocus.value = false;
|
|
|
|
|