From 6bb7f372761012e14e34523b5c9eb1db90740f92 Mon Sep 17 00:00:00 2001 From: YiLin <482244139@qq.com> Date: Thu, 6 Aug 2026 16:55:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8A=A0=E8=BD=BD=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=EF=BC=8C=E4=BC=98=E5=8C=96=E6=B0=94=E6=B3=A1=E5=AD=97?= =?UTF-8?q?=E4=BD=93=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/Chat/Chat.vue | 158 ++++++++++++++---- unpackage/dist/dev/app-plus/app-service.js | 34 ++-- .../dist/dev/app-plus/pages/Chat/Chat.css | 56 ++++--- 3 files changed, 178 insertions(+), 70 deletions(-) diff --git a/pages/Chat/Chat.vue b/pages/Chat/Chat.vue index 50cd630..196557b 100644 --- a/pages/Chat/Chat.vue +++ b/pages/Chat/Chat.vue @@ -121,8 +121,8 @@ - + 加载更多消息... @@ -1687,13 +1687,14 @@ import { openFile as openFileNative, downloadAndOpen } from '@/utils/fileOpener. const scrollToView = ref('') const bottomToggle = ref(false) + const scrollAnimationEnabled = ref(true) // 控制 scroll-with-animation,加载更多时关闭避免可见滑动 // 加载状态和分页相关变量 const isLoadingMore = ref(false) // 是否正在加载更多 const isAILoadingMore = ref(false) // AI 会话是否正在加载更多(滚动到顶部触发) const aiPageNumber = ref(0) // AI 会话当前服务端页码(0-based) const hasMoreAIMessages = ref(true) // AI 会话是否还有更多消息可加载 const currentPage = ref(1) // 当前页码(如果后端支持分页) - const pageSize = 200; + const pageSize = 20; // 好友消息分页 const isFriendLoadingMore = ref(false) // 好友会话是否正在加载更多 @@ -1819,7 +1820,10 @@ import { openFile as openFileNative, downloadAndOpen } from '@/utils/fileOpener. // 定位滚动:原本第一条消息(old index 0)现在在 index = olderMessages.length 处 await nextTick() + scrollAnimationEnabled.value = false // 关闭动画,无感定位 scrollToView.value = 'msg-' + olderMessages.length + await nextTick() + scrollAnimationEnabled.value = true } else { // 只有 API 返回空时才确认没有更多 hasMoreAIMessages.value = false @@ -1845,7 +1849,10 @@ import { openFile as openFileNative, downloadAndOpen } from '@/utils/fileOpener. allmessages.value = [...olderMessages, ...allmessages.value] // 定位滚动 await nextTick() + scrollAnimationEnabled.value = false scrollToView.value = 'msg-' + olderMessages.length + await nextTick() + scrollAnimationEnabled.value = true } else { hasMoreFriendMessages.value = false } @@ -1870,7 +1877,10 @@ import { openFile as openFileNative, downloadAndOpen } from '@/utils/fileOpener. allmessages.value = [...olderMessages, ...allmessages.value] // 定位滚动 await nextTick() + scrollAnimationEnabled.value = false scrollToView.value = 'msg-' + olderMessages.length + await nextTick() + scrollAnimationEnabled.value = true } else { hasMoreGroupMessages.value = false } @@ -2032,67 +2042,143 @@ import { openFile as openFileNative, downloadAndOpen } from '@/utils/fileOpener.