修改上传文件的双语

This commit is contained in:
qq787203167
2022-04-12 17:52:18 +08:00
parent f1c182c390
commit 19bc0ec105
3 changed files with 728 additions and 733 deletions
+4
View File
@@ -647,4 +647,8 @@ module.exports = {
pleaseUploadSplitFile:'please upload split file', pleaseUploadSplitFile:'please upload split file',
release:'release', release:'release',
confirmRelease:'confirm Release ?', confirmRelease:'confirm Release ?',
UploadMost:'You can only upload 20 at most',
FileUploadFailed:'File upload failed',
FileUploadedSuccessfully:'File uploaded successfully',
DeletedSuccessfully:'Deleted successfully',
} }
+5 -1
View File
@@ -116,7 +116,7 @@ module.exports = {
enterDepartmentName: '请输入部门名称', enterDepartmentName: '请输入部门名称',
addTo: '添加', addTo: '添加',
cancel: '取消', cancel: '取消',
checkAll:"全部勾选", checkAll: '全部勾选',
DeselectAll: '取消全选', DeselectAll: '取消全选',
ExpandAll: '展开所有', ExpandAll: '展开所有',
MergeAll: '合并所有', MergeAll: '合并所有',
@@ -651,4 +651,8 @@ module.exports = {
pleaseUploadSplitFile: '请上传拆分文件', pleaseUploadSplitFile: '请上传拆分文件',
release: '发布', release: '发布',
confirmRelease: '确认发布?', confirmRelease: '确认发布?',
UploadMost: '最多只能上传二十个',
FileUploadFailed:'文件上传失败',
FileUploadedSuccessfully:'文件上传成功',
DeletedSuccessfully:'删除成功',
} }
+4 -17
View File
@@ -90,9 +90,6 @@
// } // }
// } // }
this.$message.destroy() this.$message.destroy()
// 207M.doc文件大小超出100MB限制, 请压缩或降低文件质量!
this.errorMessage = file.name + '文件大小超出100MB限制, 请压缩或降低文件质量!'
}, },
remove() { remove() {
this.fileTypeSatus = true this.fileTypeSatus = true
@@ -103,7 +100,6 @@
}, },
handleChange(info) { handleChange(info) {
let { file } = info let { file } = info
console.log(file)
const status = info.file.status const status = info.file.status
info.fileList.forEach((val, index) => { info.fileList.forEach((val, index) => {
if (val.response && !val.response.result) { if (val.response && !val.response.result) {
@@ -111,15 +107,10 @@
info.fileList.splice(index, 1) info.fileList.splice(index, 1)
} }
}) })
if (this.fileTypeSatus) {
if (file.size > 100000000) {
this.$message.error(this.errorMessage)
return
} else {
if (status === 'error') { if (status === 'error') {
this.$emit('uploadSuccess', this.fileList) this.$emit('uploadSuccess', this.fileList)
this.$message.destroy() this.$message.destroy()
this.$message.error(`${info.file.name} 文件上传失败。`) this.$message.error(`${info.file.name}` + this.$t('FileUploadFailed'))
} else if (status === 'removed') { } else if (status === 'removed') {
this.myfileList = info.fileList this.myfileList = info.fileList
this.fileList = [] this.fileList = []
@@ -133,7 +124,7 @@
this.$emit('uploadSuccess', this.fileList) this.$emit('uploadSuccess', this.fileList)
if (this.myfileList.length > 0) { if (this.myfileList.length > 0) {
this.$message.destroy() this.$message.destroy()
this.$message.success(`${info.file.name} 删除成功。`) this.$message.success(`${info.file.name}` + this.$t('DeletedSuccessfully'))
} }
} else if (status === 'done') { } else if (status === 'done') {
this.fileList = [] this.fileList = []
@@ -150,7 +141,7 @@
}) })
this.$emit('uploadSuccess', this.fileList) this.$emit('uploadSuccess', this.fileList)
this.$message.destroy() this.$message.destroy()
this.$message.error('最多只能上传二十个') this.$message.error(this.$t('UploadMost'))
return return
} }
this.myfileList.forEach((res) => { this.myfileList.forEach((res) => {
@@ -160,12 +151,11 @@
this.fileList.push(res) this.fileList.push(res)
} }
}) })
console.log(this.myfileList)
this.$emit('uploadSuccess', this.fileList) this.$emit('uploadSuccess', this.fileList)
if (this.myfileList.length > 0) { if (this.myfileList.length > 0) {
this.$message.destroy() this.$message.destroy()
if (file.response.success) { if (file.response.success) {
this.$message.success(`${info.file.name} 文件上传成功。`) this.$message.success(`${info.file.name}` + this.$t('FileUploadedSuccessfully'))
} }
} }
} else if (status === 'uploading') { } else if (status === 'uploading') {
@@ -173,9 +163,6 @@
// this.$message.success(`${info.file.name} 文件上传成功。`); // this.$message.success(`${info.file.name} 文件上传成功。`);
} }
} }
} else {
this.$message.warning('不支持上传该类型的文件!')
}
}, },
resetFileList() { resetFileList() {
this.myfileList = [] this.myfileList = []