zhujindu vor 1 Jahr
Ursprung
Commit
7875704864
1 geänderte Dateien mit 23 neuen und 6 gelöschten Zeilen
  1. 23 6
      src/components/uploadImgVStore.vue

+ 23 - 6
src/components/uploadImgVStore.vue

@@ -161,15 +161,14 @@ export default {
       }
       // loading
       uploadImagev(form).then((res) => {
-        if (res.code == 200) {
+        if (res.code == -1) {
+          // 图匠图片校验接口超时
+          this.requestTimeOut();
+        } else if (res.code == 200) {
           // 图匠校验结果返回
           if (this.photoIdentifyType) {
             this.imageAIVerifyFlag = true;
-            // 清楚loaidng状态
-            this.percentage = 100;
-            clearInterval(this.timeFlag);
-            this.progressFlag = false;
-            this.percentage = 0;
+            this.resetProgress();
           } else {
             // 正常流程
             let imgArr = [];
@@ -186,6 +185,7 @@ export default {
       });
     },
     progress() {
+      // 后端接口20000ms后失效,每1000m progress加10,到90停止;
       this.progressFlag = true;
       this.percentage = 10;
       this.timeFlag = setInterval(() => {
@@ -193,6 +193,23 @@ export default {
         this.percentage = this.percentage + 10;
       }, 1000);
     },
+    requestTimeOut() {
+      this.resetProgress();
+      this.$dialog
+        .confirm({
+          title: '系统提示',
+          message: '网络原因导致图像未被识别,暂时允许提交',
+          showCancelButton: false,
+        })
+        .then(() => {});
+    },
+    // 重置loaidng状态
+    resetProgress() {
+      this.percentage = 100;
+      clearInterval(this.timeFlag);
+      this.progressFlag = false;
+      this.percentage = 0;
+    },
   },
 };
 </script>