|
|
|
|
@ -362,15 +362,16 @@ const pushUp = ref(false);
|
|
|
|
|
const keyHeight = ref(350);
|
|
|
|
|
const msgKeyHeight = ref("100%");
|
|
|
|
|
|
|
|
|
|
// 在message-input.vue的keyboardheightchange事件中修改
|
|
|
|
|
// 在message-input.vue的keyboardheightchange事件中修改
|
|
|
|
|
const keyboardheightchange = (e) => {
|
|
|
|
|
keyHeight.value = e.detail.height;
|
|
|
|
|
uni.$emit(events.KeyboardEvent, e.detail.height);
|
|
|
|
|
uni.$emit("KeyboardHeight", e.detail.height);
|
|
|
|
|
uni.$emit('KeyboardHeight', e.detail.height);
|
|
|
|
|
|
|
|
|
|
if (e.detail.height === 0) {
|
|
|
|
|
writeStyle.value = "bottom: 0";
|
|
|
|
|
uni.$emit("msgKeyHeight", "100%"); // 键盘收起时恢复全屏高度
|
|
|
|
|
uni.$emit('msgKeyHeight', '100%'); // 键盘收起时恢复全屏高度
|
|
|
|
|
} else {
|
|
|
|
|
// 隐藏其他面板
|
|
|
|
|
emojiVisible.value = false;
|
|
|
|
|
@ -385,15 +386,21 @@ const keyboardheightchange = (e) => {
|
|
|
|
|
|
|
|
|
|
// 输入框定位适配
|
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
|
const availableHeight = systemInfo.windowHeight - e.detail.height - safeBottom - 120;
|
|
|
|
|
uni.$emit("msgKeyHeight", availableHeight); // 传递实际可用高度
|
|
|
|
|
if (systemInfo.platform === 'ios') {
|
|
|
|
|
const availableHeight = systemInfo.windowHeight - e.detail.height - safeBottom - 64;
|
|
|
|
|
uni.$emit('msgKeyHeight', availableHeight); // 传递实际可用高度
|
|
|
|
|
}else{
|
|
|
|
|
const availableHeight = systemInfo.windowHeight - e.detail.height - safeBottom - 94;
|
|
|
|
|
uni.$emit('msgKeyHeight', availableHeight); // 传递实际可用高度
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
writeStyle.value = `bottom: calc(${e.detail.height}px + env(safe-area-inset-bottom))`;
|
|
|
|
|
writeStyle.value = `bottom: calc(${e.detail.height}px - env(safe-area-inset-bottom))`;
|
|
|
|
|
// #endif
|
|
|
|
|
// #ifdef APP-PLUS
|
|
|
|
|
// 区分安卓和苹果平台
|
|
|
|
|
let availableHeight, bottomValue;
|
|
|
|
|
if (systemInfo.platform === "ios") {
|
|
|
|
|
if (systemInfo.platform === 'ios') {
|
|
|
|
|
// 苹果设备
|
|
|
|
|
availableHeight = systemInfo.windowHeight - e.detail.height - safeBottom;
|
|
|
|
|
bottomValue = e.detail.height - safeBottom - 34;
|
|
|
|
|
@ -403,7 +410,7 @@ const keyboardheightchange = (e) => {
|
|
|
|
|
bottomValue = e.detail.height - safeBottom;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uni.$emit("msgKeyHeight", availableHeight); // 传递实际可用高度
|
|
|
|
|
uni.$emit('msgKeyHeight', availableHeight); // 传递实际可用高度
|
|
|
|
|
writeStyle.value = `bottom: ${bottomValue}px`;
|
|
|
|
|
// #endif
|
|
|
|
|
}
|
|
|
|
|
|