fix: 2027 新购机具验收时,上传的验收图片较大时,立即点击确定按钮会提示“验收图片不能为空”,稍等片刻后会提示接口请求超时
This commit is contained in:
parent
6a6459eadd
commit
adb0dc355d
|
|
@ -257,6 +257,7 @@
|
|||
:class="{ disabled: uploadDisabled }"
|
||||
:on-preview="handlePictureCardPreview"
|
||||
:on-remove="handleRemove"
|
||||
:before-upload="beforeUpload"
|
||||
>
|
||||
<!-- <img v-if="imageUrl" :src="uploadUrl+imageUrl" style="width: 140px;height: 140px;" class="avatar"> -->
|
||||
<i class="el-icon-plus avatar-uploader-icon"></i>
|
||||
|
|
@ -300,6 +301,7 @@
|
|||
:on-preview="handlePictureCardPreview"
|
||||
:class="{ disabled: uploadDisabled }"
|
||||
:on-remove="handleRemove"
|
||||
:before-upload="beforeUpload"
|
||||
>
|
||||
<!-- <img v-if="imageUrl" :src="uploadUrl+imageUrl" style="width: 140px;height: 140px;" class="avatar"> -->
|
||||
<i class="el-icon-plus avatar-uploader-icon"></i>
|
||||
|
|
@ -1020,6 +1022,14 @@ export default {
|
|||
this.$store.dispatch('dict/cleanDict')
|
||||
})
|
||||
},
|
||||
// 图片上传前校验 限制图片大小
|
||||
beforeUpload(file) {
|
||||
const isLt5M = file.size / 1024 / 1024 < 5
|
||||
if (!isLt5M) {
|
||||
this.$message.error('上传图片大小不能超过 5MB!')
|
||||
}
|
||||
return isLt5M
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue