diff --git a/frontend/pages/chat/[[username]].vue b/frontend/pages/chat/[[username]].vue index 03bf0de..147654f 100644 --- a/frontend/pages/chat/[[username]].vue +++ b/frontend/pages/chat/[[username]].vue @@ -242,14 +242,20 @@ @click="selectContact(contact)">
-
-
- -
-
- {{ contact.name.charAt(0) }} +
+
+
+ +
+
+ {{ contact.name.charAt(0) }} +
+
@@ -257,13 +263,12 @@

{{ contact.name }}

- - {{ contact.unreadCount > 99 ? '99+' : contact.unreadCount }} - {{ contact.lastMessageTime }}
-

{{ contact.lastMessage }}

+

+ {{ contact.unreadCount > 0 ? `[${contact.unreadCount > 99 ? '99+' : contact.unreadCount}条] ` : '' }}{{ contact.lastMessage }} +

@@ -616,15 +621,15 @@ -
-
-
- {{ message.quoteTitle }}: -
-
{{ message.quoteTitle ? (message.quoteTitle + ': ') : '' }}{{ message.quoteContent }}
-
-
- + class="hidden" + > + +
+ {{ message.quoteTitle }}: + + {{ message.quoteContent }} + +
+ +
+ 引用图片 +
+ +
{ return false } +const isQuotedImage = (message) => { + const t = String(message?.quoteType || '').trim() + if (t === '3') return true + if (String(message?.quoteContent || '').trim() === '[图片]' && String(message?.quoteServerId || '').trim()) return true + return false +} + +const onQuoteImageError = (message) => { + try { + if (message) message._quoteImageError = true + } catch {} +} + const playQuoteVoice = (message) => { playVoice({ id: getQuoteVoiceId(message) }) } @@ -4665,6 +4705,23 @@ const normalizeMessage = (msg) => { } } + const quoteServerIdStr = String(msg.quoteServerId || '').trim() + const quoteTypeStr = String(msg.quoteType || '').trim() + const quoteVoiceUrl = quoteServerIdStr + ? `${mediaBase}/api/chat/media/voice?account=${encodeURIComponent(selectedAccount.value || '')}&server_id=${encodeURIComponent(quoteServerIdStr)}` + : '' + const quoteImageUrl = (() => { + if (!quoteServerIdStr) return '' + if (quoteTypeStr !== '3' && String(msg.quoteContent || '').trim() !== '[图片]') return '' + const convUsername = String(selectedContact.value?.username || '').trim() + const parts = [ + `account=${encodeURIComponent(selectedAccount.value || '')}`, + `server_id=${encodeURIComponent(quoteServerIdStr)}`, + convUsername ? `username=${encodeURIComponent(convUsername)}` : '' + ].filter(Boolean) + return parts.length ? `${mediaBase}/api/chat/media/image?${parts.join('&')}` : '' + })() + return { id: msg.id, serverId: msg.serverId || 0, @@ -4701,12 +4758,12 @@ const normalizeMessage = (msg) => { quoteTitle: msg.quoteTitle || '', quoteContent, quoteUsername: msg.quoteUsername || '', - quoteServerId: String(msg.quoteServerId || '').trim(), - quoteType: String(msg.quoteType || '').trim(), + quoteServerId: quoteServerIdStr, + quoteType: quoteTypeStr, quoteVoiceLength: msg.quoteVoiceLength || '', - quoteVoiceUrl: String(msg.quoteServerId || '').trim() - ? `${mediaBase}/api/chat/media/voice?account=${encodeURIComponent(selectedAccount.value || '')}&server_id=${encodeURIComponent(String(msg.quoteServerId || '').trim())}` - : '', + quoteVoiceUrl, + quoteImageUrl: quoteImageUrl || '', + _quoteImageError: false, amount: msg.amount || '', coverUrl: msg.coverUrl || '', fileSize: msg.fileSize || '',