文档拆分--查看--图片上传提示语不合理

This commit is contained in:
范强强
2024-03-12 15:08:34 +08:00
parent a92a2e7d1a
commit aef156c46d
2 changed files with 10 additions and 12 deletions
@@ -72,24 +72,19 @@ export default {
} }
}, },
beforeUpload (file) { beforeUpload (file) {
let fileFlag = false
// console.log('accept',this.accept,file)
this.fileTypeSatus = false this.fileTypeSatus = false
const fileTypes = this.accept.split('/') const fileName = file.name
const fileNowTypes = file.type.split('/') const index1 = fileName.lastIndexOf('.')
fileFlag = (fileTypes[0] === fileNowTypes[0]) const index2 = fileName.length
// console.log('filetype',fileFlag) let fileSuffix = fileName.substring(index1, index2)
fileSuffix = fileSuffix.toLowerCase()
const fileSize = file.size // 上传的文件大小 const fileSize = file.size // 上传的文件大小
if (fileSize > 1024 * 1024 * 500) { if (fileSize > 1024 * 1024 * 500) {
this.$message.warning('文件大小超出500MB限制, 请压缩或降低文件质量!') this.$message.warning('文件大小超出500MB限制, 请压缩或降低文件质量!')
this.fileTypeSatus = false this.fileTypeSatus = false
return false return false
} }
if (!fileFlag) { if (this.accept.includes(fileSuffix)) {
this.$message.warning(this.$t('文件格式不正确,请上传图片格式文件'))
this.fileTypeSatus = false
} else {
// let thisFileType = this.thisFileType.replace(/\s+/g, "");
if (this.uploadFileFlag < 20) { if (this.uploadFileFlag < 20) {
this.uploadFileFlag++ this.uploadFileFlag++
} }
@@ -97,6 +92,9 @@ export default {
this.$message.destroy() this.$message.destroy()
// 207M.doc文件大小超出100MB限制, 请压缩或降低文件质量! // 207M.doc文件大小超出100MB限制, 请压缩或降低文件质量!
this.errorMessage = file.name + '文件大小超出500MB限制, 请压缩或降低文件质量!' this.errorMessage = file.name + '文件大小超出500MB限制, 请压缩或降低文件质量!'
} else {
this.$message.warning('文件格式不正确,请上传' + this.accept + '文件')
this.fileTypeSatus = false
} }
}, },
remove () { remove () {
@@ -131,7 +131,7 @@ export default {
disabled: false, disabled: false,
titleImg: this.$t('uploadPictures'), titleImg: this.$t('uploadPictures'),
listType: 'picture', listType: 'picture',
accept: 'image/*', accept: '.png,.jpg,.jpeg,.gif',
// 表格行列相关数据 // 表格行列相关数据
rowColForm: {}, rowColForm: {},
validatorRowColRules: { validatorRowColRules: {