From a97b82d7177cf57efccbfd39f9220e56b1cdfd23 Mon Sep 17 00:00:00 2001 From: zsk <710162063@qq.com> Date: Fri, 29 Aug 2025 17:03:23 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=88=87=E6=8D=A2=20=E9=A1=B6=E9=83=A8?= =?UTF-8?q?=E9=AB=98=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- root/NEUIKit/pages/Chat/message/message-input.vue | 125 +++++++++++----------- root/NEUIKit/pages/Chat/message/message-list.vue | 1 + 2 files changed, 63 insertions(+), 63 deletions(-) diff --git a/root/NEUIKit/pages/Chat/message/message-input.vue b/root/NEUIKit/pages/Chat/message/message-input.vue index 93792ac..4bd1ea9 100644 --- a/root/NEUIKit/pages/Chat/message/message-input.vue +++ b/root/NEUIKit/pages/Chat/message/message-input.vue @@ -64,7 +64,7 @@ - +
@@ -370,7 +370,39 @@ const keyHeight = ref(350); const msgKeyHeight = ref("100%"); const ssff = ref(uni.getWindowInfo().safeArea.top); -console.log("安全域高度安全域高度安全域高度安全域高度安全域高度安全域高度", ssff); + + +const handleInputFocus = (e) => { + emojiVisible.value = false; + extVisible.value = false; + audioPanelVisible.value = false; + sendMoreVisible.value = false; + const systemInfo = uni.getSystemInfoSync(); + const availableHeight = systemInfo.windowHeight - e.detail.height - ssff.value; + setTimeout(()=>{ + + console.log("获取焦点获取焦点获取焦点获取焦点获取焦点获取焦点获取焦点获取焦点获取焦点获取焦点获取焦点获取焦点获取焦点获取焦点"); + uni.$emit("msgKeyHeight", availableHeight); // 传递实际可用高度 + writeStyle.value = `bottom: calc(${e.detail.height}px - env(safe-area-inset-bottom))`; + uni.$emit(events.ON_SCROLL_BOTTOM); + },80) + // 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; + + // const systemInfo = uni.getSystemInfoSync(); + // 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))`; + // // let safeBottom = 0; + // } +} // 在message-input.vue的keyboardheightchange事件中修改 // 在message-input.vue的keyboardheightchange事件中修改 @@ -384,70 +416,32 @@ const keyboardheightchange = (e) => { uni.$emit("msgKeyHeight", "100%"); // 键盘收起时恢复全屏高度 } else { // 隐藏其他面板 + console.log("触发输入框触发输入框触发输入框触发输入框触发输入框触发输入框触发输入框触发输入框"); emojiVisible.value = false; extVisible.value = false; audioPanelVisible.value = false; sendMoreVisible.value = false; - const systemInfo = uni.getSystemInfoSync(); - // let safeBottom = 0; - - // // #ifdef MP-WEIXIN - // if (systemInfo.safeAreaInsets && systemInfo.safeAreaInsets.bottom) { - // 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 } + setTimeout(()=>{ + uni.$emit(events.ON_SCROLL_BOTTOM); + },80) }; -const handleInputBlur = () => { - isFocus.value = false; - uni.$emit("msgKeyHeight", "100%"); -}; +// const handleInputBlur = () => { +// isFocus.value = false; +// uni.$emit("msgKeyHeight", "100%"); +// }; // 滚动到底部 const scrollBottom = () => { if (isAndroidApp || isWxApp || isIosApp) { setTimeout(() => { uni.$emit(events.ON_SCROLL_BOTTOM); - }, 300); + }, 80); } else { uni.$emit(events.ON_SCROLL_BOTTOM); } @@ -574,15 +568,15 @@ const handleEmojiVisible = () => { uni.$emit(events.KeyboardEvent, 0); } uni.$emit(events.ON_SCROLL_BOTTOM); - }, 100); + }, 80); }; -watch(sendMoreVisible, (val) => { - if (val) { - uni.$emit("msgKeyHeight", uni.getSystemInfoSync().windowHeight - 320); // 传递实际可用高度 - } else { - uni.$emit("msgKeyHeight", "100%"); // 传递实际可用高度 - } -}); +// watch(sendMoreVisible, (val) => { +// if (val) { +// uni.$emit("msgKeyHeight", uni.getSystemInfoSync().windowHeight - 270); // 传递实际可用高度 +// } else { +// uni.$emit("msgKeyHeight", "100%"); // 传递实际可用高度 +// } +// }); // 显示发送更多"+"面板 const handleSendMoreVisible = () => { if (isTeamMute.value) return; @@ -590,12 +584,17 @@ const handleSendMoreVisible = () => { emojiVisible.value = false; sendMoreVisible.value = !sendMoreVisible.value; - if (sendMoreVisible.value) { - uni.$emit(events.KeyboardEvent, 230); - } else { - uni.$emit(events.KeyboardEvent, 0); - } - uni.$emit(events.ON_SCROLL_BOTTOM); + + setTimeout(()=>{ + if (sendMoreVisible.value) { + uni.$emit(events.KeyboardEvent, 230); + uni.$emit("msgKeyHeight", uni.getSystemInfoSync().windowHeight - 260); // 传递实际可用高度 + } else { + uni.$emit(events.KeyboardEvent, 0); + uni.$emit("msgKeyHeight", '100%'); // 传递实际可用高度 + } + uni.$emit(events.ON_SCROLL_BOTTOM); + },80) // }, 300) }; diff --git a/root/NEUIKit/pages/Chat/message/message-list.vue b/root/NEUIKit/pages/Chat/message/message-list.vue index 65eafe7..47d3183 100644 --- a/root/NEUIKit/pages/Chat/message/message-list.vue +++ b/root/NEUIKit/pages/Chat/message/message-list.vue @@ -15,6 +15,7 @@
+ 聊天区域高度{{msgKeyHeight}}