feat: 优化

This commit is contained in:
2026-03-03 04:18:19 +08:00
parent b0fa4279b0
commit 2c8664b41e

View File

@@ -25,7 +25,7 @@
</p>
<p class="ant-upload-text">点击或拖拽文件到此处上传</p>
<p class="ant-upload-hint">
支持多文件上传总大小不超过 300MB
支持多文件上传单文件最大 1GB
<br />
支持格式视频MP4MOVAVI等图片JPGPNGGIF等音频MP3WAV等
</p>
@@ -37,7 +37,7 @@
<div class="upload-file-list-title">
已选择 {{ fileList.length }} 个文件总大小{{ getTotalSize() }}
<span v-if="getTotalSizeBytes() > MAX_TOTAL_SIZE" style="color: #ff4d4f; margin-left: 8px;">
已超出 300MB 限制
已超出 1GB 限制
</span>
</div>
<div class="upload-file-items">
@@ -114,8 +114,8 @@ const DEFAULT_FILE_CATEGORY = 'video'
const acceptTypes = 'video/*,image/*,audio/*,.mp4,.mov,.avi,.mkv,.jpg,.jpeg,.png,.gif,.webp,.mp3,.wav,.aac'
// 常量
const MAX_TOTAL_SIZE = 300 * 1024 * 1024 // 300MB
const MAX_SINGLE_FILE_SIZE = 300 * 1024 * 1024 // 300MB (单个文件最大300MB)
const MAX_TOTAL_SIZE = 1 * 1024 * 1024 * 1024 // 1GB
const MAX_SINGLE_FILE_SIZE = 1 * 1024 * 1024 * 1024 // 1GB (单个文件最大1GB)
// 计算总大小(字节)
const getTotalSizeBytes = () => {
@@ -141,7 +141,7 @@ watch(() => props.visible, (newVal) => {
const handleBeforeUpload = (file) => {
// 检查单个文件大小
if (file.size > MAX_SINGLE_FILE_SIZE) {
message.warning(`文件 ${file.name} 超过 300MB已跳过`)
message.warning(`文件 ${file.name} 超过 1GB已跳过`)
return false
}
@@ -151,7 +151,7 @@ const handleBeforeUpload = (file) => {
// 检查总大小
if (newTotalSize > MAX_TOTAL_SIZE) {
message.warning(`文件总大小超过 300MB当前${formatFileSize(currentTotalSize)},新增:${formatFileSize(file.size)}),已跳过`)
message.warning(`文件总大小超过 1GB当前${formatFileSize(currentTotalSize)},新增:${formatFileSize(file.size)}),已跳过`)
return false
}
@@ -227,7 +227,7 @@ const handleConfirm = () => {
// 检查总大小
if (getTotalSizeBytes() > MAX_TOTAL_SIZE) {
message.warning(`文件总大小超过 300MB 限制,请移除部分文件`)
message.warning(`文件总大小超过 1GB 限制,请移除部分文件`)
return
}