添加加载,优化气泡弹窗

This commit is contained in:
2026-07-25 18:10:16 +08:00
parent 48452cec2e
commit f240176563
4 changed files with 194 additions and 66 deletions

View File

@@ -163,7 +163,8 @@
'update:showNewChatModal',
'update:currentSessionId',
'refresh-conversations',
'update:chatType'
'update:chatType',
'select-chat'
])
const UserConversations = toRef(props, 'chatList')
@@ -262,6 +263,7 @@
}
uni.setStorageSync('currentSessionId', chatId)
emit('update:currentSessionId', chatId)
emit('select-chat')
}

View File

@@ -41,7 +41,8 @@
<view class="chat-sidebar" :class="{'sidebar-show' : isChatSidebar}">
<ChatSidebar :chatList="UserConversations" v-model:showNewChatModal="showNewChatModal"
v-model:currentSessionId="currentSessionId" v-model:chatType="ChatType"
@refresh-conversations="takeUserConversations">
@refresh-conversations="takeUserConversations"
@select-chat="isChatSidebar = false">
</ChatSidebar>
</view>
@@ -67,6 +68,17 @@
<view class="main-chat">
<scroll-view class="chat-messages" direction="vertical" scroll-y :scroll-into-view="scrollToView"
:upper-threshold="0" :scroll-with-animation="true" @scroll="onScroll">
<!-- 消息加载中弹窗仅会话变化时显示 -->
<view v-if="isLoadingMessages" class="messages-loading-overlay">
<view class="messages-loading-card">
<view class="bubble-loading-dots">
<view class="bubble-dot"></view>
<view class="bubble-dot"></view>
<view class="bubble-dot"></view>
</view>
<text class="messages-loading-text">加载中...</text>
</view>
</view>
<!-- 与AI的对话内容展示 -->
<template v-for="(message, index) in currentMessages" :key="index">
<view v-if="ChatType === 0 && message.role !== 'tool'" class="chat-message" :id="'msg-' + index"
@@ -718,12 +730,14 @@
const isThinking = ref(false)
const isSelfSent = ref(false) // 是否当前设备发起的 AI 对话(用于区分弹窗/仅锁输入)
const isUploading = ref(false)
const isLoadingMessages = ref(false) // 消息加载中状态(仅会话变化时显示)
const uploadedFiles = ref([])
const streamingMessageId = ref(null) // 流式消息的临时 ID用于实时更新 AI 回复
// 消息详情弹窗
const showMessageModal = ref(false)
const detailLinks = ref([])
// 点击气泡内容:拦截链接点击,否则 AI 对话弹出详情
const handleChatContentClick = (e, message) => {
// 在事件路径中向上查找 .chat-inline-link 元素
@@ -738,8 +752,17 @@
}
el = el.parentElement
}
// 非链接点击:仅 AI 对话弹出详情窗
if (message.role) {
// 检查消息内容是否包含链接
const hasLink = message.content && (
message.content.includes('http://') ||
message.content.includes('https://') ||
/<a\s+[^>]*href\s*=\s*['"][^'"]*['"]/i.test(message.content) ||
/\[[^\]]*\]\([^)]*\)/i.test(message.content) // 匹配 Markdown 链接格式
)
// 只有包含链接时才弹出详情窗
if (message.role && hasLink) {
showMessageDetail(message)
}
}
@@ -1347,6 +1370,8 @@
title: `获取ai会话内容失败${error}`,
icon: 'none'
})
} finally {
isLoadingMessages.value = false
}
}
const takeFriendMessages = async () => {
@@ -1360,6 +1385,8 @@
title: `获取好友会话消息失败${error}`,
icon: 'none'
})
} finally {
isLoadingMessages.value = false
}
}
const takeGroupMessages = async () => {
@@ -1382,6 +1409,8 @@
title: `获取群聊会话失败${error}`,
icon: 'none'
})
} finally {
isLoadingMessages.value = false
}
}
// // 加载更多消息
@@ -1443,9 +1472,14 @@
immediate: true
})
watch(currentSessionId, (newId) => {
watch(currentSessionId, async (newId, oldId) => {
if (newId) {
uni.setStorageSync('currentSessionId', currentSessionId.value)
// 会话变化时显示加载弹窗并清空消息
if (oldId && oldId !== newId) {
isLoadingMessages.value = true
allmessages.value = []
}
switch (ChatType.value) {
case 0:
takeConversationMessages();
@@ -1454,10 +1488,10 @@
handleConnect()
break;
case 1:
takeFriendMessages();
await takeFriendMessages();
break;
case 2:
takeGroupMessages();
await takeGroupMessages();
break;
default:
takeConversationMessages();
@@ -1488,6 +1522,7 @@
await takeUserConversations();
// 只有在会话ID存在时才获取消息
if (currentSessionId.value) {
isLoadingMessages.value = true
takeConversationMessages();
}
// AI 对话页面:主动建立 socket 连接,确保消息实时推送
@@ -1496,11 +1531,13 @@
}
} else if (chatType === 1) {
await takeFriendList()
takeFriendMessages();
isLoadingMessages.value = true
await takeFriendMessages();
handleFriendConnect()
} else if (chatType === 2) {
await takeGroupList()
await handleFriendConnect()
isLoadingMessages.value = true
await takeGroupMessages()
}
})
@@ -1626,6 +1663,36 @@
}
}
/* 消息加载中弹窗(仅会话变化时显示) */
.messages-loading-overlay {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
background: rgba(255, 255, 255, 0.9);
z-index: 100;
}
.messages-loading-card {
display: flex;
flex-direction: column;
align-items: center;
padding: 40rpx 60rpx;
background: #ffffff;
border-radius: 24rpx;
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.12);
}
.messages-loading-text {
margin-top: 20rpx;
font-size: 28rpx;
color: #999;
}
/* 消息详情弹窗 — 链接提取区域 */
.detail-links-section {
margin-top: 24rpx;

View File

@@ -2532,7 +2532,8 @@ if (uni.restoreGlobal) {
"update:showNewChatModal",
"update:currentSessionId",
"refresh-conversations",
"update:chatType"
"update:chatType",
"select-chat"
],
setup(__props, { expose: __expose, emit: __emit }) {
__expose();
@@ -2569,7 +2570,7 @@ if (uni.restoreGlobal) {
isSelectMode.value = false;
emit("refresh-conversations");
} catch (error) {
formatAppLog("error", "at components/ChatSidebar.vue:209", "删除会话失败:", error);
formatAppLog("error", "at components/ChatSidebar.vue:210", "删除会话失败:", error);
uni.showToast({
title: "删除失败,请重试",
icon: "none"
@@ -2598,7 +2599,7 @@ if (uni.restoreGlobal) {
uni.showToast({ title: "已删除全部对话", icon: "success" });
emit("refresh-conversations");
} catch (error) {
formatAppLog("error", "at components/ChatSidebar.vue:241", "清空全部对话失败:", error);
formatAppLog("error", "at components/ChatSidebar.vue:242", "清空全部对话失败:", error);
uni.showToast({ title: "删除失败,请重试", icon: "none" });
}
}
@@ -2610,15 +2611,16 @@ if (uni.restoreGlobal) {
});
const currentChatId = vue.toRef(props, "currentSessionId");
const selectChat = (chatId, receiverId = "") => {
formatAppLog("log", "at components/ChatSidebar.vue:259", "选择的id是", chatId);
formatAppLog("log", "at components/ChatSidebar.vue:260", "选择的id是", chatId);
if (receiverId) {
uni.setStorageSync("receiverId", receiverId);
}
uni.setStorageSync("currentSessionId", chatId);
emit("update:currentSessionId", chatId);
emit("select-chat");
};
const openNewChatModal = () => {
formatAppLog("log", "at components/ChatSidebar.vue:270", "点击了新建会话");
formatAppLog("log", "at components/ChatSidebar.vue:272", "点击了新建会话");
emit("update:showNewChatModal", true);
};
const goContactPages = () => {
@@ -2662,7 +2664,7 @@ if (uni.restoreGlobal) {
const UserInfo = await getUserInfo(UserToken.value);
UserAvatar.value = UserInfo.avatar || "";
UserName.value = UserInfo.username || "";
formatAppLog("log", "at components/ChatSidebar.vue:326", "菜单收到的会话列表:", UserConversations.value);
formatAppLog("log", "at components/ChatSidebar.vue:328", "菜单收到的会话列表:", UserConversations.value);
});
const __returned__ = { props, emit, UserConversations, showNewChatModal, chatType, openUserCardVisible, isSelectMode, selectedHistoryIds, deleteConversations, clearAllConversations, isAllHistorySelected, currentChatId, selectChat, openNewChatModal, goContactPages, chatHistoryQuery, isHistorySearchFocused, toggleSelectMode, toggleHistorySelect, toggleSelectAllHistory, UserToken, UserAvatar, UserName, truncateText, computed: vue.computed, onMounted: vue.onMounted, onUnmounted: vue.onUnmounted, ref: vue.ref, toRef: vue.toRef, get deleteConversation() {
return deleteConversation;
@@ -5637,7 +5639,7 @@ This will fail in production.`);
if (friendSocketStore.isConnected)
return;
if (!userToken.value || !UserId.value) {
formatAppLog("warn", "at pages/Chat/Chat.vue:334", "Token或UserId未准备好");
formatAppLog("warn", "at pages/Chat/Chat.vue:346", "Token或UserId未准备好");
return;
}
friendSocketStore.connect({
@@ -5723,7 +5725,7 @@ This will fail in production.`);
);
return html;
} catch (e2) {
formatAppLog("error", "at pages/Chat/Chat.vue:460", "解析失败", e2);
formatAppLog("error", "at pages/Chat/Chat.vue:472", "解析失败", e2);
return content;
}
};
@@ -5782,7 +5784,7 @@ This will fail in production.`);
files
};
} catch (e2) {
formatAppLog("error", "at pages/Chat/Chat.vue:537", "解析文件信息失败:", e2);
formatAppLog("error", "at pages/Chat/Chat.vue:549", "解析文件信息失败:", e2);
return {
textContent: content,
files: []
@@ -5819,7 +5821,7 @@ This will fail in production.`);
}
takeUserConversations();
} catch (error) {
formatAppLog("error", "at pages/Chat/Chat.vue:582", "新建普通会话失败:", error);
formatAppLog("error", "at pages/Chat/Chat.vue:594", "新建普通会话失败:", error);
uni.showToast({
title: "创建会话失败,请重试",
icon: "none"
@@ -5857,7 +5859,7 @@ This will fail in production.`);
};
const previewFileArray = vue.ref([]);
const uploadPhoto = () => {
formatAppLog("log", "at pages/Chat/Chat.vue:631", "点击了拍照上传");
formatAppLog("log", "at pages/Chat/Chat.vue:643", "点击了拍照上传");
uni.chooseImage({
count: 1,
sourceType: ["camera", "album"],
@@ -5880,7 +5882,7 @@ This will fail in production.`);
});
},
fail: (err) => {
formatAppLog("error", "at pages/Chat/Chat.vue:649", "选择图片失败", err);
formatAppLog("error", "at pages/Chat/Chat.vue:661", "选择图片失败", err);
}
});
};
@@ -5889,12 +5891,12 @@ This will fail in production.`);
};
const fileList = vue.ref([]);
const uploadFile = () => {
formatAppLog("log", "at pages/Chat/Chat.vue:660", "点击了上传文件");
formatAppLog("log", "at pages/Chat/Chat.vue:672", "点击了上传文件");
chooseFile({
count: 5,
type: "all",
success: (res) => {
formatAppLog("log", "at pages/Chat/Chat.vue:665", "成功了");
formatAppLog("log", "at pages/Chat/Chat.vue:677", "成功了");
fileList.value = res.tempFiles;
previewFileArray.value.push(...res.tempFiles);
uni.showToast({
@@ -5903,7 +5905,7 @@ This will fail in production.`);
});
},
fail: (err) => {
formatAppLog("error", "at pages/Chat/Chat.vue:676", "选择失败:", err);
formatAppLog("error", "at pages/Chat/Chat.vue:688", "选择失败:", err);
uni.showToast({
title: "选择失败",
icon: "error"
@@ -5937,6 +5939,7 @@ This will fail in production.`);
const isThinking = vue.ref(false);
const isSelfSent = vue.ref(false);
const isUploading = vue.ref(false);
const isLoadingMessages = vue.ref(false);
const uploadedFiles = vue.ref([]);
const streamingMessageId = vue.ref(null);
const showMessageModal = vue.ref(false);
@@ -5953,7 +5956,8 @@ This will fail in production.`);
}
el = el.parentElement;
}
if (message.role) {
const hasLink = message.content && (message.content.includes("http://") || message.content.includes("https://") || /<a\s+[^>]*href\s*=\s*['"][^'"]*['"]/i.test(message.content) || /\[[^\]]*\]\([^)]*\)/i.test(message.content));
if (message.role && hasLink) {
showMessageDetail(message);
}
};
@@ -6103,7 +6107,7 @@ This will fail in production.`);
previewFileArray.value = [];
} catch (err) {
uni.hideLoading();
formatAppLog("error", "at pages/Chat/Chat.vue:900", "文件上传失败:", err);
formatAppLog("error", "at pages/Chat/Chat.vue:923", "文件上传失败:", err);
uni.showToast({
title: "文件上传失败,请重试",
icon: "error"
@@ -6237,15 +6241,15 @@ This will fail in production.`);
}
};
const stopConversation = async () => {
formatAppLog("log", "at pages/Chat/Chat.vue:1069", "中断对话 - 当前会话ID:", currentSessionId.value);
formatAppLog("log", "at pages/Chat/Chat.vue:1092", "中断对话 - 当前会话ID:", currentSessionId.value);
try {
await socketStore.send({
type: "stop",
conversation_id: currentSessionId.value
});
formatAppLog("log", "at pages/Chat/Chat.vue:1075", "中断指令已发送成功");
formatAppLog("log", "at pages/Chat/Chat.vue:1098", "中断指令已发送成功");
} catch (err) {
formatAppLog("error", "at pages/Chat/Chat.vue:1077", "中断指令发送失败:", err);
formatAppLog("error", "at pages/Chat/Chat.vue:1100", "中断指令发送失败:", err);
}
if (streamingMessageId.value) {
allmessages.value = allmessages.value.filter((m) => m._id !== streamingMessageId.value);
@@ -6263,9 +6267,9 @@ This will fail in production.`);
});
};
vue.watch(() => socketStore.isThinking, (newVal, oldVal) => {
formatAppLog("log", "at pages/Chat/Chat.vue:1101", "isThinking 变化:", oldVal, "→", newVal, "messageString:", socketStore.messageString);
formatAppLog("log", "at pages/Chat/Chat.vue:1124", "isThinking 变化:", oldVal, "→", newVal, "messageString:", socketStore.messageString);
if (!oldVal && newVal) {
formatAppLog("log", "at pages/Chat/Chat.vue:1104", "AI开始回复跨设备同步锁定输入框");
formatAppLog("log", "at pages/Chat/Chat.vue:1127", "AI开始回复跨设备同步锁定输入框");
isThinking.value = true;
if (!streamingMessageId.value) {
streamingMessageId.value = "streaming-" + Date.now();
@@ -6279,7 +6283,7 @@ This will fail in production.`);
return;
}
if (oldVal && !newVal) {
formatAppLog("log", "at pages/Chat/Chat.vue:1120", "AI回复结束正常/中断),解锁并刷新消息列表");
formatAppLog("log", "at pages/Chat/Chat.vue:1143", "AI回复结束正常/中断),解锁并刷新消息列表");
if (streamingMessageId.value) {
allmessages.value = allmessages.value.filter((m) => m._id !== streamingMessageId.value);
streamingMessageId.value = null;
@@ -6331,15 +6335,15 @@ This will fail in production.`);
UserData.value = await getUserInfo(userToken.value);
UserId.value = UserData.value._id;
UserAvatar.value = UserData.value.avatar || "";
formatAppLog("log", "at pages/Chat/Chat.vue:1184", "用户信息已加载:", UserId.value, UserAvatar.value);
formatAppLog("log", "at pages/Chat/Chat.vue:1207", "用户信息已加载:", UserId.value, UserAvatar.value);
} catch (error) {
formatAppLog("error", "at pages/Chat/Chat.vue:1186", "获取用户信息失败:", error);
formatAppLog("error", "at pages/Chat/Chat.vue:1209", "获取用户信息失败:", error);
}
};
const takeUserConversations = async () => {
try {
userToken.value = getToken();
formatAppLog("log", "at pages/Chat/Chat.vue:1194", "token:", userToken.value);
formatAppLog("log", "at pages/Chat/Chat.vue:1217", "token:", userToken.value);
UserConversations.value = await getUserConversations(userToken.value) || [];
const savedSessionId = getCurrentSessionId();
if (savedSessionId && UserConversations.value.some((c) => c._id === savedSessionId)) {
@@ -6349,7 +6353,7 @@ This will fail in production.`);
} else {
currentSessionId.value = "";
}
formatAppLog("log", "at pages/Chat/Chat.vue:1206", "保存会话id", currentSessionId.value);
formatAppLog("log", "at pages/Chat/Chat.vue:1229", "保存会话id", currentSessionId.value);
uni.setStorageSync("currentSessionId", currentSessionId.value);
} catch (error) {
uni.showToast({
@@ -6361,17 +6365,17 @@ This will fail in production.`);
const FriendInfoList = vue.ref([]);
const takeFriendList = async () => {
try {
formatAppLog("log", "at pages/Chat/Chat.vue:1221", "开始获取好友列表");
formatAppLog("log", "at pages/Chat/Chat.vue:1244", "开始获取好友列表");
const friendList = await getChatFriend(UserId.value);
formatAppLog("log", "at pages/Chat/Chat.vue:1224", "friendList:", friendList);
formatAppLog("log", "at pages/Chat/Chat.vue:1247", "friendList:", friendList);
if (friendList && friendList.length) {
FriendInfoList.value = await takeUserAvatar(friendList);
} else {
FriendInfoList.value = [];
formatAppLog("log", "at pages/Chat/Chat.vue:1229", "好友列表为空");
formatAppLog("log", "at pages/Chat/Chat.vue:1252", "好友列表为空");
}
} catch (error) {
formatAppLog("error", "at pages/Chat/Chat.vue:1232", "获取好友列表失败:", error);
formatAppLog("error", "at pages/Chat/Chat.vue:1255", "获取好友列表失败:", error);
FriendInfoList.value = [];
} finally {
UserConversations.value = FriendInfoList.value;
@@ -6398,17 +6402,17 @@ This will fail in production.`);
};
});
} catch (err) {
formatAppLog("error", "at pages/Chat/Chat.vue:1262", "获取好友头像失败", err);
formatAppLog("error", "at pages/Chat/Chat.vue:1285", "获取好友头像失败", err);
return friendList;
}
};
const GroupList = vue.ref([]);
const takeGroupList = async () => {
try {
formatAppLog("log", "at pages/Chat/Chat.vue:1272", "开始获取群聊列表");
formatAppLog("log", "at pages/Chat/Chat.vue:1295", "开始获取群聊列表");
GroupList.value = await getGroup(UserId.value);
} catch (error) {
formatAppLog("error", "at pages/Chat/Chat.vue:1277", "获取群聊列表失败:", error);
formatAppLog("error", "at pages/Chat/Chat.vue:1300", "获取群聊列表失败:", error);
GroupList.value = [];
} finally {
UserConversations.value = GroupList.value;
@@ -6420,22 +6424,22 @@ This will fail in production.`);
return [];
try {
const memberIds = memberList.map((item) => item.groupContactId);
formatAppLog("log", "at pages/Chat/Chat.vue:1291", "请求头像的ID列表:", memberIds);
formatAppLog("log", "at pages/Chat/Chat.vue:1314", "请求头像的ID列表:", memberIds);
const memberAvatarList = await getUserAvatar(userToken.value, memberIds);
formatAppLog("log", "at pages/Chat/Chat.vue:1293", "头像接口返回数据:", memberAvatarList);
formatAppLog("log", "at pages/Chat/Chat.vue:1316", "头像接口返回数据:", memberAvatarList);
const userMap = new Map(memberAvatarList.map((user) => [user.user_id, user]) || []);
formatAppLog("log", "at pages/Chat/Chat.vue:1296", "userMap的keys:", Array.from(userMap.keys()));
formatAppLog("log", "at pages/Chat/Chat.vue:1319", "userMap的keys:", Array.from(userMap.keys()));
return memberList.map((member) => {
const memberId = member.groupContactId;
const userInfo = userMap.get(memberId);
formatAppLog("log", "at pages/Chat/Chat.vue:1301", `查找 ${memberId} 的头像:`, userInfo);
formatAppLog("log", "at pages/Chat/Chat.vue:1324", `查找 ${memberId} 的头像:`, userInfo);
return {
...member,
avatar: (userInfo == null ? void 0 : userInfo.avatar) || null
};
});
} catch (err) {
formatAppLog("error", "at pages/Chat/Chat.vue:1308", "获取群成员头像失败", err);
formatAppLog("error", "at pages/Chat/Chat.vue:1331", "获取群成员头像失败", err);
return memberList;
}
};
@@ -6462,6 +6466,8 @@ This will fail in production.`);
title: `获取ai会话内容失败${error}`,
icon: "none"
});
} finally {
isLoadingMessages.value = false;
}
};
const takeFriendMessages = async () => {
@@ -6473,17 +6479,19 @@ This will fail in production.`);
title: `获取好友会话消息失败${error}`,
icon: "none"
});
} finally {
isLoadingMessages.value = false;
}
};
const takeGroupMessages = async () => {
try {
allmessages.value = await getGroupMessages(currentSessionId.value) || [];
formatAppLog("log", "at pages/Chat/Chat.vue:1368", "群聊消息:", allmessages.value);
formatAppLog("log", "at pages/Chat/Chat.vue:1395", "群聊消息:", allmessages.value);
const memberList = await getGroupMemberList(currentSessionId.value);
formatAppLog("log", "at pages/Chat/Chat.vue:1371", "获取到的群成员列表:", memberList);
formatAppLog("log", "at pages/Chat/Chat.vue:1398", "获取到的群成员列表:", memberList);
if (memberList && memberList.length) {
groupMemberList.value = await takeGroupMemberAvatar(memberList);
formatAppLog("log", "at pages/Chat/Chat.vue:1374", "群成员列表(带头像):", groupMemberList.value);
formatAppLog("log", "at pages/Chat/Chat.vue:1401", "群成员列表(带头像):", groupMemberList.value);
} else {
groupMemberList.value = [];
}
@@ -6493,6 +6501,8 @@ This will fail in production.`);
title: `获取群聊会话失败${error}`,
icon: "none"
});
} finally {
isLoadingMessages.value = false;
}
};
const onScroll = (e2) => {
@@ -6505,9 +6515,9 @@ This will fail in production.`);
}
};
vue.watch(() => friendSocketStore.MessageReceived, (newId) => {
formatAppLog("log", "at pages/Chat/Chat.vue:1419", "收到了好友消息");
formatAppLog("log", "at pages/Chat/Chat.vue:1448", "收到了好友消息");
if (newId) {
formatAppLog("log", "at pages/Chat/Chat.vue:1421", "ChatType:", ChatType.value);
formatAppLog("log", "at pages/Chat/Chat.vue:1450", "ChatType:", ChatType.value);
switch (ChatType.value) {
case 0:
takeConversationMessages();
@@ -6522,7 +6532,7 @@ This will fail in production.`);
friendSocketStore.MessageReceived = false;
break;
default:
formatAppLog("log", "at pages/Chat/Chat.vue:1437", "default 分支");
formatAppLog("log", "at pages/Chat/Chat.vue:1466", "default 分支");
friendSocketStore.MessageReceived = false;
break;
}
@@ -6530,9 +6540,13 @@ This will fail in production.`);
}, {
immediate: true
});
vue.watch(currentSessionId, (newId) => {
vue.watch(currentSessionId, async (newId, oldId) => {
if (newId) {
uni.setStorageSync("currentSessionId", currentSessionId.value);
if (oldId && oldId !== newId) {
isLoadingMessages.value = true;
allmessages.value = [];
}
switch (ChatType.value) {
case 0:
takeConversationMessages();
@@ -6540,10 +6554,10 @@ This will fail in production.`);
handleConnect();
break;
case 1:
takeFriendMessages();
await takeFriendMessages();
break;
case 2:
takeGroupMessages();
await takeGroupMessages();
break;
default:
takeConversationMessages();
@@ -6566,6 +6580,7 @@ This will fail in production.`);
if (chatType === 0) {
await takeUserConversations();
if (currentSessionId.value) {
isLoadingMessages.value = true;
takeConversationMessages();
}
if (userToken.value && currentSessionId.value && !socketStore.isConnected) {
@@ -6573,18 +6588,20 @@ This will fail in production.`);
}
} else if (chatType === 1) {
await takeFriendList();
takeFriendMessages();
isLoadingMessages.value = true;
await takeFriendMessages();
handleFriendConnect();
} else if (chatType === 2) {
await takeGroupList();
await handleFriendConnect();
isLoadingMessages.value = true;
await takeGroupMessages();
}
});
onUnload(() => {
socketStore.disconnect();
});
const __returned__ = { friendSocketStore, handleFriendConnect, socketStore, ChatType, convertMarkdownTable, renderTable, escapeLoneUnderscores, pareseMarkdown, sanitizeContent, previewImage, openFile, formatFileSize, parseFileInfo, selectNormalChat, showNewChatModal, closeNewChatModal, isChatSidebar, handleChatSidebar, goWorkSpace, goCloudDatabase, logOut, previewFileArray, uploadPhoto, deleteImage, fileList, uploadFile, handleConnect, isThinking, isSelfSent, isUploading, uploadedFiles, streamingMessageId, showMessageModal, detailLinks, handleChatContentClick, extractLinks, extractFileNameFromUrl, showMessageDetail, closeMessageDetail, downloadToast, get downloadToastTimer() {
const __returned__ = { friendSocketStore, handleFriendConnect, socketStore, ChatType, convertMarkdownTable, renderTable, escapeLoneUnderscores, pareseMarkdown, sanitizeContent, previewImage, openFile, formatFileSize, parseFileInfo, selectNormalChat, showNewChatModal, closeNewChatModal, isChatSidebar, handleChatSidebar, goWorkSpace, goCloudDatabase, logOut, previewFileArray, uploadPhoto, deleteImage, fileList, uploadFile, handleConnect, isThinking, isSelfSent, isUploading, isLoadingMessages, uploadedFiles, streamingMessageId, showMessageModal, detailLinks, handleChatContentClick, extractLinks, extractFileNameFromUrl, showMessageDetail, closeMessageDetail, downloadToast, get downloadToastTimer() {
return downloadToastTimer;
}, set downloadToastTimer(v) {
downloadToastTimer = v;
@@ -6736,7 +6753,8 @@ This will fail in production.`);
"onUpdate:currentSessionId": _cache[2] || (_cache[2] = ($event) => $setup.currentSessionId = $event),
chatType: $setup.ChatType,
"onUpdate:chatType": _cache[3] || (_cache[3] = ($event) => $setup.ChatType = $event),
onRefreshConversations: $setup.takeUserConversations
onRefreshConversations: $setup.takeUserConversations,
onSelectChat: _cache[4] || (_cache[4] = ($event) => $setup.isChatSidebar = false)
}, null, 8, ["chatList", "showNewChatModal", "currentSessionId", "chatType"])
],
2
@@ -6781,6 +6799,19 @@ This will fail in production.`);
"scroll-with-animation": true,
onScroll: $setup.onScroll
}, [
$setup.isLoadingMessages ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "messages-loading-overlay"
}, [
vue.createElementVNode("view", { class: "messages-loading-card" }, [
vue.createElementVNode("view", { class: "bubble-loading-dots" }, [
vue.createElementVNode("view", { class: "bubble-dot" }),
vue.createElementVNode("view", { class: "bubble-dot" }),
vue.createElementVNode("view", { class: "bubble-dot" })
]),
vue.createElementVNode("text", { class: "messages-loading-text" }, "加载中...")
])
])) : vue.createCommentVNode("v-if", true),
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
@@ -6889,7 +6920,7 @@ This will fail in production.`);
)),
$setup.ChatType === 1 ? (vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
{ key: 0 },
{ key: 1 },
vue.renderList($setup.currentMessages, (message, index) => {
var _a;
return vue.openBlock(), vue.createElementBlock("view", {
@@ -6982,7 +7013,7 @@ This will fail in production.`);
)) : vue.createCommentVNode("v-if", true),
$setup.ChatType === 2 ? (vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
{ key: 1 },
{ key: 2 },
vue.renderList($setup.currentMessages, (message, index) => {
var _a;
return vue.openBlock(), vue.createElementBlock("view", {
@@ -7093,7 +7124,7 @@ This will fail in production.`);
"view",
{
class: vue.normalizeClass(["chat-interactive-btn", { disabled: $setup.isThinking }]),
onClick: _cache[4] || (_cache[4] = ($event) => !$setup.isThinking && $setup.uploadPhoto())
onClick: _cache[5] || (_cache[5] = ($event) => !$setup.isThinking && $setup.uploadPhoto())
},
"拍照上传",
2
@@ -7103,7 +7134,7 @@ This will fail in production.`);
"view",
{
class: vue.normalizeClass(["chat-interactive-btn", { disabled: $setup.isThinking }]),
onClick: _cache[5] || (_cache[5] = ($event) => !$setup.isThinking && $setup.uploadFile())
onClick: _cache[6] || (_cache[6] = ($event) => !$setup.isThinking && $setup.uploadFile())
},
"上传文件",
2
@@ -7151,7 +7182,7 @@ This will fail in production.`);
class: "message-input",
placeholder: $setup.isThinking ? $setup.isSelfSent ? "AI 正在回复中..." : "电脑正在运行,请稍后" : "输入消息...",
disabled: $setup.isThinking,
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => $setup.textMessage = $event),
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => $setup.textMessage = $event),
"auto-height": ""
}, null, 8, ["placeholder", "disabled"]), [
[vue.vModelText, $setup.textMessage]
@@ -7165,7 +7196,7 @@ This will fail in production.`);
])) : (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "input-btn-group send-message-btn",
onClick: _cache[7] || (_cache[7] = ($event) => $setup.sendMessage())
onClick: _cache[8] || (_cache[8] = ($event) => $setup.sendMessage())
}, [
vue.createElementVNode("view", { class: "iconfont icon-fasong" })
]))
@@ -7187,7 +7218,7 @@ This will fail in production.`);
}, [
vue.createElementVNode("view", {
class: "ncd-card message-detail-card",
onClick: _cache[8] || (_cache[8] = vue.withModifiers(() => {
onClick: _cache[9] || (_cache[9] = vue.withModifiers(() => {
}, ["stop"]))
}, [
vue.createElementVNode("view", { class: "ncd-header" }, [

View File

@@ -1742,6 +1742,34 @@ to { opacity: 1; transform: translateY(0);
transform: scale(1.1);
}
}
/* 消息加载中弹窗(仅会话变化时显示) */
.messages-loading-overlay {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
background: rgba(255, 255, 255, 0.9);
z-index: 100;
}
.messages-loading-card {
display: flex;
flex-direction: column;
align-items: center;
padding: 1.25rem 1.875rem;
background: #ffffff;
border-radius: 0.75rem;
box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.12);
}
.messages-loading-text {
margin-top: 0.625rem;
font-size: 0.875rem;
color: #999;
}
/* 消息详情弹窗 — 链接提取区域 */
.detail-links-section {
margin-top: 0.75rem;