瀏覽代碼

图像识别

zhujindu 1 年之前
父節點
當前提交
a91cf19c8f
共有 2 個文件被更改,包括 47 次插入37 次删除
  1. 24 19
      src/components/uploadImgVStore.vue
  2. 23 18
      src/components/uploadVNormal.vue

+ 24 - 19
src/components/uploadImgVStore.vue

@@ -172,27 +172,32 @@ export default {
       } else {
         this.toastLoading(0, '上传中...', true);
       }
-      uploadImagev(form).then((res) => {
-        this.toastLoading().clear();
-        if (res.code == -1) {
-          // 图匠图片校验接口超时
-          this.requestTimeOut(res);
-        } else if (res.code == 200) {
-          // 图匠校验结果返回
-          if (this.photoIdentifyType) {
-            // 重置loaidng状态
-            this.resetProgress();
-            this.imageAIVerifyFlag = true;
-            console.log('res.data=' + JSON.stringify(res.data));
-            this.imageAIVerifyData = res.data;
+      uploadImagev(form)
+        .then((res) => {
+          this.toastLoading().clear();
+          if (res.code == -1) {
+            // 图匠图片校验接口超时
+            this.requestTimeOut(res);
+          } else if (res.code == 200) {
+            // 图匠校验结果返回
+            if (this.photoIdentifyType) {
+              // 重置loaidng状态
+              this.resetProgress();
+              this.imageAIVerifyFlag = true;
+              console.log('res.data=' + JSON.stringify(res.data));
+              this.imageAIVerifyData = res.data;
+            } else {
+              // 正常流程
+              this.normalFlow(res);
+            }
           } else {
-            // 正常流程
-            this.normalFlow(res);
+            this.resetProgress();
+            that.$toast('上传失败!');
           }
-        } else {
-          that.$toast('上传失败!');
-        }
-      });
+        })
+        .catch(() => {
+          this.resetProgress();
+        });
     },
     progress() {
       // 后端接口20000ms后失效,每1000m progress加10,到90停止;

+ 23 - 18
src/components/uploadVNormal.vue

@@ -268,26 +268,31 @@ export default {
       } else {
         this.toastLoading(0, '上传中...', true);
       }
-      addstorePhoto(form).then((res) => {
-        this.toastLoading().clear();
-        if (res.code == -1) {
-          // 图匠图片校验接口超时
-          this.requestTimeOut(res);
-        } else if (res.code == 200) {
-          // 图匠校验结果返回
-          if (this.photoIdentifyType) {
-            // 重置loaidng状态
-            this.resetProgress();
-            this.imageAIVerifyFlag = true;
-            this.imageAIVerifyData = res.data;
+      addstorePhoto(form)
+        .then((res) => {
+          this.toastLoading().clear();
+          if (res.code == -1) {
+            // 图匠图片校验接口超时
+            this.requestTimeOut(res);
+          } else if (res.code == 200) {
+            // 图匠校验结果返回
+            if (this.photoIdentifyType) {
+              // 重置loaidng状态
+              this.resetProgress();
+              this.imageAIVerifyFlag = true;
+              this.imageAIVerifyData = res.data;
+            } else {
+              // 正常流程
+              this.normalFlow(res);
+            }
           } else {
-            // 正常流程
-            this.normalFlow(res);
+            this.resetProgress();
+            that.$toast('上传失败!');
           }
-        } else {
-          that.$toast('上传失败!');
-        }
-      });
+        })
+        .catch(() => {
+          this.resetProgress();
+        });
     },
     // 正常流程
     normalFlow(res) {