From 41b5a0c064bc07bc43bbff1911e2ed6753cdb53d Mon Sep 17 00:00:00 2001 From: wangxia <779219182@qq.com> Date: Thu, 28 Aug 2025 15:59:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/list/job.vue | 2 +- root/NEUIKit/pages/Chat/index.vue | 1 + root/NEUIKit/pages/Chat/message/message-input.vue | 70 +++++++++++++---------- root/NEUIKit/pages/Chat/message/message-list.vue | 51 +++++++++-------- 4 files changed, 70 insertions(+), 54 deletions(-) diff --git a/components/list/job.vue b/components/list/job.vue index 476e09f..e7dfd01 100644 --- a/components/list/job.vue +++ b/components/list/job.vue @@ -130,7 +130,7 @@ - + 选择 diff --git a/root/NEUIKit/pages/Chat/index.vue b/root/NEUIKit/pages/Chat/index.vue index d3c916b..0334f76 100644 --- a/root/NEUIKit/pages/Chat/index.vue +++ b/root/NEUIKit/pages/Chat/index.vue @@ -552,6 +552,7 @@ const sendJob = (_item) => { msg: customMsg, conversationId, sendBefore: () => { + jobListShow.value = false // scrollBottom(); }, }); diff --git a/root/NEUIKit/pages/Chat/message/message-input.vue b/root/NEUIKit/pages/Chat/message/message-input.vue index bdb22f0..57adf51 100644 --- a/root/NEUIKit/pages/Chat/message/message-input.vue +++ b/root/NEUIKit/pages/Chat/message/message-input.vue @@ -47,7 +47,7 @@
- --> + -->
@@ -70,7 +70,7 @@
-
+
@@ -122,12 +122,12 @@
{{ t("fileText") }}
-
+
@@ -158,7 +158,7 @@ import Face from "./face.vue"; import VoicePanel from "./voice-panel.vue"; import Icon from "../../../components/Icon.vue"; -import { ref, getCurrentInstance, computed, onUnmounted, onMounted, defineProps, withDefaults, defineEmits } from "../../../utils/transformVue"; +import { ref, getCurrentInstance, computed, onUnmounted, onMounted, defineProps, withDefaults,defineEmits } from "../../../utils/transformVue"; import { ALLOW_AT, events, REPLY_MSG_TYPE_MAP } from "../../../utils/constants"; import { emojiMap } from "../../../utils/emoji"; import { t } from "../../../utils/i18n"; @@ -193,6 +193,7 @@ const props = withDefaults( {} ); const emits = defineEmits(["jobListShow"]); + const conversationId = props.conversationType === V2NIMConst.V2NIMConversationType.V2NIM_CONVERSATION_TYPE_P2P ? uni.$UIKitNIM.V2NIMConversationIdUtil.p2pConversationId(props.to) : uni.$UIKitNIM.V2NIMConversationIdUtil.teamConversationId(props.to); const inputText = ref(""); @@ -349,54 +350,63 @@ const onClickEmojiInput = () => { const writeStyle = ref(""); const isIOS = ref(false); writeStyle.value = "bottom:0"; -// #ifdef MP-WEIXIN +// // #ifdef MP-WEIXIN +// const pushUp = ref(false) +// // #endif +// // #ifdef APP-PLUS +// const pushUp = ref(true) +// // #endif + const pushUp = ref(false); -// #endif -// #ifdef APP-PLUS -const pushUp = ref(true); -// #endif const keyHeight = ref(350); const msgKeyHeight = ref("100%"); +// 在message-input.vue的keyboardheightchange事件中修改 const keyboardheightchange = (e) => { - // console.log("键盘高度键盘高度键盘高度键盘高度键盘高度键盘高度键盘高度", e.detail.height); - 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"; - if (sendMoreVisible.value || emojiVisible.value || extVisible.value || audioPanelVisible.value) { - uni.$emit(events.KeyboardEvent, 230); - } else { - uni.$emit(events.KeyboardEvent, 0); - } - uni.$emit("msgKeyHeight", "100%"); + uni.$emit("msgKeyHeight", "100%"); // 键盘收起时恢复全屏高度 } else { + // 隐藏其他面板 emojiVisible.value = false; extVisible.value = false; audioPanelVisible.value = false; sendMoreVisible.value = false; - msgKeyHeight.value = screenHeight.value - keyHeight.value; - uni.$emit("msgKeyHeight", msgKeyHeight.value); + // 统一计算安全区域(适配APP和小程序) + const systemInfo = uni.getSystemInfoSync(); + const safeBottom = systemInfo.safeAreaInsets?.bottom || 0; + // 计算会话区域可用高度 = 屏幕高度 - 键盘高度 - 安全区域底部 + + // 输入框定位适配 + // #ifdef MP-WEIXIN + const availableHeight = systemInfo.windowHeight - e.detail.height - safeBottom - 134; + uni.$emit("msgKeyHeight", availableHeight); // 传递实际可用高度 - // #ifdef MP-WEIXIN writeStyle.value = `bottom: calc(${e.detail.height}px - env(safe-area-inset-bottom))`; - // pushUp.value = false // #endif // #ifdef APP-PLUS - // const systemInfo = uni.getSystemInfoSync().height; - // const safeArea = systemInfo.safeArea.height; - // const bottomSafeAreaHeight = systemInfo.screenHeight - safeArea.bottom; - // 34安全域高度 - // writeStyle.value = `bottom: calc(${e.detail.height - 34}px)`; + // 区分安卓和苹果平台 + 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 = () => { @@ -943,6 +953,8 @@ onUnmounted(() => {