附件上传前端10M限制提升到50M

master
weizong song 4 weeks ago
parent e4d7bcaae0
commit 92a1c02644

@ -517,7 +517,7 @@
</el-button>
<template #tip>
<div class="el-upload__tip">
支持上传多个文件单个文件不超过10MB
支持上传多个文件单个文件不超过50MB
</div>
</template>
</el-upload>
@ -2410,14 +2410,14 @@ const uploadHeaders = computed(() => {
//
const beforeUpload = (file) => {
const isValidType = ['image/jpeg', 'image/png', 'image/jpg', 'application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'].includes(file.type)
const isLt10M = file.size / 1024 / 1024 < 10
const isLt50M = file.size / 1024 / 1024 < 50
if (!isValidType) {
ElMessage.error('只能上传 JPG/PNG/PDF/DOC/DOCX/XLS/XLSX 格式的文件!')
return false
}
if (!isLt10M) {
ElMessage.error('文件大小不能超过 10MB!')
if (!isLt50M) {
ElMessage.error('文件大小不能超过 50MB!')
return false
}
return true

@ -288,7 +288,7 @@
</el-button>
<template #tip>
<div class="el-upload__tip">
支持上传多个文件单个文件大小不超过10MB
支持上传多个文件单个文件大小不超过50MB
</div>
</template>
</el-upload>
@ -1062,7 +1062,7 @@
</el-button>
<template #tip>
<div class="el-upload__tip">
支持上传多个文件单个文件不超过10MB
支持上传多个文件单个文件不超过50MB
</div>
</template>
</el-upload>
@ -4070,14 +4070,14 @@ const beforeUpload = (file) => {
const fileExtension = file.name.split('.').pop()?.toLowerCase()
const isValidType = validTypes.includes(file.type) || validExtensions.includes(fileExtension)
const isLt10M = file.size / 1024 / 1024 < 10
const isLt50M = file.size / 1024 / 1024 < 50
if (!isValidType) {
ElMessage.error('只能上传 JPG/PNG/PDF/DOC/DOCX/XLS/XLSX/PPT/PPTX/ZIP/RAR/CEBX/MP4 格式的文件!')
return false
}
if (!isLt10M) {
ElMessage.error('文件大小不能超过 10MB!')
if (!isLt50M) {
ElMessage.error('文件大小不能超过 50MB!')
return false
}
return true

Loading…
Cancel
Save