[update] 修改UAT问题:上传文件,文件名限制最多30位

This commit is contained in:
lideqin
2024-09-14 17:35:18 +08:00
parent 72548127a8
commit 22abdf7b6b
3 changed files with 19 additions and 1 deletions
+2 -1
View File
@@ -646,7 +646,8 @@ module.exports = {
fileFormatIncorrect: '文件格式不正确',
uploadSuccessful: '上传成功',
uploadMaximumATime: '一次最多上传二十张图片',
deletedSuccessfully: '删除成功'
deletedSuccessfully: '删除成功',
fileNameOverlong: '文件名长度不可超过30,请修改后重试'
},
importWithTemplate: {
chooseFile: '选择文件',
+6
View File
@@ -345,6 +345,12 @@ export default {
doBeforeUpload (file) {
this.uploadGoOn = true
file.uploadGoOn = true
if (file.name.split('.')[0].length > 30) {
this.$message.warning(this.$t('uploadFile.fileNameOverlong'))
this.uploadGoOn = false
file.uploadGoOn = false
return false
}
const fileSize = file.size // 上传的文件大小
if (fileSize === 0) {
this.$message.warning(this.$t('uploadFile.cannotUploadEmpty'))
+11
View File
@@ -310,8 +310,15 @@ export default {
this.$emit('change', path)
},
doBeforeUpload (file) {
console.log('--------file', file)
this.uploadGoOn = true
file.uploadGoOn = true
if (file.name.split('.')[0].length > 30) {
this.$message.warning(this.$t('uploadFile.fileNameOverlong'))
this.uploadGoOn = false
file.uploadGoOn = false
return false
}
const fileSize = file.size // 上传的文件大小
if (fileSize === 0) {
this.$message.warning(this.$t('uploadFile.cannotUploadEmpty'))
@@ -395,6 +402,10 @@ export default {
} else if (info.file.status === 'removed') {
this.handleDelete(info.file)
}
fileList = fileList.filter(tt => !!tt)
console.log(fileList)
// 二次过滤不符合要求的(uploadGoOn为false的),否则只上传多个不符合要求的只会有一个不出现在列表中
fileList = fileList.filter(tt => tt.uploadGoOn === undefined || tt.uploadGoOn === null || tt.uploadGoOn === true)
this.fileList = fileList
if (info.file.status === 'done' || info.file.status === 'removed') {
// returnUrl为true时仅返回文件路径