取消<a>原生链接处理,统一在弹窗中点击下载;将消息详情弹窗中链接包装成文件名,并取消原文展示。
This commit is contained in:
@@ -87,7 +87,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="chat-content"
|
<view class="chat-content"
|
||||||
:class="{'chat-content-user':message.role==='user', 'chat-content-assistant':message.role==='assistant'}"
|
:class="{'chat-content-user':message.role==='user', 'chat-content-assistant':message.role==='assistant'}"
|
||||||
@click="showMessageDetail(message)"
|
@click="handleChatContentClick($event, message)"
|
||||||
v-if="(message.content && String(message.content).trim() !== '') || message._streaming">
|
v-if="(message.content && String(message.content).trim() !== '') || message._streaming">
|
||||||
<!-- 流式加载中:显示跳动的点 -->
|
<!-- 流式加载中:显示跳动的点 -->
|
||||||
<view
|
<view
|
||||||
@@ -134,7 +134,8 @@
|
|||||||
<!-- 没有头像时显示默认图标 -->
|
<!-- 没有头像时显示默认图标 -->
|
||||||
<view v-else class="iconfont icon-yonghuziliao"></view>
|
<view v-else class="iconfont icon-yonghuziliao"></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="chat-content" :class="{'chat-content-user':message.sender === UserId}">
|
<view class="chat-content" :class="{'chat-content-user':message.sender === UserId}"
|
||||||
|
@click="handleChatContentClick($event, message)">
|
||||||
<view v-if="message.content && String(message.content).trim() !== ''"
|
<view v-if="message.content && String(message.content).trim() !== ''"
|
||||||
v-html="pareseMarkdown(message.content)"></view>
|
v-html="pareseMarkdown(message.content)"></view>
|
||||||
<!-- 2. 图片 + 文件 渲染(核心新增) -->
|
<!-- 2. 图片 + 文件 渲染(核心新增) -->
|
||||||
@@ -172,7 +173,8 @@
|
|||||||
<!-- 没有头像时显示默认图标 -->
|
<!-- 没有头像时显示默认图标 -->
|
||||||
<view v-else class="iconfont icon-yonghuziliao"></view>
|
<view v-else class="iconfont icon-yonghuziliao"></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="chat-content" :class="{'chat-content-user':message.sender === UserId}">
|
<view class="chat-content" :class="{'chat-content-user':message.sender === UserId}"
|
||||||
|
@click="handleChatContentClick($event, message)">
|
||||||
<view v-if="message.message && String(message.message).trim() !== ''"
|
<view v-if="message.message && String(message.message).trim() !== ''"
|
||||||
v-html="pareseMarkdown(message.message)"></view>
|
v-html="pareseMarkdown(message.message)"></view>
|
||||||
<!-- 2. 图片 + 文件 渲染(核心新增) -->
|
<!-- 2. 图片 + 文件 渲染(核心新增) -->
|
||||||
@@ -240,13 +242,16 @@
|
|||||||
<uni-icons type="closeempty" color="#ff0000" size="24" @click="closeMessageDetail"></uni-icons>
|
<uni-icons type="closeempty" color="#ff0000" size="24" @click="closeMessageDetail"></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
<scroll-view class="message-detail-content" scroll-y>
|
<scroll-view class="message-detail-content" scroll-y>
|
||||||
<text>{{ detailMessageContent }}</text>
|
|
||||||
<view v-if="detailLinks.length" class="detail-links-section">
|
<view v-if="detailLinks.length" class="detail-links-section">
|
||||||
<view class="detail-links-title">链接 ({{ detailLinks.length }})</view>
|
<view class="detail-links-title">文件 ({{ detailLinks.length }})</view>
|
||||||
<view v-for="(link, i) in detailLinks" :key="i" class="detail-link-item" @click="openLink(link)">
|
<view v-for="(link, i) in detailLinks" :key="i" class="detail-link-item"
|
||||||
<text class="link-text">{{ link }}</text>
|
@click="openLink(link.url)">
|
||||||
|
<text class="link-text">{{ link.name }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view v-else class="detail-empty">
|
||||||
|
<text>无可下载文件</text>
|
||||||
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -439,7 +444,12 @@
|
|||||||
content = escapeLoneUnderscores(content)
|
content = escapeLoneUnderscores(content)
|
||||||
// 先转换表格,再用 snarkdown 处理其他 Markdown
|
// 先转换表格,再用 snarkdown 处理其他 Markdown
|
||||||
content = convertMarkdownTable(content)
|
content = convertMarkdownTable(content)
|
||||||
const html = snarkdown(content)
|
let html = snarkdown(content)
|
||||||
|
// 将 <a href="..."> 替换为自定义 span,避免 WebView 触发默认下载
|
||||||
|
html = html.replace(
|
||||||
|
/<a\s+href="([^"]*)"[^>]*>(.*?)<\/a>/gi,
|
||||||
|
'<span class="chat-inline-link" data-url="$1">$2</span>'
|
||||||
|
)
|
||||||
return html
|
return html
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('解析失败', e)
|
console.error('解析失败', e)
|
||||||
@@ -708,38 +718,117 @@
|
|||||||
|
|
||||||
// 消息详情弹窗
|
// 消息详情弹窗
|
||||||
const showMessageModal = ref(false)
|
const showMessageModal = ref(false)
|
||||||
const detailMessageContent = ref('')
|
|
||||||
const detailLinks = ref([])
|
const detailLinks = ref([])
|
||||||
|
// 点击气泡内容:拦截链接点击,否则 AI 对话弹出详情
|
||||||
|
const handleChatContentClick = (e, message) => {
|
||||||
|
// 在事件路径中向上查找 .chat-inline-link 元素
|
||||||
|
let el = e.target
|
||||||
|
while (el && el.classList) {
|
||||||
|
if (el.classList.contains('chat-inline-link')) {
|
||||||
|
const url = el.getAttribute('data-url') || (el.dataset && el.dataset.url)
|
||||||
|
if (url) {
|
||||||
|
openLink(url)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
el = el.parentElement
|
||||||
|
}
|
||||||
|
// 非链接点击:仅 AI 对话弹出详情窗
|
||||||
|
if (message.role) {
|
||||||
|
showMessageDetail(message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const extractLinks = (text) => {
|
const extractLinks = (text) => {
|
||||||
const regex = /https?:\/\/[^\s<>"{}|\\^`\[\]()]+/gi
|
const seen = new Set()
|
||||||
const matches = text.match(regex)
|
const result = []
|
||||||
return matches ? [...new Set(matches)] : []
|
// 1. 匹配 Markdown 链接 [文件名](url)
|
||||||
|
const mdLinkRegex = /\[([^\]]*)\]\((https?:\/\/[^\s<>"{}|\\^`\[\]()]+)\)/gi
|
||||||
|
const mdLinks = [...text.matchAll(mdLinkRegex)]
|
||||||
|
mdLinks.forEach(m => {
|
||||||
|
const name = m[1].trim()
|
||||||
|
const url = m[2]
|
||||||
|
if (!seen.has(url)) {
|
||||||
|
seen.add(url)
|
||||||
|
result.push({
|
||||||
|
url,
|
||||||
|
name: name || url
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// 2. 去除已匹配的 [xxx](url) 后,再搜裸 URL
|
||||||
|
let cleaned = text.replace(mdLinkRegex, '')
|
||||||
|
const bareRegex = /https?:\/\/[^\s<>"{}|\\^`\[\]()]+/gi
|
||||||
|
const bareMatches = cleaned.match(bareRegex)
|
||||||
|
if (bareMatches) {
|
||||||
|
bareMatches.forEach(url => {
|
||||||
|
if (!seen.has(url)) {
|
||||||
|
seen.add(url)
|
||||||
|
result.push({
|
||||||
|
url,
|
||||||
|
name: extractFileNameFromUrl(url)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
const extractFileNameFromUrl = (urlStr) => {
|
||||||
|
try {
|
||||||
|
const segments = new URL(urlStr).pathname.split('/').filter(s => s)
|
||||||
|
if (segments.length > 0) {
|
||||||
|
return decodeURIComponent(segments[segments.length - 1])
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
/* fallback */
|
||||||
|
}
|
||||||
|
const parts = urlStr.split('/').filter(s => s)
|
||||||
|
if (parts.length > 0) {
|
||||||
|
const last = parts[parts.length - 1]
|
||||||
|
const qIdx = last.indexOf('?')
|
||||||
|
return qIdx > -1 ? last.substring(0, qIdx) : last
|
||||||
|
}
|
||||||
|
return urlStr
|
||||||
}
|
}
|
||||||
const showMessageDetail = (message) => {
|
const showMessageDetail = (message) => {
|
||||||
detailMessageContent.value = message.content || ''
|
detailLinks.value = extractLinks(message.content || '')
|
||||||
detailLinks.value = extractLinks(detailMessageContent.value)
|
|
||||||
showMessageModal.value = true
|
showMessageModal.value = true
|
||||||
}
|
}
|
||||||
const closeMessageDetail = () => {
|
const closeMessageDetail = () => {
|
||||||
showMessageModal.value = false
|
showMessageModal.value = false
|
||||||
detailMessageContent.value = ''
|
|
||||||
detailLinks.value = []
|
detailLinks.value = []
|
||||||
}
|
}
|
||||||
const downloadToast = ref({ show: false, type: 'loading', message: '' })
|
const downloadToast = ref({
|
||||||
|
show: false,
|
||||||
|
type: 'loading',
|
||||||
|
message: ''
|
||||||
|
})
|
||||||
let downloadToastTimer = null
|
let downloadToastTimer = null
|
||||||
|
|
||||||
const showDownloadToast = (type, message, duration) => {
|
const showDownloadToast = (type, message, duration) => {
|
||||||
if (downloadToastTimer) clearTimeout(downloadToastTimer)
|
if (downloadToastTimer) clearTimeout(downloadToastTimer)
|
||||||
downloadToast.value = { show: true, type, message }
|
downloadToast.value = {
|
||||||
|
show: true,
|
||||||
|
type,
|
||||||
|
message
|
||||||
|
}
|
||||||
if (duration > 0) {
|
if (duration > 0) {
|
||||||
downloadToastTimer = setTimeout(() => {
|
downloadToastTimer = setTimeout(() => {
|
||||||
downloadToast.value = { show: false, type: 'loading', message: '' }
|
downloadToast.value = {
|
||||||
|
show: false,
|
||||||
|
type: 'loading',
|
||||||
|
message: ''
|
||||||
|
}
|
||||||
}, duration)
|
}, duration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const hideDownloadToast = () => {
|
const hideDownloadToast = () => {
|
||||||
if (downloadToastTimer) clearTimeout(downloadToastTimer)
|
if (downloadToastTimer) clearTimeout(downloadToastTimer)
|
||||||
downloadToast.value = { show: false, type: 'loading', message: '' }
|
downloadToast.value = {
|
||||||
|
show: false,
|
||||||
|
type: 'loading',
|
||||||
|
message: ''
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const openLink = (url) => {
|
const openLink = (url) => {
|
||||||
@@ -1458,6 +1547,13 @@
|
|||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
margin: 8rpx 0;
|
margin: 8rpx 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 气泡内的内联链接(替代 <a> 标签,点击由 JS 拦截处理) */
|
||||||
|
.chat-inline-link {
|
||||||
|
color: #3b86ff !important;
|
||||||
|
text-decoration: underline;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 流式气泡中的加载动画 */
|
/* 流式气泡中的加载动画 */
|
||||||
@@ -1526,6 +1622,15 @@
|
|||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.detail-empty {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 40rpx 0;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
/* ========== 自定义下载 Toast(层级高于 ncd-overlay 的 9999)========== */
|
/* ========== 自定义下载 Toast(层级高于 ncd-overlay 的 9999)========== */
|
||||||
.download-toast-overlay {
|
.download-toast-overlay {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@@ -1554,8 +1659,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes toastFadeIn {
|
@keyframes toastFadeIn {
|
||||||
from { opacity: 0; transform: scale(0.85); }
|
from {
|
||||||
to { opacity: 1; transform: scale(1); }
|
opacity: 0;
|
||||||
|
transform: scale(0.85);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.download-toast-loading {
|
.download-toast-loading {
|
||||||
@@ -1590,12 +1702,26 @@
|
|||||||
animation: toastDotBlink 1.2s infinite ease-in-out;
|
animation: toastDotBlink 1.2s infinite ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toast-dot:nth-child(2) { animation-delay: 0.3s; }
|
.toast-dot:nth-child(2) {
|
||||||
.toast-dot:nth-child(3) { animation-delay: 0.6s; }
|
animation-delay: 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toast-dot:nth-child(3) {
|
||||||
|
animation-delay: 0.6s;
|
||||||
|
}
|
||||||
|
|
||||||
@keyframes toastDotBlink {
|
@keyframes toastDotBlink {
|
||||||
0%, 100% { opacity: 0.3; transform: scale(0.75); }
|
|
||||||
50% { opacity: 1; transform: scale(1.2); }
|
0%,
|
||||||
|
100% {
|
||||||
|
opacity: 0.3;
|
||||||
|
transform: scale(0.75);
|
||||||
|
}
|
||||||
|
|
||||||
|
50% {
|
||||||
|
opacity: 1;
|
||||||
|
transform: scale(1.2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.download-toast-text {
|
.download-toast-text {
|
||||||
@@ -1603,6 +1729,4 @@
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
422
unpackage/dist/dev/app-plus/app-service.js
vendored
422
unpackage/dist/dev/app-plus/app-service.js
vendored
@@ -5631,7 +5631,7 @@ This will fail in production.`);
|
|||||||
if (friendSocketStore.isConnected)
|
if (friendSocketStore.isConnected)
|
||||||
return;
|
return;
|
||||||
if (!userToken.value || !UserId.value) {
|
if (!userToken.value || !UserId.value) {
|
||||||
formatAppLog("warn", "at pages/Chat/Chat.vue:329", "Token或UserId未准备好");
|
formatAppLog("warn", "at pages/Chat/Chat.vue:334", "Token或UserId未准备好");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
friendSocketStore.connect({
|
friendSocketStore.connect({
|
||||||
@@ -5707,10 +5707,14 @@ This will fail in production.`);
|
|||||||
try {
|
try {
|
||||||
content = escapeLoneUnderscores(content);
|
content = escapeLoneUnderscores(content);
|
||||||
content = convertMarkdownTable(content);
|
content = convertMarkdownTable(content);
|
||||||
const html = t(content);
|
let html = t(content);
|
||||||
|
html = html.replace(
|
||||||
|
/<a\s+href="([^"]*)"[^>]*>(.*?)<\/a>/gi,
|
||||||
|
'<span class="chat-inline-link" data-url="$1">$2</span>'
|
||||||
|
);
|
||||||
return html;
|
return html;
|
||||||
} catch (e2) {
|
} catch (e2) {
|
||||||
formatAppLog("error", "at pages/Chat/Chat.vue:445", "解析失败", e2);
|
formatAppLog("error", "at pages/Chat/Chat.vue:455", "解析失败", e2);
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -5769,7 +5773,7 @@ This will fail in production.`);
|
|||||||
files
|
files
|
||||||
};
|
};
|
||||||
} catch (e2) {
|
} catch (e2) {
|
||||||
formatAppLog("error", "at pages/Chat/Chat.vue:522", "解析文件信息失败:", e2);
|
formatAppLog("error", "at pages/Chat/Chat.vue:532", "解析文件信息失败:", e2);
|
||||||
return {
|
return {
|
||||||
textContent: content,
|
textContent: content,
|
||||||
files: []
|
files: []
|
||||||
@@ -5806,7 +5810,7 @@ This will fail in production.`);
|
|||||||
}
|
}
|
||||||
takeUserConversations();
|
takeUserConversations();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
formatAppLog("error", "at pages/Chat/Chat.vue:567", "新建普通会话失败:", error);
|
formatAppLog("error", "at pages/Chat/Chat.vue:577", "新建普通会话失败:", error);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "创建会话失败,请重试",
|
title: "创建会话失败,请重试",
|
||||||
icon: "none"
|
icon: "none"
|
||||||
@@ -5844,7 +5848,7 @@ This will fail in production.`);
|
|||||||
};
|
};
|
||||||
const previewFileArray = vue.ref([]);
|
const previewFileArray = vue.ref([]);
|
||||||
const uploadPhoto = () => {
|
const uploadPhoto = () => {
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:616", "点击了拍照上传");
|
formatAppLog("log", "at pages/Chat/Chat.vue:626", "点击了拍照上传");
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1,
|
count: 1,
|
||||||
sourceType: ["camera", "album"],
|
sourceType: ["camera", "album"],
|
||||||
@@ -5867,7 +5871,7 @@ This will fail in production.`);
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
formatAppLog("error", "at pages/Chat/Chat.vue:634", "选择图片失败", err);
|
formatAppLog("error", "at pages/Chat/Chat.vue:644", "选择图片失败", err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -5876,12 +5880,12 @@ This will fail in production.`);
|
|||||||
};
|
};
|
||||||
const fileList = vue.ref([]);
|
const fileList = vue.ref([]);
|
||||||
const uploadFile = () => {
|
const uploadFile = () => {
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:645", "点击了上传文件");
|
formatAppLog("log", "at pages/Chat/Chat.vue:655", "点击了上传文件");
|
||||||
chooseFile({
|
chooseFile({
|
||||||
count: 5,
|
count: 5,
|
||||||
type: "all",
|
type: "all",
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:650", "成功了");
|
formatAppLog("log", "at pages/Chat/Chat.vue:660", "成功了");
|
||||||
fileList.value = res.tempFiles;
|
fileList.value = res.tempFiles;
|
||||||
previewFileArray.value.push(...res.tempFiles);
|
previewFileArray.value.push(...res.tempFiles);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -5890,7 +5894,7 @@ This will fail in production.`);
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
formatAppLog("error", "at pages/Chat/Chat.vue:661", "选择失败:", err);
|
formatAppLog("error", "at pages/Chat/Chat.vue:671", "选择失败:", err);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "选择失败",
|
title: "选择失败",
|
||||||
icon: "error"
|
icon: "error"
|
||||||
@@ -5927,39 +5931,111 @@ This will fail in production.`);
|
|||||||
const uploadedFiles = vue.ref([]);
|
const uploadedFiles = vue.ref([]);
|
||||||
const streamingMessageId = vue.ref(null);
|
const streamingMessageId = vue.ref(null);
|
||||||
const showMessageModal = vue.ref(false);
|
const showMessageModal = vue.ref(false);
|
||||||
const detailMessageContent = vue.ref("");
|
|
||||||
const detailLinks = vue.ref([]);
|
const detailLinks = vue.ref([]);
|
||||||
|
const handleChatContentClick = (e2, message) => {
|
||||||
|
let el = e2.target;
|
||||||
|
while (el && el.classList) {
|
||||||
|
if (el.classList.contains("chat-inline-link")) {
|
||||||
|
const url = el.getAttribute("data-url") || el.dataset && el.dataset.url;
|
||||||
|
if (url) {
|
||||||
|
openLink(url);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
el = el.parentElement;
|
||||||
|
}
|
||||||
|
if (message.role) {
|
||||||
|
showMessageDetail(message);
|
||||||
|
}
|
||||||
|
};
|
||||||
const extractLinks = (text) => {
|
const extractLinks = (text) => {
|
||||||
const regex = /https?:\/\/[^\s<>"{}|\\^`\[\]()]+/gi;
|
const seen = /* @__PURE__ */ new Set();
|
||||||
const matches = text.match(regex);
|
const result = [];
|
||||||
return matches ? [...new Set(matches)] : [];
|
const mdLinkRegex = /\[([^\]]*)\]\((https?:\/\/[^\s<>"{}|\\^`\[\]()]+)\)/gi;
|
||||||
|
const mdLinks = [...text.matchAll(mdLinkRegex)];
|
||||||
|
mdLinks.forEach((m) => {
|
||||||
|
const name2 = m[1].trim();
|
||||||
|
const url = m[2];
|
||||||
|
if (!seen.has(url)) {
|
||||||
|
seen.add(url);
|
||||||
|
result.push({
|
||||||
|
url,
|
||||||
|
name: name2 || url
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
let cleaned = text.replace(mdLinkRegex, "");
|
||||||
|
const bareRegex = /https?:\/\/[^\s<>"{}|\\^`\[\]()]+/gi;
|
||||||
|
const bareMatches = cleaned.match(bareRegex);
|
||||||
|
if (bareMatches) {
|
||||||
|
bareMatches.forEach((url) => {
|
||||||
|
if (!seen.has(url)) {
|
||||||
|
seen.add(url);
|
||||||
|
result.push({
|
||||||
|
url,
|
||||||
|
name: extractFileNameFromUrl(url)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
const extractFileNameFromUrl = (urlStr) => {
|
||||||
|
try {
|
||||||
|
const segments = new URL(urlStr).pathname.split("/").filter((s) => s);
|
||||||
|
if (segments.length > 0) {
|
||||||
|
return decodeURIComponent(segments[segments.length - 1]);
|
||||||
|
}
|
||||||
|
} catch (e2) {
|
||||||
|
}
|
||||||
|
const parts = urlStr.split("/").filter((s) => s);
|
||||||
|
if (parts.length > 0) {
|
||||||
|
const last = parts[parts.length - 1];
|
||||||
|
const qIdx = last.indexOf("?");
|
||||||
|
return qIdx > -1 ? last.substring(0, qIdx) : last;
|
||||||
|
}
|
||||||
|
return urlStr;
|
||||||
};
|
};
|
||||||
const showMessageDetail = (message) => {
|
const showMessageDetail = (message) => {
|
||||||
detailMessageContent.value = message.content || "";
|
detailLinks.value = extractLinks(message.content || "");
|
||||||
detailLinks.value = extractLinks(detailMessageContent.value);
|
|
||||||
showMessageModal.value = true;
|
showMessageModal.value = true;
|
||||||
};
|
};
|
||||||
const closeMessageDetail = () => {
|
const closeMessageDetail = () => {
|
||||||
showMessageModal.value = false;
|
showMessageModal.value = false;
|
||||||
detailMessageContent.value = "";
|
|
||||||
detailLinks.value = [];
|
detailLinks.value = [];
|
||||||
};
|
};
|
||||||
const downloadToast = vue.ref({ show: false, type: "loading", message: "" });
|
const downloadToast = vue.ref({
|
||||||
|
show: false,
|
||||||
|
type: "loading",
|
||||||
|
message: ""
|
||||||
|
});
|
||||||
let downloadToastTimer = null;
|
let downloadToastTimer = null;
|
||||||
const showDownloadToast = (type, message, duration) => {
|
const showDownloadToast = (type, message, duration) => {
|
||||||
if (downloadToastTimer)
|
if (downloadToastTimer)
|
||||||
clearTimeout(downloadToastTimer);
|
clearTimeout(downloadToastTimer);
|
||||||
downloadToast.value = { show: true, type, message };
|
downloadToast.value = {
|
||||||
|
show: true,
|
||||||
|
type,
|
||||||
|
message
|
||||||
|
};
|
||||||
if (duration > 0) {
|
if (duration > 0) {
|
||||||
downloadToastTimer = setTimeout(() => {
|
downloadToastTimer = setTimeout(() => {
|
||||||
downloadToast.value = { show: false, type: "loading", message: "" };
|
downloadToast.value = {
|
||||||
|
show: false,
|
||||||
|
type: "loading",
|
||||||
|
message: ""
|
||||||
|
};
|
||||||
}, duration);
|
}, duration);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const hideDownloadToast = () => {
|
const hideDownloadToast = () => {
|
||||||
if (downloadToastTimer)
|
if (downloadToastTimer)
|
||||||
clearTimeout(downloadToastTimer);
|
clearTimeout(downloadToastTimer);
|
||||||
downloadToast.value = { show: false, type: "loading", message: "" };
|
downloadToast.value = {
|
||||||
|
show: false,
|
||||||
|
type: "loading",
|
||||||
|
message: ""
|
||||||
|
};
|
||||||
};
|
};
|
||||||
const openLink = (url) => {
|
const openLink = (url) => {
|
||||||
downloadAndHandle(url);
|
downloadAndHandle(url);
|
||||||
@@ -6018,7 +6094,7 @@ This will fail in production.`);
|
|||||||
previewFileArray.value = [];
|
previewFileArray.value = [];
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
formatAppLog("error", "at pages/Chat/Chat.vue:806", "文件上传失败:", err);
|
formatAppLog("error", "at pages/Chat/Chat.vue:895", "文件上传失败:", err);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "文件上传失败,请重试",
|
title: "文件上传失败,请重试",
|
||||||
icon: "error"
|
icon: "error"
|
||||||
@@ -6152,15 +6228,15 @@ This will fail in production.`);
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const stopConversation = async () => {
|
const stopConversation = async () => {
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:975", "中断对话 - 当前会话ID:", currentSessionId.value);
|
formatAppLog("log", "at pages/Chat/Chat.vue:1064", "中断对话 - 当前会话ID:", currentSessionId.value);
|
||||||
try {
|
try {
|
||||||
await socketStore.send({
|
await socketStore.send({
|
||||||
type: "stop",
|
type: "stop",
|
||||||
conversation_id: currentSessionId.value
|
conversation_id: currentSessionId.value
|
||||||
});
|
});
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:981", "中断指令已发送成功");
|
formatAppLog("log", "at pages/Chat/Chat.vue:1070", "中断指令已发送成功");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
formatAppLog("error", "at pages/Chat/Chat.vue:983", "中断指令发送失败:", err);
|
formatAppLog("error", "at pages/Chat/Chat.vue:1072", "中断指令发送失败:", err);
|
||||||
}
|
}
|
||||||
if (streamingMessageId.value) {
|
if (streamingMessageId.value) {
|
||||||
allmessages.value = allmessages.value.filter((m) => m._id !== streamingMessageId.value);
|
allmessages.value = allmessages.value.filter((m) => m._id !== streamingMessageId.value);
|
||||||
@@ -6178,9 +6254,9 @@ This will fail in production.`);
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
vue.watch(() => socketStore.isThinking, (newVal, oldVal) => {
|
vue.watch(() => socketStore.isThinking, (newVal, oldVal) => {
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:1007", "isThinking 变化:", oldVal, "→", newVal, "messageString:", socketStore.messageString);
|
formatAppLog("log", "at pages/Chat/Chat.vue:1096", "isThinking 变化:", oldVal, "→", newVal, "messageString:", socketStore.messageString);
|
||||||
if (!oldVal && newVal) {
|
if (!oldVal && newVal) {
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:1010", "AI开始回复(跨设备同步),锁定输入框");
|
formatAppLog("log", "at pages/Chat/Chat.vue:1099", "AI开始回复(跨设备同步),锁定输入框");
|
||||||
isThinking.value = true;
|
isThinking.value = true;
|
||||||
if (!streamingMessageId.value) {
|
if (!streamingMessageId.value) {
|
||||||
streamingMessageId.value = "streaming-" + Date.now();
|
streamingMessageId.value = "streaming-" + Date.now();
|
||||||
@@ -6194,7 +6270,7 @@ This will fail in production.`);
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (oldVal && !newVal) {
|
if (oldVal && !newVal) {
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:1026", "AI回复结束(正常/中断),解锁并刷新消息列表");
|
formatAppLog("log", "at pages/Chat/Chat.vue:1115", "AI回复结束(正常/中断),解锁并刷新消息列表");
|
||||||
if (streamingMessageId.value) {
|
if (streamingMessageId.value) {
|
||||||
allmessages.value = allmessages.value.filter((m) => m._id !== streamingMessageId.value);
|
allmessages.value = allmessages.value.filter((m) => m._id !== streamingMessageId.value);
|
||||||
streamingMessageId.value = null;
|
streamingMessageId.value = null;
|
||||||
@@ -6246,15 +6322,15 @@ This will fail in production.`);
|
|||||||
UserData.value = await getUserInfo(userToken.value);
|
UserData.value = await getUserInfo(userToken.value);
|
||||||
UserId.value = UserData.value._id;
|
UserId.value = UserData.value._id;
|
||||||
UserAvatar.value = UserData.value.avatar || "";
|
UserAvatar.value = UserData.value.avatar || "";
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:1090", "用户信息已加载:", UserId.value, UserAvatar.value);
|
formatAppLog("log", "at pages/Chat/Chat.vue:1179", "用户信息已加载:", UserId.value, UserAvatar.value);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
formatAppLog("error", "at pages/Chat/Chat.vue:1092", "获取用户信息失败:", error);
|
formatAppLog("error", "at pages/Chat/Chat.vue:1181", "获取用户信息失败:", error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const takeUserConversations = async () => {
|
const takeUserConversations = async () => {
|
||||||
try {
|
try {
|
||||||
userToken.value = getToken();
|
userToken.value = getToken();
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:1100", "token:", userToken.value);
|
formatAppLog("log", "at pages/Chat/Chat.vue:1189", "token:", userToken.value);
|
||||||
UserConversations.value = await getUserConversations(userToken.value) || [];
|
UserConversations.value = await getUserConversations(userToken.value) || [];
|
||||||
const savedSessionId = getCurrentSessionId();
|
const savedSessionId = getCurrentSessionId();
|
||||||
if (savedSessionId && UserConversations.value.some((c) => c._id === savedSessionId)) {
|
if (savedSessionId && UserConversations.value.some((c) => c._id === savedSessionId)) {
|
||||||
@@ -6264,7 +6340,7 @@ This will fail in production.`);
|
|||||||
} else {
|
} else {
|
||||||
currentSessionId.value = "";
|
currentSessionId.value = "";
|
||||||
}
|
}
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:1112", "保存会话id:", currentSessionId.value);
|
formatAppLog("log", "at pages/Chat/Chat.vue:1201", "保存会话id:", currentSessionId.value);
|
||||||
uni.setStorageSync("currentSessionId", currentSessionId.value);
|
uni.setStorageSync("currentSessionId", currentSessionId.value);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -6276,17 +6352,17 @@ This will fail in production.`);
|
|||||||
const FriendInfoList = vue.ref([]);
|
const FriendInfoList = vue.ref([]);
|
||||||
const takeFriendList = async () => {
|
const takeFriendList = async () => {
|
||||||
try {
|
try {
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:1127", "开始获取好友列表");
|
formatAppLog("log", "at pages/Chat/Chat.vue:1216", "开始获取好友列表");
|
||||||
const friendList = await getChatFriend(UserId.value);
|
const friendList = await getChatFriend(UserId.value);
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:1130", "friendList:", friendList);
|
formatAppLog("log", "at pages/Chat/Chat.vue:1219", "friendList:", friendList);
|
||||||
if (friendList && friendList.length) {
|
if (friendList && friendList.length) {
|
||||||
FriendInfoList.value = await takeUserAvatar(friendList);
|
FriendInfoList.value = await takeUserAvatar(friendList);
|
||||||
} else {
|
} else {
|
||||||
FriendInfoList.value = [];
|
FriendInfoList.value = [];
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:1135", "好友列表为空");
|
formatAppLog("log", "at pages/Chat/Chat.vue:1224", "好友列表为空");
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
formatAppLog("error", "at pages/Chat/Chat.vue:1138", "获取好友列表失败:", error);
|
formatAppLog("error", "at pages/Chat/Chat.vue:1227", "获取好友列表失败:", error);
|
||||||
FriendInfoList.value = [];
|
FriendInfoList.value = [];
|
||||||
} finally {
|
} finally {
|
||||||
UserConversations.value = FriendInfoList.value;
|
UserConversations.value = FriendInfoList.value;
|
||||||
@@ -6313,17 +6389,17 @@ This will fail in production.`);
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
formatAppLog("error", "at pages/Chat/Chat.vue:1168", "获取好友头像失败", err);
|
formatAppLog("error", "at pages/Chat/Chat.vue:1257", "获取好友头像失败", err);
|
||||||
return friendList;
|
return friendList;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const GroupList = vue.ref([]);
|
const GroupList = vue.ref([]);
|
||||||
const takeGroupList = async () => {
|
const takeGroupList = async () => {
|
||||||
try {
|
try {
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:1178", "开始获取群聊列表");
|
formatAppLog("log", "at pages/Chat/Chat.vue:1267", "开始获取群聊列表");
|
||||||
GroupList.value = await getGroup(UserId.value);
|
GroupList.value = await getGroup(UserId.value);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
formatAppLog("error", "at pages/Chat/Chat.vue:1183", "获取群聊列表失败:", error);
|
formatAppLog("error", "at pages/Chat/Chat.vue:1272", "获取群聊列表失败:", error);
|
||||||
GroupList.value = [];
|
GroupList.value = [];
|
||||||
} finally {
|
} finally {
|
||||||
UserConversations.value = GroupList.value;
|
UserConversations.value = GroupList.value;
|
||||||
@@ -6335,22 +6411,22 @@ This will fail in production.`);
|
|||||||
return [];
|
return [];
|
||||||
try {
|
try {
|
||||||
const memberIds = memberList.map((item) => item.groupContactId);
|
const memberIds = memberList.map((item) => item.groupContactId);
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:1197", "请求头像的ID列表:", memberIds);
|
formatAppLog("log", "at pages/Chat/Chat.vue:1286", "请求头像的ID列表:", memberIds);
|
||||||
const memberAvatarList = await getUserAvatar(userToken.value, memberIds);
|
const memberAvatarList = await getUserAvatar(userToken.value, memberIds);
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:1199", "头像接口返回数据:", memberAvatarList);
|
formatAppLog("log", "at pages/Chat/Chat.vue:1288", "头像接口返回数据:", memberAvatarList);
|
||||||
const userMap = new Map(memberAvatarList.map((user) => [user.user_id, user]) || []);
|
const userMap = new Map(memberAvatarList.map((user) => [user.user_id, user]) || []);
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:1202", "userMap的keys:", Array.from(userMap.keys()));
|
formatAppLog("log", "at pages/Chat/Chat.vue:1291", "userMap的keys:", Array.from(userMap.keys()));
|
||||||
return memberList.map((member) => {
|
return memberList.map((member) => {
|
||||||
const memberId = member.groupContactId;
|
const memberId = member.groupContactId;
|
||||||
const userInfo = userMap.get(memberId);
|
const userInfo = userMap.get(memberId);
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:1207", `查找 ${memberId} 的头像:`, userInfo);
|
formatAppLog("log", "at pages/Chat/Chat.vue:1296", `查找 ${memberId} 的头像:`, userInfo);
|
||||||
return {
|
return {
|
||||||
...member,
|
...member,
|
||||||
avatar: (userInfo == null ? void 0 : userInfo.avatar) || null
|
avatar: (userInfo == null ? void 0 : userInfo.avatar) || null
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
formatAppLog("error", "at pages/Chat/Chat.vue:1214", "获取群成员头像失败", err);
|
formatAppLog("error", "at pages/Chat/Chat.vue:1303", "获取群成员头像失败", err);
|
||||||
return memberList;
|
return memberList;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -6393,12 +6469,12 @@ This will fail in production.`);
|
|||||||
const takeGroupMessages = async () => {
|
const takeGroupMessages = async () => {
|
||||||
try {
|
try {
|
||||||
allmessages.value = await getGroupMessages(currentSessionId.value) || [];
|
allmessages.value = await getGroupMessages(currentSessionId.value) || [];
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:1274", "群聊消息:", allmessages.value);
|
formatAppLog("log", "at pages/Chat/Chat.vue:1363", "群聊消息:", allmessages.value);
|
||||||
const memberList = await getGroupMemberList(currentSessionId.value);
|
const memberList = await getGroupMemberList(currentSessionId.value);
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:1277", "获取到的群成员列表:", memberList);
|
formatAppLog("log", "at pages/Chat/Chat.vue:1366", "获取到的群成员列表:", memberList);
|
||||||
if (memberList && memberList.length) {
|
if (memberList && memberList.length) {
|
||||||
groupMemberList.value = await takeGroupMemberAvatar(memberList);
|
groupMemberList.value = await takeGroupMemberAvatar(memberList);
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:1280", "群成员列表(带头像):", groupMemberList.value);
|
formatAppLog("log", "at pages/Chat/Chat.vue:1369", "群成员列表(带头像):", groupMemberList.value);
|
||||||
} else {
|
} else {
|
||||||
groupMemberList.value = [];
|
groupMemberList.value = [];
|
||||||
}
|
}
|
||||||
@@ -6420,9 +6496,9 @@ This will fail in production.`);
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
vue.watch(() => friendSocketStore.MessageReceived, (newId) => {
|
vue.watch(() => friendSocketStore.MessageReceived, (newId) => {
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:1325", "收到了好友消息");
|
formatAppLog("log", "at pages/Chat/Chat.vue:1414", "收到了好友消息");
|
||||||
if (newId) {
|
if (newId) {
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:1327", "ChatType:", ChatType.value);
|
formatAppLog("log", "at pages/Chat/Chat.vue:1416", "ChatType:", ChatType.value);
|
||||||
switch (ChatType.value) {
|
switch (ChatType.value) {
|
||||||
case 0:
|
case 0:
|
||||||
takeConversationMessages();
|
takeConversationMessages();
|
||||||
@@ -6437,7 +6513,7 @@ This will fail in production.`);
|
|||||||
friendSocketStore.MessageReceived = false;
|
friendSocketStore.MessageReceived = false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
formatAppLog("log", "at pages/Chat/Chat.vue:1343", "default 分支");
|
formatAppLog("log", "at pages/Chat/Chat.vue:1432", "default 分支");
|
||||||
friendSocketStore.MessageReceived = false;
|
friendSocketStore.MessageReceived = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -6499,7 +6575,7 @@ This will fail in production.`);
|
|||||||
onUnload(() => {
|
onUnload(() => {
|
||||||
socketStore.disconnect();
|
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, detailMessageContent, detailLinks, extractLinks, 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, uploadedFiles, streamingMessageId, showMessageModal, detailLinks, handleChatContentClick, extractLinks, extractFileNameFromUrl, showMessageDetail, closeMessageDetail, downloadToast, get downloadToastTimer() {
|
||||||
return downloadToastTimer;
|
return downloadToastTimer;
|
||||||
}, set downloadToastTimer(v) {
|
}, set downloadToastTimer(v) {
|
||||||
downloadToastTimer = v;
|
downloadToastTimer = v;
|
||||||
@@ -6733,7 +6809,7 @@ This will fail in production.`);
|
|||||||
message.content && String(message.content).trim() !== "" || message._streaming ? (vue.openBlock(), vue.createElementBlock("view", {
|
message.content && String(message.content).trim() !== "" || message._streaming ? (vue.openBlock(), vue.createElementBlock("view", {
|
||||||
key: 1,
|
key: 1,
|
||||||
class: vue.normalizeClass(["chat-content", { "chat-content-user": message.role === "user", "chat-content-assistant": message.role === "assistant" }]),
|
class: vue.normalizeClass(["chat-content", { "chat-content-user": message.role === "user", "chat-content-assistant": message.role === "assistant" }]),
|
||||||
onClick: ($event) => $setup.showMessageDetail(message)
|
onClick: ($event) => $setup.handleChatContentClick($event, message)
|
||||||
}, [
|
}, [
|
||||||
message._streaming && (!message.content || String(message.content).trim() === "") ? (vue.openBlock(), vue.createElementBlock("view", {
|
message._streaming && (!message.content || String(message.content).trim() === "") ? (vue.openBlock(), vue.createElementBlock("view", {
|
||||||
key: 0,
|
key: 0,
|
||||||
@@ -6836,65 +6912,60 @@ This will fail in production.`);
|
|||||||
2
|
2
|
||||||
/* CLASS */
|
/* CLASS */
|
||||||
),
|
),
|
||||||
vue.createElementVNode(
|
vue.createElementVNode("view", {
|
||||||
"view",
|
class: vue.normalizeClass(["chat-content", { "chat-content-user": message.sender === $setup.UserId }]),
|
||||||
{
|
onClick: ($event) => $setup.handleChatContentClick($event, message)
|
||||||
class: vue.normalizeClass(["chat-content", { "chat-content-user": message.sender === $setup.UserId }])
|
}, [
|
||||||
},
|
message.content && String(message.content).trim() !== "" ? (vue.openBlock(), vue.createElementBlock("view", {
|
||||||
[
|
key: 0,
|
||||||
message.content && String(message.content).trim() !== "" ? (vue.openBlock(), vue.createElementBlock("view", {
|
innerHTML: $setup.pareseMarkdown(message.content)
|
||||||
key: 0,
|
}, null, 8, ["innerHTML"])) : vue.createCommentVNode("v-if", true),
|
||||||
innerHTML: $setup.pareseMarkdown(message.content)
|
message.contentJson ? (vue.openBlock(), vue.createElementBlock("view", {
|
||||||
}, null, 8, ["innerHTML"])) : vue.createCommentVNode("v-if", true),
|
key: 1,
|
||||||
message.contentJson ? (vue.openBlock(), vue.createElementBlock("view", {
|
class: "message-file-list"
|
||||||
key: 1,
|
}, [
|
||||||
class: "message-file-list"
|
(vue.openBlock(true), vue.createElementBlock(
|
||||||
}, [
|
vue.Fragment,
|
||||||
(vue.openBlock(true), vue.createElementBlock(
|
null,
|
||||||
vue.Fragment,
|
vue.renderList(JSON.parse(message.contentJson), (file, idx) => {
|
||||||
null,
|
return vue.openBlock(), vue.createElementBlock("view", {
|
||||||
vue.renderList(JSON.parse(message.contentJson), (file, idx) => {
|
key: idx,
|
||||||
return vue.openBlock(), vue.createElementBlock("view", {
|
class: "file-item"
|
||||||
key: idx,
|
}, [
|
||||||
class: "file-item"
|
["jpg", "jpeg", "png", "gif", "webp", "bmp"].includes(file.extendName.toLowerCase()) ? (vue.openBlock(), vue.createElementBlock("image", {
|
||||||
|
key: 0,
|
||||||
|
src: file.url,
|
||||||
|
mode: "widthFix",
|
||||||
|
class: "message-image",
|
||||||
|
onClick: ($event) => $setup.previewImage(file.url)
|
||||||
|
}, null, 8, ["src", "onClick"])) : (vue.openBlock(), vue.createElementBlock("view", {
|
||||||
|
key: 1,
|
||||||
|
class: "message-file",
|
||||||
|
onClick: ($event) => $setup.openFile(file.url)
|
||||||
}, [
|
}, [
|
||||||
["jpg", "jpeg", "png", "gif", "webp", "bmp"].includes(file.extendName.toLowerCase()) ? (vue.openBlock(), vue.createElementBlock("image", {
|
vue.createElementVNode("view", { class: "file-icon" }, "📄"),
|
||||||
key: 0,
|
vue.createElementVNode(
|
||||||
src: file.url,
|
"view",
|
||||||
mode: "widthFix",
|
{ class: "file-name" },
|
||||||
class: "message-image",
|
vue.toDisplayString(file.name),
|
||||||
onClick: ($event) => $setup.previewImage(file.url)
|
1
|
||||||
}, null, 8, ["src", "onClick"])) : (vue.openBlock(), vue.createElementBlock("view", {
|
/* TEXT */
|
||||||
key: 1,
|
),
|
||||||
class: "message-file",
|
vue.createElementVNode(
|
||||||
onClick: ($event) => $setup.openFile(file.url)
|
"view",
|
||||||
}, [
|
{ class: "file-size" },
|
||||||
vue.createElementVNode("view", { class: "file-icon" }, "📄"),
|
vue.toDisplayString($setup.formatFileSize(file.fileSize)),
|
||||||
vue.createElementVNode(
|
1
|
||||||
"view",
|
/* TEXT */
|
||||||
{ class: "file-name" },
|
)
|
||||||
vue.toDisplayString(file.name),
|
], 8, ["onClick"]))
|
||||||
1
|
]);
|
||||||
/* TEXT */
|
}),
|
||||||
),
|
128
|
||||||
vue.createElementVNode(
|
/* KEYED_FRAGMENT */
|
||||||
"view",
|
))
|
||||||
{ class: "file-size" },
|
])) : vue.createCommentVNode("v-if", true)
|
||||||
vue.toDisplayString($setup.formatFileSize(file.fileSize)),
|
], 10, ["onClick"])
|
||||||
1
|
|
||||||
/* TEXT */
|
|
||||||
)
|
|
||||||
], 8, ["onClick"]))
|
|
||||||
]);
|
|
||||||
}),
|
|
||||||
128
|
|
||||||
/* KEYED_FRAGMENT */
|
|
||||||
))
|
|
||||||
])) : vue.createCommentVNode("v-if", true)
|
|
||||||
],
|
|
||||||
2
|
|
||||||
/* CLASS */
|
|
||||||
)
|
|
||||||
], 10, ["id"]);
|
], 10, ["id"]);
|
||||||
}),
|
}),
|
||||||
128
|
128
|
||||||
@@ -6934,65 +7005,60 @@ This will fail in production.`);
|
|||||||
2
|
2
|
||||||
/* CLASS */
|
/* CLASS */
|
||||||
),
|
),
|
||||||
vue.createElementVNode(
|
vue.createElementVNode("view", {
|
||||||
"view",
|
class: vue.normalizeClass(["chat-content", { "chat-content-user": message.sender === $setup.UserId }]),
|
||||||
{
|
onClick: ($event) => $setup.handleChatContentClick($event, message)
|
||||||
class: vue.normalizeClass(["chat-content", { "chat-content-user": message.sender === $setup.UserId }])
|
}, [
|
||||||
},
|
message.message && String(message.message).trim() !== "" ? (vue.openBlock(), vue.createElementBlock("view", {
|
||||||
[
|
key: 0,
|
||||||
message.message && String(message.message).trim() !== "" ? (vue.openBlock(), vue.createElementBlock("view", {
|
innerHTML: $setup.pareseMarkdown(message.message)
|
||||||
key: 0,
|
}, null, 8, ["innerHTML"])) : vue.createCommentVNode("v-if", true),
|
||||||
innerHTML: $setup.pareseMarkdown(message.message)
|
message.contentJson ? (vue.openBlock(), vue.createElementBlock("view", {
|
||||||
}, null, 8, ["innerHTML"])) : vue.createCommentVNode("v-if", true),
|
key: 1,
|
||||||
message.contentJson ? (vue.openBlock(), vue.createElementBlock("view", {
|
class: "message-file-list"
|
||||||
key: 1,
|
}, [
|
||||||
class: "message-file-list"
|
(vue.openBlock(true), vue.createElementBlock(
|
||||||
}, [
|
vue.Fragment,
|
||||||
(vue.openBlock(true), vue.createElementBlock(
|
null,
|
||||||
vue.Fragment,
|
vue.renderList(JSON.parse(message.contentJson), (file, idx) => {
|
||||||
null,
|
return vue.openBlock(), vue.createElementBlock("view", {
|
||||||
vue.renderList(JSON.parse(message.contentJson), (file, idx) => {
|
key: idx,
|
||||||
return vue.openBlock(), vue.createElementBlock("view", {
|
class: "file-item"
|
||||||
key: idx,
|
}, [
|
||||||
class: "file-item"
|
["jpg", "jpeg", "png", "gif", "webp", "bmp"].includes(file.extendName.toLowerCase()) ? (vue.openBlock(), vue.createElementBlock("image", {
|
||||||
|
key: 0,
|
||||||
|
src: file.url,
|
||||||
|
mode: "widthFix",
|
||||||
|
class: "message-image",
|
||||||
|
onClick: ($event) => $setup.previewImage(file.url)
|
||||||
|
}, null, 8, ["src", "onClick"])) : (vue.openBlock(), vue.createElementBlock("view", {
|
||||||
|
key: 1,
|
||||||
|
class: "message-file",
|
||||||
|
onClick: ($event) => $setup.openFile(file.url)
|
||||||
}, [
|
}, [
|
||||||
["jpg", "jpeg", "png", "gif", "webp", "bmp"].includes(file.extendName.toLowerCase()) ? (vue.openBlock(), vue.createElementBlock("image", {
|
vue.createElementVNode("view", { class: "file-icon" }, "📄"),
|
||||||
key: 0,
|
vue.createElementVNode(
|
||||||
src: file.url,
|
"view",
|
||||||
mode: "widthFix",
|
{ class: "file-name" },
|
||||||
class: "message-image",
|
vue.toDisplayString(file.name),
|
||||||
onClick: ($event) => $setup.previewImage(file.url)
|
1
|
||||||
}, null, 8, ["src", "onClick"])) : (vue.openBlock(), vue.createElementBlock("view", {
|
/* TEXT */
|
||||||
key: 1,
|
),
|
||||||
class: "message-file",
|
vue.createElementVNode(
|
||||||
onClick: ($event) => $setup.openFile(file.url)
|
"view",
|
||||||
}, [
|
{ class: "file-size" },
|
||||||
vue.createElementVNode("view", { class: "file-icon" }, "📄"),
|
vue.toDisplayString($setup.formatFileSize(file.fileSize)),
|
||||||
vue.createElementVNode(
|
1
|
||||||
"view",
|
/* TEXT */
|
||||||
{ class: "file-name" },
|
)
|
||||||
vue.toDisplayString(file.name),
|
], 8, ["onClick"]))
|
||||||
1
|
]);
|
||||||
/* TEXT */
|
}),
|
||||||
),
|
128
|
||||||
vue.createElementVNode(
|
/* KEYED_FRAGMENT */
|
||||||
"view",
|
))
|
||||||
{ class: "file-size" },
|
])) : vue.createCommentVNode("v-if", true)
|
||||||
vue.toDisplayString($setup.formatFileSize(file.fileSize)),
|
], 10, ["onClick"])
|
||||||
1
|
|
||||||
/* TEXT */
|
|
||||||
)
|
|
||||||
], 8, ["onClick"]))
|
|
||||||
]);
|
|
||||||
}),
|
|
||||||
128
|
|
||||||
/* KEYED_FRAGMENT */
|
|
||||||
))
|
|
||||||
])) : vue.createCommentVNode("v-if", true)
|
|
||||||
],
|
|
||||||
2
|
|
||||||
/* CLASS */
|
|
||||||
)
|
|
||||||
], 10, ["id"]);
|
], 10, ["id"]);
|
||||||
}),
|
}),
|
||||||
128
|
128
|
||||||
@@ -7128,13 +7194,6 @@ This will fail in production.`);
|
|||||||
class: "message-detail-content",
|
class: "message-detail-content",
|
||||||
"scroll-y": ""
|
"scroll-y": ""
|
||||||
}, [
|
}, [
|
||||||
vue.createElementVNode(
|
|
||||||
"text",
|
|
||||||
null,
|
|
||||||
vue.toDisplayString($setup.detailMessageContent),
|
|
||||||
1
|
|
||||||
/* TEXT */
|
|
||||||
),
|
|
||||||
$setup.detailLinks.length ? (vue.openBlock(), vue.createElementBlock("view", {
|
$setup.detailLinks.length ? (vue.openBlock(), vue.createElementBlock("view", {
|
||||||
key: 0,
|
key: 0,
|
||||||
class: "detail-links-section"
|
class: "detail-links-section"
|
||||||
@@ -7142,7 +7201,7 @@ This will fail in production.`);
|
|||||||
vue.createElementVNode(
|
vue.createElementVNode(
|
||||||
"view",
|
"view",
|
||||||
{ class: "detail-links-title" },
|
{ class: "detail-links-title" },
|
||||||
"链接 (" + vue.toDisplayString($setup.detailLinks.length) + ")",
|
"文件 (" + vue.toDisplayString($setup.detailLinks.length) + ")",
|
||||||
1
|
1
|
||||||
/* TEXT */
|
/* TEXT */
|
||||||
),
|
),
|
||||||
@@ -7153,12 +7212,12 @@ This will fail in production.`);
|
|||||||
return vue.openBlock(), vue.createElementBlock("view", {
|
return vue.openBlock(), vue.createElementBlock("view", {
|
||||||
key: i,
|
key: i,
|
||||||
class: "detail-link-item",
|
class: "detail-link-item",
|
||||||
onClick: ($event) => $setup.openLink(link)
|
onClick: ($event) => $setup.openLink(link.url)
|
||||||
}, [
|
}, [
|
||||||
vue.createElementVNode(
|
vue.createElementVNode(
|
||||||
"text",
|
"text",
|
||||||
{ class: "link-text" },
|
{ class: "link-text" },
|
||||||
vue.toDisplayString(link),
|
vue.toDisplayString(link.name),
|
||||||
1
|
1
|
||||||
/* TEXT */
|
/* TEXT */
|
||||||
)
|
)
|
||||||
@@ -7167,7 +7226,12 @@ This will fail in production.`);
|
|||||||
128
|
128
|
||||||
/* KEYED_FRAGMENT */
|
/* KEYED_FRAGMENT */
|
||||||
))
|
))
|
||||||
])) : vue.createCommentVNode("v-if", true)
|
])) : (vue.openBlock(), vue.createElementBlock("view", {
|
||||||
|
key: 1,
|
||||||
|
class: "detail-empty"
|
||||||
|
}, [
|
||||||
|
vue.createElementVNode("text", null, "无可下载文件")
|
||||||
|
]))
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
])) : vue.createCommentVNode("v-if", true),
|
])) : vue.createCommentVNode("v-if", true),
|
||||||
|
|||||||
14
unpackage/dist/dev/app-plus/pages/Chat/Chat.css
vendored
14
unpackage/dist/dev/app-plus/pages/Chat/Chat.css
vendored
@@ -1657,6 +1657,7 @@ to { opacity: 1; transform: translateY(0);
|
|||||||
/* 文章场景相关 */
|
/* 文章场景相关 */
|
||||||
.chat-content {
|
.chat-content {
|
||||||
/* 普通正文 */
|
/* 普通正文 */
|
||||||
|
/* 气泡内的内联链接(替代 <a> 标签,点击由 JS 拦截处理) */
|
||||||
}
|
}
|
||||||
.chat-content h1 {
|
.chat-content h1 {
|
||||||
font-size: 1.3125rem;
|
font-size: 1.3125rem;
|
||||||
@@ -1687,6 +1688,11 @@ to { opacity: 1; transform: translateY(0);
|
|||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
margin: 0.25rem 0;
|
margin: 0.25rem 0;
|
||||||
}
|
}
|
||||||
|
.chat-content .chat-inline-link {
|
||||||
|
color: #3b86ff !important;
|
||||||
|
text-decoration: underline;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
/* 流式气泡中的加载动画 */
|
/* 流式气泡中的加载动画 */
|
||||||
.bubble-loading-dots {
|
.bubble-loading-dots {
|
||||||
@@ -1742,6 +1748,14 @@ to { opacity: 1; transform: translateY(0);
|
|||||||
color: #007aff;
|
color: #007aff;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
.detail-empty {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 1.25rem 0;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
/* ========== 自定义下载 Toast(层级高于 ncd-overlay 的 9999)========== */
|
/* ========== 自定义下载 Toast(层级高于 ncd-overlay 的 9999)========== */
|
||||||
.download-toast-overlay {
|
.download-toast-overlay {
|
||||||
|
|||||||
Reference in New Issue
Block a user