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

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

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