Browse Source

图像识别

zhujindu 1 year ago
parent
commit
43dfc5abfa
3 changed files with 29 additions and 15 deletions
  1. 25 14
      src/components/uploadImgVStore.vue
  2. 3 0
      src/utils/request.js
  3. 1 1
      src/views/storeManagement/storeAdd.vue

+ 25 - 14
src/components/uploadImgVStore.vue

@@ -20,7 +20,7 @@
     <div class="mask" v-if="progressFlag">
     <div class="mask" v-if="progressFlag">
       <el-progress type="circle" :percentage="percentage"></el-progress>
       <el-progress type="circle" :percentage="percentage"></el-progress>
     </div>
     </div>
-    <!-- <imageAIVerifyErr></imageAIVerifyErr> -->
+    <imageAIVerifyErr v-if="imageAIVerifyFlag"></imageAIVerifyErr>
   </div>
   </div>
 </template>
 </template>
 
 
@@ -81,6 +81,7 @@ export default {
       progressFlag: false,
       progressFlag: false,
       percentage: 0,
       percentage: 0,
       timeFlag: null,
       timeFlag: null,
+      imageAIVerifyFlag: false,
     };
     };
   },
   },
   watch: {
   watch: {
@@ -153,22 +154,32 @@ export default {
         message: '上传中...',
         message: '上传中...',
         forbidClick: true,
         forbidClick: true,
       });
       });
+      // 需要图匠校验的添加参数和loading
+      if (this.photoIdentifyType) {
+        form.photoIdentifyType = this.photoIdentifyType;
+        this.progress();
+      }
       // loading
       // loading
-      this.progress();
       uploadImagev(form).then((res) => {
       uploadImagev(form).then((res) => {
         if (res.code == 200) {
         if (res.code == 200) {
-          // that.imgArr = res.data.url;
-          let imgArr = [];
-          res.data.forEach((item) => {
-            imgArr.push(item.url);
-          });
-          loind1.clear();
-          this.percentage = 100;
-          clearInterval(this.timeFlag);
-          this.progressFlag = false;
-          this.percentage = 0;
-          that.$toast('上传成功!');
-          that.$emit('newimgarr', { fileUrl: imgArr.join(','), type: that.type });
+          // 图匠校验结果返回
+          if (this.photoIdentifyType) {
+            this.imageAIVerifyFlag = true;
+            // 清楚loaidng状态
+            this.percentage = 100;
+            clearInterval(this.timeFlag);
+            this.progressFlag = false;
+            this.percentage = 0;
+          } else {
+            // 正常流程
+            let imgArr = [];
+            res.data.forEach((item) => {
+              imgArr.push(item.url);
+            });
+            loind1.clear();
+            that.$toast('上传成功!');
+            that.$emit('newimgarr', { fileUrl: imgArr.join(','), type: that.type });
+          }
         } else {
         } else {
           that.$toast('上传失败!');
           that.$toast('上传失败!');
         }
         }

+ 3 - 0
src/utils/request.js

@@ -39,6 +39,9 @@ service.interceptors.response.use(
       //     duration:5000
       //     duration:5000
       // });
       // });
       return res.data;
       return res.data;
+    } else if (code == -1) {
+      // 图匠图片校验接口超时
+      return res.data;
     } else if (code !== 200) {
     } else if (code !== 200) {
       Toast({
       Toast({
         message: msg,
         message: msg,

+ 1 - 1
src/views/storeManagement/storeAdd.vue

@@ -293,7 +293,7 @@
                         :imgArr="fromValue.img"
                         :imgArr="fromValue.img"
                         @newimgarr="newimgarr1"
                         @newimgarr="newimgarr1"
                         :imgText="fromValue.ifJzStoreType != 1 ? '门店照' : '家装前台照片'"
                         :imgText="fromValue.ifJzStoreType != 1 ? '门店照' : '家装前台照片'"
-                        :photoIdentifyType="fromValue.ifJzStoreType != 1 ? 'dz' : ''"
+                        :photoIdentifyType="fromValue.ifJzStoreType != 1 ? '1' : ''"
                         :type="1"></upload-img>
                         :type="1"></upload-img>
                     </div>
                     </div>
                   </van-col>
                   </van-col>