From af596bcc70efb658967cca4d9794e536de1a6e3d Mon Sep 17 00:00:00 2001 From: puhui999 Date: Thu, 8 May 2025 18:16:18 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91=E5=AE=A2=E6=9C=8D=E6=B6=88=E6=81=AF=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 5 ++- pages/chat/components/messageList.vue | 7 +++- pages/chat/components/messageListItem.vue | 39 ++++++++++++----------- 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/pages.json b/pages.json index 1d433ed..65f68b4 100644 --- a/pages.json +++ b/pages.json @@ -549,7 +549,10 @@ "pages": [{ "path": "index", "style": { - "navigationBarTitleText": "客服" + "navigationBarTitleText": "客服", + "app-plus": { + "softinputMode": "adjustResize" + } }, "meta": { "auth": true, diff --git a/pages/chat/components/messageList.vue b/pages/chat/components/messageList.vue index 5efccaa..843c816 100644 --- a/pages/chat/components/messageList.vue +++ b/pages/chat/components/messageList.vue @@ -57,7 +57,7 @@ // 计算聊天窗口高度 const chatScrollHeight = computed(() => { - const baseHeight = 'calc(100vh - 100px - ' + safeAreaInsetsBottom + ')'; + const baseHeight = 'calc(100vh - 150px - ' + safeAreaInsetsBottom + ')'; if (keyboardHeight.value > 0) { // 键盘弹起状态,减去键盘高度 return `calc(${baseHeight} - ${keyboardHeight.value}px)`; @@ -200,6 +200,7 @@ // #endif // #ifdef MP-WEIXIN + // TODO puhui999: 小程序键盘弹起还有点问题,看看怎么适配 // 微信小程序环境 uni.onKeyboardHeightChange((res) => { setKeyboardHeight(res.height); @@ -209,6 +210,10 @@ onMounted(() => { queryParams.no = 1; // 确保首次加载是第一页 + scroll.value = { + top: 0, + oldTop: 0, + } getMessageList(); setupKeyboardListeners(); }); diff --git a/pages/chat/components/messageListItem.vue b/pages/chat/components/messageListItem.vue index f0210ce..e959109 100644 --- a/pages/chat/components/messageListItem.vue +++ b/pages/chat/components/messageListItem.vue @@ -2,6 +2,26 @@ + + + + {{ message.content }} + + + + {{ formatDate(message.createTime) }} + + + - - - - {{ formatDate(message.createTime) }} - - - - {{ message.content }} - -