Commit ff9c1088 authored by 刘怀志's avatar 刘怀志

68383 兽医管理,上传证书图片问题

parent 0a97aad2
......@@ -208,14 +208,18 @@ export default {
const suffix = img === 'jpg' || img === 'png' || img === 'jpeg'
if (!suffix) {
this.$message.error('文件格式不正确, 请上传png/jpg/jpeg图片格式文件')
this.$refs.imageUpload.clearFiles()
// this.$refs.imageUpload.clearFiles()
const arrayLength = this.fileList.length
this.fileList = arrayLength > 0 ? [...this.fileList] : []
return false
}
if (this.fileSize) {
const isLt = file.size / 1024 / 1024 < this.fileSize
if (!isLt) {
this.$modal.msgError(`上传图片大小不能超过 ${this.fileSize} MB`)
this.$refs.imageUpload.clearFiles()
// this.$refs.imageUpload.clearFiles()
const arrayLength = this.fileList.length
this.fileList = arrayLength > 0 ? [...this.fileList] : []
return false
}
}
......@@ -223,7 +227,9 @@ export default {
console.log('nameTest', !nameTest.test(fileName))
if (!nameTest.test(fileName)) {
this.$modal.msgError('不能含有~!@#$^&()_+-[]{};\',.等特殊字符')
this.$refs.imageUpload.clearFiles()
// this.$refs.imageUpload.clearFiles()
const arrayLength = this.fileList.length
this.fileList = arrayLength > 0 ? [...this.fileList] : []
return false
}
// URL.createObjectURL的参数只能是blob或者file类型
......
......@@ -209,14 +209,18 @@ export default {
const suffix = img === 'jpg' || img === 'png' || img === 'jpeg'
if (!suffix) {
this.$message.error('文件格式不正确, 请上传png/jpg/jpeg图片格式文件')
this.$refs.imageUpload.clearFiles()
// this.$refs.imageUpload.clearFiles()
const arrayLength = this.fileList.length
this.fileList = arrayLength > 0 ? [...this.fileList] : []
return false
}
if (this.fileSize) {
const isLt = file.size / 1024 / 1024 < this.fileSize
if (!isLt) {
this.$modal.msgError(`上传图片大小不能超过 ${this.fileSize} MB`)
this.$refs.imageUpload.clearFiles()
// this.$refs.imageUpload.clearFiles()
const arrayLength = this.fileList.length
this.fileList = arrayLength > 0 ? [...this.fileList] : []
return false
}
}
......@@ -224,7 +228,9 @@ export default {
console.log('nameTest', !nameTest.test(fileName))
if (!nameTest.test(fileName)) {
this.$modal.msgError('不能含有~!@#$^&()_+-[]{};\',.等特殊字符')
this.$refs.imageUpload.clearFiles()
// this.$refs.imageUpload.clearFiles()
const arrayLength = this.fileList.length
this.fileList = arrayLength > 0 ? [...this.fileList] : []
return false
}
// URL.createObjectURL的参数只能是blob或者file类型
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment