From 3fb4cc09502d0d3836edcd754bff48a0ef4e8740 Mon Sep 17 00:00:00 2001 From: chabai <14799297+dhasjklhdfjkasfbhfasfj@user.noreply.gitee.com> Date: Tue, 12 Aug 2025 15:50:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=99=BA=E8=83=BD=E5=95=86=E5=8A=A1=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E9=80=82=E9=85=8D=E4=B8=BB=E9=A2=98=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/bussiness-data/bussiness.vue | 198 ++++++++++++------------- 1 file changed, 95 insertions(+), 103 deletions(-) diff --git a/src/views/bussiness-data/bussiness.vue b/src/views/bussiness-data/bussiness.vue index 49f236c..dcc7abf 100644 --- a/src/views/bussiness-data/bussiness.vue +++ b/src/views/bussiness-data/bussiness.vue @@ -4,10 +4,9 @@ @@ -102,29 +101,7 @@ - - + @@ -305,7 +282,7 @@ -
{{ formatFileSize(file.fileSize || file.size) }}
+
{{ formatFileListSize(file.fileSize || file.size) }}
@@ -682,7 +659,7 @@ const fileListTemp = ref([]); const folderFormRef = ref(null); const uploadFormRef = ref(null); const uploadRef = ref(null); -const folderColor = '#165DFF'; +const folderColor = 'var(--color-primary)'; const refreshing = ref(false); const folderSubmitting = ref(false); const uploading = ref(false); @@ -1624,7 +1601,7 @@ const fileColor = (extension) => { bmp: '#722ed1', webp: '#13c2c2' }; - return colorMap[extension.toLowerCase()] || '#8c8c8c'; + return colorMap[extension.toLowerCase()] || 'var(--color-text-3)'; }; @@ -1881,8 +1858,8 @@ const showTextPreview = async (blob, fileName) => { maxWidth: '100%', maxHeight: '70vh', overflow: 'auto', - backgroundColor: '#f8f9fa', - border: '1px solid #e9ecef', + backgroundColor: 'var(--color-fill-1)', + border: '1px solid var(--color-border)', borderRadius: '8px', padding: '20px', fontFamily: "'Consolas', 'Monaco', 'Courier New', monospace", @@ -1890,7 +1867,7 @@ const showTextPreview = async (blob, fileName) => { lineHeight: '1.6', whiteSpace: 'pre-wrap', wordBreak: 'break-word', - color: '#333', + color: 'var(--color-text-1)', textAlign: 'left' } }, text) @@ -2336,6 +2313,21 @@ const formatFileSize = (fileSize) => { return `${(size / (1024 * 1024 * 1024)).toFixed(1)} GB`; }; +// 专门用于文件列表的格式化函数(假设后端返回的是KB单位) +const formatFileListSize = (fileSize) => { + const size = Number(fileSize); + if (isNaN(size) || size < 0) return '未知'; + + // 假设后端返回的是KB单位 + if (size < 1024) { + return `${size} KB`; + } else if (size < 1024 * 1024) { + return `${(size / 1024).toFixed(1)} MB`; + } else { + return `${(size / (1024 * 1024)).toFixed(1)} GB`; + } +}; + const fileTypeText = (type) => { @@ -2458,7 +2450,7 @@ onMounted(() => {