修改上传文件的双语
This commit is contained in:
@@ -647,4 +647,8 @@ module.exports = {
|
||||
pleaseUploadSplitFile:'please upload split file',
|
||||
release:'release',
|
||||
confirmRelease:'confirm Release ?',
|
||||
UploadMost:'You can only upload 20 at most',
|
||||
FileUploadFailed:'File upload failed',
|
||||
FileUploadedSuccessfully:'File uploaded successfully',
|
||||
DeletedSuccessfully:'Deleted successfully',
|
||||
}
|
||||
+650
-646
File diff suppressed because it is too large
Load Diff
@@ -90,9 +90,6 @@
|
||||
// }
|
||||
// }
|
||||
this.$message.destroy()
|
||||
// 207M.doc文件大小超出100MB限制, 请压缩或降低文件质量!
|
||||
this.errorMessage = file.name + '文件大小超出100MB限制, 请压缩或降低文件质量!'
|
||||
|
||||
},
|
||||
remove() {
|
||||
this.fileTypeSatus = true
|
||||
@@ -103,7 +100,6 @@
|
||||
},
|
||||
handleChange(info) {
|
||||
let { file } = info
|
||||
console.log(file)
|
||||
const status = info.file.status
|
||||
info.fileList.forEach((val, index) => {
|
||||
if (val.response && !val.response.result) {
|
||||
@@ -111,96 +107,87 @@
|
||||
info.fileList.splice(index, 1)
|
||||
}
|
||||
})
|
||||
if (this.fileTypeSatus) {
|
||||
if (file.size > 100000000) {
|
||||
this.$message.error(this.errorMessage)
|
||||
if (status === 'error') {
|
||||
this.$emit('uploadSuccess', this.fileList)
|
||||
this.$message.destroy()
|
||||
this.$message.error(`${info.file.name}` + this.$t('FileUploadFailed'))
|
||||
} else if (status === 'removed') {
|
||||
this.myfileList = info.fileList
|
||||
this.fileList = []
|
||||
this.myfileList.forEach((res) => {
|
||||
if (res.response) {
|
||||
this.fileList.push(res.response.result)
|
||||
} else {
|
||||
this.fileList.push(res)
|
||||
}
|
||||
})
|
||||
this.$emit('uploadSuccess', this.fileList)
|
||||
if (this.myfileList.length > 0) {
|
||||
this.$message.destroy()
|
||||
this.$message.success(`${info.file.name}` + this.$t('DeletedSuccessfully'))
|
||||
}
|
||||
} else if (status === 'done') {
|
||||
this.fileList = []
|
||||
this.myfileList = info.fileList
|
||||
if (info.fileList.length > 20) {
|
||||
info.fileList.splice(20)
|
||||
this.myfileList = info.fileList
|
||||
this.myfileList.forEach((res) => {
|
||||
if (res.response) {
|
||||
this.fileList.push(res.response.result)
|
||||
} else {
|
||||
this.fileList.push(res)
|
||||
}
|
||||
})
|
||||
this.$emit('uploadSuccess', this.fileList)
|
||||
this.$message.destroy()
|
||||
this.$message.error(this.$t('UploadMost'))
|
||||
return
|
||||
} else {
|
||||
if (status === 'error') {
|
||||
this.$emit('uploadSuccess', this.fileList)
|
||||
this.$message.destroy()
|
||||
this.$message.error(`${info.file.name} 文件上传失败。`)
|
||||
} else if (status === 'removed') {
|
||||
this.myfileList = info.fileList
|
||||
this.fileList = []
|
||||
this.myfileList.forEach((res) => {
|
||||
if (res.response) {
|
||||
this.fileList.push(res.response.result)
|
||||
} else {
|
||||
this.fileList.push(res)
|
||||
}
|
||||
})
|
||||
this.$emit('uploadSuccess', this.fileList)
|
||||
if (this.myfileList.length > 0) {
|
||||
this.$message.destroy()
|
||||
this.$message.success(`${info.file.name} 删除成功。`)
|
||||
}
|
||||
} else if (status === 'done') {
|
||||
this.fileList = []
|
||||
this.myfileList = info.fileList
|
||||
if (info.fileList.length > 20) {
|
||||
info.fileList.splice(20)
|
||||
this.myfileList = info.fileList
|
||||
this.myfileList.forEach((res) => {
|
||||
if (res.response) {
|
||||
this.fileList.push(res.response.result)
|
||||
} else {
|
||||
this.fileList.push(res)
|
||||
}
|
||||
})
|
||||
this.$emit('uploadSuccess', this.fileList)
|
||||
this.$message.destroy()
|
||||
this.$message.error('最多只能上传二十个')
|
||||
return
|
||||
}
|
||||
this.myfileList.forEach((res) => {
|
||||
if (res.response) {
|
||||
this.fileList.push(res.response.result)
|
||||
} else {
|
||||
this.fileList.push(res)
|
||||
}
|
||||
})
|
||||
console.log(this.myfileList)
|
||||
this.$emit('uploadSuccess', this.fileList)
|
||||
if (this.myfileList.length > 0) {
|
||||
this.$message.destroy()
|
||||
if (file.response.success) {
|
||||
this.$message.success(`${info.file.name} 文件上传成功。`)
|
||||
}
|
||||
}
|
||||
} else if (status === 'uploading') {
|
||||
this.myfileList = info.fileList
|
||||
// this.$message.success(`${info.file.name} 文件上传成功。`);
|
||||
}
|
||||
this.myfileList.forEach((res) => {
|
||||
if (res.response) {
|
||||
this.fileList.push(res.response.result)
|
||||
} else {
|
||||
this.fileList.push(res)
|
||||
}
|
||||
})
|
||||
this.$emit('uploadSuccess', this.fileList)
|
||||
if (this.myfileList.length > 0) {
|
||||
this.$message.destroy()
|
||||
if (file.response.success) {
|
||||
this.$message.success(`${info.file.name}` + this.$t('FileUploadedSuccessfully'))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.$message.warning('不支持上传该类型的文件!')
|
||||
}
|
||||
},
|
||||
resetFileList() {
|
||||
this.myfileList = []
|
||||
this.fileList = []
|
||||
},
|
||||
preview(file) {
|
||||
let fileQuery = file.response ? file.response.result : file
|
||||
let fileName = fileQuery.fileName
|
||||
let index1 = fileName.lastIndexOf('.')
|
||||
let index2 = fileName.length
|
||||
let fileSuffix = fileName.substring(index1, index2)
|
||||
if (fileSuffix === '.pdf') {
|
||||
window.open('/pdf/web/viewer.html?file=' + encodeURIComponent('/jero-boot/sys/common/pdf/viewFile?id=' + fileQuery.id))
|
||||
} else if (fileSuffix === '.docx') {
|
||||
let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + Base64.encode(this.downLoadFileUrl + '/' + fileQuery.id + fileSuffix)
|
||||
window.open(url, '_blank')
|
||||
} else if (fileSuffix === '.xlsx' || fileSuffix === '.xls') {
|
||||
let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + Base64.encode(this.downLoadFileUrl + '/' + fileQuery.id + fileSuffix)
|
||||
window.open(url, '_blank')
|
||||
} else {
|
||||
downloadFile('/sys/common/downLoadFile', fileQuery.fileName, { id: fileQuery.id })
|
||||
} else if (status === 'uploading') {
|
||||
this.myfileList = info.fileList
|
||||
// this.$message.success(`${info.file.name} 文件上传成功。`);
|
||||
}
|
||||
}
|
||||
},
|
||||
resetFileList() {
|
||||
this.myfileList = []
|
||||
this.fileList = []
|
||||
},
|
||||
preview(file) {
|
||||
let fileQuery = file.response ? file.response.result : file
|
||||
let fileName = fileQuery.fileName
|
||||
let index1 = fileName.lastIndexOf('.')
|
||||
let index2 = fileName.length
|
||||
let fileSuffix = fileName.substring(index1, index2)
|
||||
if (fileSuffix === '.pdf') {
|
||||
window.open('/pdf/web/viewer.html?file=' + encodeURIComponent('/jero-boot/sys/common/pdf/viewFile?id=' + fileQuery.id))
|
||||
} else if (fileSuffix === '.docx') {
|
||||
let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + Base64.encode(this.downLoadFileUrl + '/' + fileQuery.id + fileSuffix)
|
||||
window.open(url, '_blank')
|
||||
} else if (fileSuffix === '.xlsx' || fileSuffix === '.xls') {
|
||||
let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + Base64.encode(this.downLoadFileUrl + '/' + fileQuery.id + fileSuffix)
|
||||
window.open(url, '_blank')
|
||||
} else {
|
||||
downloadFile('/sys/common/downLoadFile', fileQuery.fileName, { id: fileQuery.id })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
Reference in New Issue
Block a user