lisongyi il y a 5 mois
Parent
commit
662c0bf57b
2 fichiers modifiés avec 9 ajouts et 8 suppressions
  1. 1 1
      src/static/setting.txt
  2. 8 7
      src/views/inbound/photoOCR/index.vue

+ 1 - 1
src/static/setting.txt

@@ -1 +1 @@
-72
+74

+ 8 - 7
src/views/inbound/photoOCR/index.vue

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