|
@@ -40,7 +40,6 @@
|
|
|
<van-uploader
|
|
<van-uploader
|
|
|
v-model="uploadImages"
|
|
v-model="uploadImages"
|
|
|
:max-count="1"
|
|
:max-count="1"
|
|
|
- :max-size="2 * 1024 * 1024"
|
|
|
|
|
:before-read="beforeReadImage"
|
|
:before-read="beforeReadImage"
|
|
|
:after-read="afterReadImage"
|
|
:after-read="afterReadImage"
|
|
|
preview-full-image
|
|
preview-full-image
|
|
@@ -109,11 +108,7 @@ const beforeReadImage = (file) => {
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 检查文件大小 (2MB)
|
|
|
|
|
- if (f.size > 2 * 1024 * 1024) {
|
|
|
|
|
- showFailToast('图片大小不能超过2MB')
|
|
|
|
|
- return false
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
return true
|
|
return true
|
|
|
}
|
|
}
|
|
@@ -184,11 +179,17 @@ const submitOCR = async () => {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 检查图片大小是否超过2MB
|
|
|
|
|
+ const image = uploadImages.value[0]
|
|
|
|
|
+ if (image.file.size > 2 * 1024 * 1024) {
|
|
|
|
|
+ showFailToast('图片大小不能超过2MB')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
uploading.value = true
|
|
uploading.value = true
|
|
|
const toast = showLoadingToast('识别中...')
|
|
const toast = showLoadingToast('识别中...')
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- const image = uploadImages.value[0]
|
|
|
|
|
const formData = new FormData()
|
|
const formData = new FormData()
|
|
|
formData.append('file', image.file)
|
|
formData.append('file', image.file)
|
|
|
formData.append('warehouse', warehouse)
|
|
formData.append('warehouse', warehouse)
|