优化加载信息,优化气泡字体大小

This commit is contained in:
2026-08-06 16:55:37 +08:00
parent 23a03d0ed3
commit 6bb7f37276
3 changed files with 178 additions and 70 deletions

View File

@@ -5800,7 +5800,7 @@ This will fail in production.`);
}
});
}
const pageSize$1 = 200;
const pageSize$1 = 20;
const groupSize = 100;
const _sfc_main$a = {
__name: "Chat",
@@ -6895,6 +6895,7 @@ This will fail in production.`);
const allmessages = vue.ref([]);
const scrollToView = vue.ref("");
const bottomToggle = vue.ref(false);
const scrollAnimationEnabled = vue.ref(true);
const isLoadingMore = vue.ref(false);
const isAILoadingMore = vue.ref(false);
const aiPageNumber = vue.ref(0);
@@ -6947,12 +6948,12 @@ This will fail in production.`);
hasMoreGroupMessages.value = true;
const rawMessages = await getGroupMessages(currentSessionId.value, pageSize$1, 0) || [];
allmessages.value = rawMessages;
formatAppLog("log", "at pages/Chat/Chat.vue:1760", "群聊消息:", allmessages.value);
formatAppLog("log", "at pages/Chat/Chat.vue:1761", "群聊消息:", allmessages.value);
const memberList = await getGroupMemberList(currentSessionId.value);
formatAppLog("log", "at pages/Chat/Chat.vue:1763", "获取到的群成员列表:", memberList);
formatAppLog("log", "at pages/Chat/Chat.vue:1764", "获取到的群成员列表:", memberList);
if (memberList && memberList.length) {
groupMemberList.value = await takeGroupMemberAvatar(memberList);
formatAppLog("log", "at pages/Chat/Chat.vue:1766", "群成员列表(带头像):", groupMemberList.value);
formatAppLog("log", "at pages/Chat/Chat.vue:1767", "群成员列表(带头像):", groupMemberList.value);
} else {
groupMemberList.value = [];
}
@@ -6986,12 +6987,15 @@ This will fail in production.`);
aiPageNumber.value = nextPage;
allmessages.value = [...olderMessages, ...allmessages.value];
await vue.nextTick();
scrollAnimationEnabled.value = false;
scrollToView.value = "msg-" + olderMessages.length;
await vue.nextTick();
scrollAnimationEnabled.value = true;
} else {
hasMoreAIMessages.value = false;
}
} catch (e2) {
formatAppLog("error", "at pages/Chat/Chat.vue:1828", "加载更多消息失败:", e2);
formatAppLog("error", "at pages/Chat/Chat.vue:1832", "加载更多消息失败:", e2);
uni.showToast({ title: "加载更多失败", icon: "none" });
} finally {
isAILoadingMore.value = false;
@@ -7008,12 +7012,15 @@ This will fail in production.`);
friendPageNumber.value = nextPage;
allmessages.value = [...olderMessages, ...allmessages.value];
await vue.nextTick();
scrollAnimationEnabled.value = false;
scrollToView.value = "msg-" + olderMessages.length;
await vue.nextTick();
scrollAnimationEnabled.value = true;
} else {
hasMoreFriendMessages.value = false;
}
} catch (e2) {
formatAppLog("error", "at pages/Chat/Chat.vue:1853", "加载更多好友消息失败:", e2);
formatAppLog("error", "at pages/Chat/Chat.vue:1860", "加载更多好友消息失败:", e2);
uni.showToast({ title: "加载更多失败", icon: "none" });
} finally {
isFriendLoadingMore.value = false;
@@ -7030,12 +7037,15 @@ This will fail in production.`);
groupPageNumber.value = nextPage;
allmessages.value = [...olderMessages, ...allmessages.value];
await vue.nextTick();
scrollAnimationEnabled.value = false;
scrollToView.value = "msg-" + olderMessages.length;
await vue.nextTick();
scrollAnimationEnabled.value = true;
} else {
hasMoreGroupMessages.value = false;
}
} catch (e2) {
formatAppLog("error", "at pages/Chat/Chat.vue:1878", "加载更多群聊消息失败:", e2);
formatAppLog("error", "at pages/Chat/Chat.vue:1888", "加载更多群聊消息失败:", e2);
uni.showToast({ title: "加载更多失败", icon: "none" });
} finally {
isGroupLoadingMore.value = false;
@@ -7051,9 +7061,9 @@ This will fail in production.`);
}
};
vue.watch(() => friendSocketStore.MessageReceived, (newId) => {
formatAppLog("log", "at pages/Chat/Chat.vue:1899", "收到了好友消息");
formatAppLog("log", "at pages/Chat/Chat.vue:1909", "收到了好友消息");
if (newId) {
formatAppLog("log", "at pages/Chat/Chat.vue:1901", "ChatType:", ChatType.value);
formatAppLog("log", "at pages/Chat/Chat.vue:1911", "ChatType:", ChatType.value);
switch (ChatType.value) {
case 0:
takeConversationMessages();
@@ -7068,7 +7078,7 @@ This will fail in production.`);
friendSocketStore.MessageReceived = false;
break;
default:
formatAppLog("log", "at pages/Chat/Chat.vue:1917", "default 分支");
formatAppLog("log", "at pages/Chat/Chat.vue:1927", "default 分支");
friendSocketStore.MessageReceived = false;
break;
}
@@ -7162,7 +7172,7 @@ This will fail in production.`);
return downloadToastTimer;
}, set downloadToastTimer(v) {
downloadToastTimer = v;
}, showDownloadToast, hideDownloadToast, openLink, downloadAndHandle, sendMessage, sendFriendMessage, sendGroupMessage, sendAIMessage, stopConversation, textMessage, UserConversations, currentSessionId, userToken, UserId, UserAvatar, UserData, takeUserInfo, takeUserConversations, FriendInfoList, takeFriendList, takeTalkUserAvatar, takeUserAvatar, GroupList, takeGroupList, groupMemberList, takeGroupMemberAvatar, getGroupMemberAvatarById, allmessages, scrollToView, bottomToggle, isLoadingMore, isAILoadingMore, aiPageNumber, hasMoreAIMessages, currentPage, pageSize: pageSize$1, isFriendLoadingMore, friendPageNumber, hasMoreFriendMessages, isGroupLoadingMore, groupPageNumber, hasMoreGroupMessages, groupSize, currentMessages, takeConversationMessages, takeFriendMessages, takeGroupMessages, onScrollToUpper, loadMoreAIMessages, loadMoreFriendMessages, loadMoreGroupMessages, onScroll, scrollToBottom, computed: vue.computed, getCurrentInstance: vue.getCurrentInstance, nextTick: vue.nextTick, onMounted: vue.onMounted, ref: vue.ref, watch: vue.watch, get onLoad() {
}, showDownloadToast, hideDownloadToast, openLink, downloadAndHandle, sendMessage, sendFriendMessage, sendGroupMessage, sendAIMessage, stopConversation, textMessage, UserConversations, currentSessionId, userToken, UserId, UserAvatar, UserData, takeUserInfo, takeUserConversations, FriendInfoList, takeFriendList, takeTalkUserAvatar, takeUserAvatar, GroupList, takeGroupList, groupMemberList, takeGroupMemberAvatar, getGroupMemberAvatarById, allmessages, scrollToView, bottomToggle, scrollAnimationEnabled, isLoadingMore, isAILoadingMore, aiPageNumber, hasMoreAIMessages, currentPage, pageSize: pageSize$1, isFriendLoadingMore, friendPageNumber, hasMoreFriendMessages, isGroupLoadingMore, groupPageNumber, hasMoreGroupMessages, groupSize, currentMessages, takeConversationMessages, takeFriendMessages, takeGroupMessages, onScrollToUpper, loadMoreAIMessages, loadMoreFriendMessages, loadMoreGroupMessages, onScroll, scrollToBottom, computed: vue.computed, getCurrentInstance: vue.getCurrentInstance, nextTick: vue.nextTick, onMounted: vue.onMounted, ref: vue.ref, watch: vue.watch, get onLoad() {
return onLoad;
}, get onShow() {
return onShow;
@@ -7492,7 +7502,7 @@ This will fail in production.`);
"scroll-y": "",
"scroll-into-view": $setup.scrollToView,
"upper-threshold": 50,
"scroll-with-animation": !$setup.isThinking,
"scroll-with-animation": $setup.scrollAnimationEnabled && !$setup.isThinking,
onScroll: $setup.onScroll,
onScrolltoupper: $setup.onScrollToUpper
}, [

View File

@@ -1877,45 +1877,57 @@ to { opacity: 1; transform: translateY(0);
/* 气泡内容字体:确保 v-html 渲染的 markdown 内容使用系统字体栈 */
.chat-content {
font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans", "MiSans", "Source Han Sans CN", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif !important;
font-size: 16px !important;
font-weight: 600 !important;
line-height: 1.6;
margin: 0.25rem 0;
font-size: 0.9375rem !important;
line-height: 1.5rem !important;
margin: 0.25rem 0 !important;
/* 普通正文 */
/* 粗体和斜体样式 */
/* 气泡内的内联链接(替代 <a> 标签,点击由 JS 拦截处理) */
/* 可下载文件链接 → 按钮卡片样式 */
}
.chat-content h1 {
font-size: 1.3125rem;
line-height: 1.4;
margin: 0.5rem 0 0.3125rem;
font-size: 1.0625rem !important;
font-weight: 600 !important;
line-height: 1.75rem !important;
margin: 0.6875rem 0 0.4375rem !important;
}
.chat-content h2 {
font-size: 1.1875rem;
line-height: 1.4;
margin: 0.4375rem 0 0.25rem;
font-size: 1rem !important;
font-weight: 600 !important;
line-height: 1.625rem !important;
margin: 0.5625rem 0 0.3125rem !important;
}
.chat-content h3 {
font-size: 1.125rem;
line-height: 1.4;
margin: 0.375rem 0 0.25rem;
font-size: 0.9375rem !important;
font-weight: 600 !important;
line-height: 1.5rem !important;
margin: 0.4375rem 0 0.1875rem !important;
}
.chat-content h4 {
font-size: 0.875rem !important;
font-weight: 600 !important;
line-height: 1.5rem !important;
margin: 0.4375rem 0 0.1875rem !important;
}
.chat-content h5 {
font-size: 0.8125rem !important;
font-weight: 600 !important;
line-height: 1.375rem !important;
margin: 0.3125rem 0 0.125rem !important;
}
.chat-content h4,
.chat-content h5,
.chat-content h6 {
font-size: 1.0625rem;
line-height: 1.5;
margin: 0.3125rem 0 0.1875rem;
font-size: 0.75rem !important;
font-weight: 600 !important;
line-height: 1.25rem !important;
margin: 0.3125rem 0 0.125rem !important;
}
.chat-content p,
.chat-content uni-text,
.chat-content span {
font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans", "MiSans", "Source Han Sans CN", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif !important;
font-size: 1.1875rem !important;
font-weight: 400 !important;
line-height: 1.6;
margin: 0.25rem 0;
font-size: 0.9375rem !important;
line-height: 1.5rem !important;
margin: 0.25rem 0 !important;
}
.chat-content strong,
.chat-content b {