From 2c832aa86171b40618addc686cfde172219522c1 Mon Sep 17 00:00:00 2001
From: 2977094657 <2977094657@qq.com>
Date: Mon, 9 Feb 2026 18:31:22 +0800
Subject: [PATCH] =?UTF-8?q?feat(chat-ui):=20=E4=BC=9A=E8=AF=9D=E5=88=97?=
=?UTF-8?q?=E8=A1=A8=E6=9C=AA=E8=AF=BB=E6=8F=90=E7=A4=BA=E4=B8=8E=E5=BC=95?=
=?UTF-8?q?=E7=94=A8=E5=9B=BE=E7=89=87=E9=A2=84=E8=A7=88=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 未读展示改为头像红点,并在 lastMessage 前缀展示未读条数
- 引用消息支持图片缩略图预览,失败自动降级为纯文本引用
- 规范化 quoteVoiceUrl/quoteImageUrl 生成,与后端 media 接口对齐
---
frontend/pages/chat/[[username]].vue | 121 ++++++++++++++++++++-------
1 file changed, 89 insertions(+), 32 deletions(-)
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 }}:
-
-
+ 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 || '',