ソースを参照

图片识别添加取消按钮

zhujindu 1 年間 前
コミット
3d6a171fc3
2 ファイル変更23 行追加40 行削除
  1. 18 39
      src/components/uploadVNormal.vue
  2. 5 1
      src/utils/request.js

+ 18 - 39
src/components/uploadVNormal.vue

@@ -11,7 +11,7 @@
         :show-text="true"
         :width="110"
         :format="format"></el-progress>
-      <div class="progressClose" @progressClose="progressClose">取消</div>
+      <div class="progressClose" @click="progressClose">取消</div>
     </div>
     <imageAIVerifyErr
       v-if="imageAIVerifyFlag"
@@ -244,43 +244,23 @@ export default {
       }
       this.meidaId = meidaId;
       this.addressesRemark = addressesRemark;
-      // var form = {
-      //   mediaId: meidaId,
-      //   collectionItemId: that.collectionId,
-      //   objectType: that.objectType,
-      //   storeGroupId: that.storeGroupId,
-      //   taskId: that.taskId,
-      //   visitsId: localStorage.getItem('visitId'),
-      //   visitModel: that.visitModel,
-      //   visitSource: '1',
-      //   locationRemark: addressesRemark,
-      //   parentCollectionId: parentCollectionId,
-      //   secondCollectionId: secondCollectionId,
-      //   firstCollectionId: firstCollectionId,
-      //   fourthCollectionId: fourthCollectionId,
-      //   thirdCollectionId: thirdCollectionId,
-      //   deviceCode: that.deviceCode, //设备编号
-      //   putInCode: that.putInCode, //投放编号
-      // };
       var form = {
-        mediaId:
-          '3Ym3Ar_cKnYOwQc2pmIawrXn52u4isqyU3AP3eUP_tt37WjC_emMpLIo8TY25wmMkQqZrV1oBGsAck6T0H6jA1A',
-        collectionItemId: '2459',
-        objectType: 'rw-mdz',
-        storeGroupId: '490,486,482,353,340',
-        taskId: '487',
-        visitsId: '5846476',
-        visitModel: '1',
+        mediaId: meidaId,
+        collectionItemId: that.collectionId,
+        objectType: that.objectType,
+        storeGroupId: that.storeGroupId,
+        taskId: that.taskId,
+        visitsId: localStorage.getItem('visitId'),
+        visitModel: that.visitModel,
         visitSource: '1',
-        locationRemark: '洛龙区正大国际中心西座(金城寨街东50米)',
-        parentCollectionId: null,
-        secondCollectionId: null,
-        firstCollectionId: null,
-        fourthCollectionId: null,
-        thirdCollectionId: null,
-        deviceCode: '',
-        putInCode: '',
-        photoIdentifyType: '1',
+        locationRemark: addressesRemark,
+        parentCollectionId: parentCollectionId,
+        secondCollectionId: secondCollectionId,
+        firstCollectionId: firstCollectionId,
+        fourthCollectionId: fourthCollectionId,
+        thirdCollectionId: thirdCollectionId,
+        deviceCode: that.deviceCode, //设备编号
+        putInCode: that.putInCode, //投放编号
       };
       this.controller = null;
       // 需要图匠校验的添加参数和loading
@@ -314,10 +294,9 @@ export default {
           }
         })
         .catch((error) => {
-          if (error.name === 'AbortError') {
+          if (error.message === 'canceled') {
+            this.$toast('取消上传');
             console.log('请求被取消:', error.message);
-          } else {
-            console.error('请求失败:', error);
           }
           this.resetProgress();
         });

+ 5 - 1
src/utils/request.js

@@ -61,7 +61,11 @@ service.interceptors.response.use(
     } else if (message.includes('Request failed with status code')) {
       message = '系统接口' + message.substr(message.length - 3) + '异常';
     }
-    Toast(message);
+    if (error.message === 'canceled') {
+      console.log('请求被取消:', error.message);
+    } else {
+      Toast(message);
+    }
     return Promise.reject(error);
   }
 );