8/6 校验问题

This commit is contained in:
Zy
2026-08-06 09:09:53 +08:00
parent 494b7869ea
commit 40196737d3
23 changed files with 242 additions and 106 deletions

View File

@@ -367,14 +367,20 @@ const handleAvatarSuccess: UploadProps['onSuccess'] = (response) => {
}
};
const blockedExts = ['.exe', '.bat', '.cmd', '.msi'];
const blockedExits = ['.exe', '.bat', '.cmd', '.msi'];
const allowExits = ['.bmp", ".gif", ".jpg", ".jpeg", ".png'];
const handleChangeFile = (uploadFile: UploadFile, uploadFiles: UploadFiles) => {
const ext = uploadFile.name.toLowerCase().slice(uploadFile.name.lastIndexOf('.'));
if (blockedExts.includes(ext)) {
if (blockedExits.includes(ext)) {
ElMessage.warning(`禁止上传 ${ext} 文件`);
uploadRef.value.handleRemove(uploadFile);
return;
}
if (!allowExits.includes(ext)) {
ElMessage.warning(`只允许上传jpg,jpeg,png等`);
uploadRef.value.handleRemove(uploadFile);
return;
}
fileList.value = uploadFiles;
};
const handleExceed = () => {