From 41aa35e3462cc1d8dd2dc47cf54346f890c676a9 Mon Sep 17 00:00:00 2001 From: Mao Meng <1707647656@qq.com> Date: Tue, 14 Apr 2026 13:31:44 +0800 Subject: [PATCH] refactor: change icon --- frontend/src/components/AttachmentUpload.vue | 79 ++++++++++++------- .../src/views/chat/components/usermsg.vue | 64 ++++++++++----- 2 files changed, 97 insertions(+), 46 deletions(-) diff --git a/frontend/src/components/AttachmentUpload.vue b/frontend/src/components/AttachmentUpload.vue index bddf9b65..1588256b 100644 --- a/frontend/src/components/AttachmentUpload.vue +++ b/frontend/src/components/AttachmentUpload.vue @@ -106,6 +106,10 @@ const formatFileSize = (bytes: number): string => { return (bytes / (1024 * 1024)).toFixed(1) + ' MB'; }; +const getFileExt = (fileName: string): string => { + return fileName.split('.').pop()?.toUpperCase() || 'FILE'; +}; + const getFileIcon = (fileName: string): string => { const ext = fileName.split('.').pop()?.toLowerCase(); if (['pdf'].includes(ext || '')) return 'file-pdf'; @@ -147,9 +151,19 @@ defineExpose({ class="attachment-preview-item" >
+ - @@ -173,55 +187,66 @@ defineExpose({ .attachment-preview-item { position: relative; - width: 60px; - height: 60px; + display: flex; + flex-direction: row; + align-items: center; + gap: 10px; + padding: 8px 32px 8px 10px; border-radius: 8px; border: 1px solid var(--td-border-level-1-color, #e7e7e7); - background: var(--td-bg-color-secondarycontainer, #f5f5f5); - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - gap: 4px; - overflow: hidden; + background: var(--td-bg-color-container, #fff); + max-width: 240px; + min-width: 140px; cursor: default; .attachment-preview-icon { - font-size: 22px; - color: var(--td-brand-color, #07C05F); - line-height: 1; + flex-shrink: 0; + display: flex; + align-items: center; + justify-content: center; + } + + .attachment-preview-info { + flex: 1; + min-width: 0; + display: flex; + flex-direction: column; + gap: 2px; } .attachment-preview-name { - font-size: 10px; - color: var(--td-text-color-secondary, #666); - text-align: center; - width: 100%; - padding: 0 4px; + font-size: 13px; + font-weight: 500; + color: var(--td-text-color-primary, #333); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; - box-sizing: border-box; + } + + .attachment-preview-meta { + font-size: 11px; + color: var(--td-text-color-secondary, #999); + white-space: nowrap; } .attachment-preview-remove { position: absolute; - top: 2px; - right: 2px; - width: 16px; - height: 16px; - background: rgba(0, 0, 0, 0.5); + top: 4px; + right: 6px; + width: 18px; + height: 18px; + background: rgba(0, 0, 0, 0.18); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; - font-size: 12px; + font-size: 13px; cursor: pointer; line-height: 1; &:hover { - background: rgba(0, 0, 0, 0.7); + background: rgba(0, 0, 0, 0.4); } } } diff --git a/frontend/src/views/chat/components/usermsg.vue b/frontend/src/views/chat/components/usermsg.vue index 43d7b8a4..513003b3 100644 --- a/frontend/src/views/chat/components/usermsg.vue +++ b/frontend/src/views/chat/components/usermsg.vue @@ -31,9 +31,19 @@