feat: 优化

This commit is contained in:
2026-03-02 01:32:02 +08:00
parent ce3d529f80
commit 668515a451
4 changed files with 60 additions and 54 deletions

View File

@@ -668,10 +668,13 @@ const handleBatchDelete = async () => {
}
const formatFileSize = (size) => {
if (size < 1024) return size + ' B'
if (size < 1024 * 1024) return (size / 1024).toFixed(2) + ' KB'
if (size < 1024 * 1024 * 1024) return (size / (1024 * 1024)).toFixed(2) + ' MB'
return (size / (1024 * 1024 * 1024)).toFixed(2) + ' GB'
const units = ['B', 'KB', 'MB', 'GB']
let unitIndex = 0
while (size >= 1024 && unitIndex < units.length - 1) {
size /= 1024
unitIndex++
}
return `${size.toFixed(2)} ${units[unitIndex]}`
}
const formatDate = (date) => {

View File

@@ -19,7 +19,7 @@ function getBaseUrl() {
}
return ''
}
//
const BASE_URL = getBaseUrl()
/**
@@ -61,7 +61,7 @@ export const isDev = () => {
*/
export function getApiUrl(module, path) {
const base = API_BASE[module] || API_BASE.APP
return `${base}${path.startsWith('/') ? path : '/' + path}`
return `${base}${path.startsWith('/') ? '' : '/'}${path}`
}
export default API_BASE