Browse Source

Merge branch 'feature_20250811_拜访拍照任务连拍' into uat(dev)

zhujindu 3 months ago
parent
commit
ddb031f18c
1 changed files with 48 additions and 27 deletions
  1. 48 27
      src/components/uploadVNormal.vue

+ 48 - 27
src/components/uploadVNormal.vue

@@ -157,6 +157,7 @@ export default {
       fileUrl: '',
       fileUrl: '',
       imageWhiteStoreData: null,
       imageWhiteStoreData: null,
       imageWhiteStoreFlag: false,
       imageWhiteStoreFlag: false,
+      localIdsArr: [],
     };
     };
   },
   },
   methods: {
   methods: {
@@ -210,7 +211,7 @@ export default {
       let that = this;
       let that = this;
       let wx = this.wx;
       let wx = this.wx;
       let qiyeData;
       let qiyeData;
-      let addressesRemark = '';
+      this.addressesRemark = '';
       const instance = axios.create();
       const instance = axios.create();
       instance.defaults.headers.common['userId'] = localStorage.getItem('loginName');
       instance.defaults.headers.common['userId'] = localStorage.getItem('loginName');
       instance
       instance
@@ -246,10 +247,10 @@ export default {
                   geocoder.getAddress({ location: location }).then(
                   geocoder.getAddress({ location: location }).then(
                     function (result) {
                     function (result) {
                       var addresses = result.result.formatted_addresses;
                       var addresses = result.result.formatted_addresses;
-                      addressesRemark = addresses.recommend;
+                      that.addressesRemark = addresses.recommend;
                     },
                     },
                     function (err) {
                     function (err) {
-                      addressesRemark = '';
+                      that.addressesRemark = '';
                     }
                     }
                   );
                   );
                 },
                 },
@@ -274,31 +275,49 @@ export default {
                 defaultCameraMode: 'normal',
                 defaultCameraMode: 'normal',
                 isSaveToAlbum: 0,
                 isSaveToAlbum: 0,
                 success: function (res) {
                 success: function (res) {
-                  var localIds = '';
-                  if (res.localIds != undefined) {
-                    localIds = res.localIds[0];
-                  } else {
-                    localIds = res.localId;
-                  }
-                  wx.uploadImage({
-                    localId: localIds, // 需要上传的图片的本地ID,由chooseImage接口获得
-                    isShowProgressTips: 0, // 默认为1,显示进度提示
-                    success: function (res) {
-                      that.mediaId = res.serverId;
-                      that.uploadImagev(addressesRemark);
-                    },
-                    fail: (err) => {
-                      that.$toast(err.errMsg);
-                      that.$toast(err.errCode);
-                    },
-                  });
+                  let localIds = res.localIds;
+                  that.localIdsArr = [];
+                  that.syncUpload(localIds);
+                  // var localIds = '';
+                  // if (res.localIds != undefined) {
+                  //   localIds = res.localIds[0];
+                  // } else {
+                  //   localIds = res.localId;
+                  // }
+                  // wx.uploadImage({
+                  //   localId: localIds, // 需要上传的图片的本地ID,由chooseImage接口获得
+                  //   isShowProgressTips: 0, // 默认为1,显示进度提示
+                  //   success: function (res) {
+                  //     that.mediaId = res.serverId;
+                  //     that.uploadImagev(addressesRemark);
+                  //   },
+                  //   fail: (err) => {
+                  //     that.$toast(err.errMsg);
+                  //     that.$toast(err.errCode);
+                  //   },
+                  // });
                 },
                 },
               });
               });
             });
             });
           }
           }
         });
         });
     },
     },
-    uploadImagev(addressesRemark = '') {
+    syncUpload(localIds) {
+      if (!localIds.length) {
+        this.uploadImagev();
+      } else {
+        var localId = localIds.pop();
+        wx.uploadImage({
+          localId: localId,
+          isShowProgressTips: 1, // 默认为1,显示进度提示
+          success: (res) => {
+            this.localIdsArr.push(res.serverId);
+            this.syncUpload(localIds);
+          },
+        });
+      }
+    },
+    uploadImagev() {
       // 初始化重置 图匠校验
       // 初始化重置 图匠校验
       this.resetProgress();
       this.resetProgress();
       this.close();
       this.close();
@@ -323,7 +342,6 @@ export default {
       if (that.thirdCollectionId != null && that.thirdCollectionId != 'null') {
       if (that.thirdCollectionId != null && that.thirdCollectionId != 'null') {
         thirdCollectionId = that.thirdCollectionId;
         thirdCollectionId = that.thirdCollectionId;
       }
       }
-      this.addressesRemark = addressesRemark;
       var form = {
       var form = {
         mediaId: '',
         mediaId: '',
         fileUrl: '',
         fileUrl: '',
@@ -334,7 +352,7 @@ export default {
         visitsId: localStorage.getItem('visitId'),
         visitsId: localStorage.getItem('visitId'),
         visitModel: that.visitModel,
         visitModel: that.visitModel,
         visitSource: '1',
         visitSource: '1',
-        locationRemark: addressesRemark,
+        locationRemark: that.addressesRemark,
         parentCollectionId: parentCollectionId,
         parentCollectionId: parentCollectionId,
         secondCollectionId: secondCollectionId,
         secondCollectionId: secondCollectionId,
         firstCollectionId: firstCollectionId,
         firstCollectionId: firstCollectionId,
@@ -345,13 +363,16 @@ export default {
       };
       };
       // 0=企业微信,1=H5相机
       // 0=企业微信,1=H5相机
       if (this.userInfo.photoMethod == '0') {
       if (this.userInfo.photoMethod == '0') {
-        form.mediaId = this.mediaId; //	string	图片素材id
+        form.mediaId = this.localIdsArr; //	string	图片素材id
       } else {
       } else {
         form.fileUrl = this.fileUrl; //	string	图片素材id
         form.fileUrl = this.fileUrl; //	string	图片素材id
       }
       }
       this.controller = null;
       this.controller = null;
       // 需要图匠校验的添加参数和loading
       // 需要图匠校验的添加参数和loading
-      if (this.photoIdentifyType && this.photoIdentifyType != '6') {
+      if (
+        this.photoIdentifyType &&
+        (this.photoIdentifyType == '1' || this.photoIdentifyType == '3')
+      ) {
         form.photoIdentifyType = this.photoIdentifyType;
         form.photoIdentifyType = this.photoIdentifyType;
         this.progress();
         this.progress();
         this.controller = new AbortController(); //取消请求
         this.controller = new AbortController(); //取消请求
@@ -455,7 +476,7 @@ export default {
         };
         };
         // 0=企业微信,1=H5相机
         // 0=企业微信,1=H5相机
         if (this.userInfo.photoMethod == '0') {
         if (this.userInfo.photoMethod == '0') {
-          form.mediaId = this.mediaId; //	string	图片素材id
+          form.mediaId = this.localIdsArr; //	string	图片素材id
         } else {
         } else {
           form.fileUrl = this.fileUrl; //	string	图片素材id
           form.fileUrl = this.fileUrl; //	string	图片素材id
         }
         }