Kaynağa Gözat

feature_20260330_拜访连拍速度优化

zhujindu 3 gün önce
ebeveyn
işleme
02d1b56968
1 değiştirilmiş dosya ile 39 ekleme ve 46 silme
  1. 39 46
      src/components/deleteUploadImgTaskPhoto.vue

+ 39 - 46
src/components/deleteUploadImgTaskPhoto.vue

@@ -26,7 +26,11 @@
             name="close"
             size="16"
             v-on:click="deleteImg(index, urls)" />
-          <img :src="urls.fileUrl" width="100px" height="100px" @click="previewsImg(index)" />
+          <img
+            :src="urls.fileUrl || urls.mediaFileUrl"
+            width="100px"
+            height="100px"
+            @click="previewsImg(index)" />
           <!-- <img
             v-else
             :src="urls.fileUrl"
@@ -115,7 +119,7 @@ export default {
       handler(val) {
         // <!-- 0=企业微信,1=H5相机 -->
         if (this.userInfo.photoMethod == '1') {
-          this.imgArr = this.formData.fileInfoList || [];
+          this.imgArr = this.fileInfoList || [];
         } else {
           this.imgArr = [];
           if (this.formData.mediaInfos) {
@@ -130,22 +134,6 @@ export default {
       immediate: true,
     },
   },
-  activated() {
-    // 授权
-    // getTicketFun(['downloadImage']).then(() => {
-    //   this.imgArr = [];
-    //   // <!-- 0=企业微信,1=H5相机 -->
-    //   if (this.formData) {
-    //     if (this.userInfo.photoMethod == '1') {
-    //       this.imgArr = this.formData.collectionItemList[0].fileInfoList || [];
-    //     } else {
-    //       if (this.formData.mediaInfos) {
-    //         this.downloadImage(this.formData.mediaInfos);
-    //       }
-    //     }
-    //   }
-    // });
-  },
   data() {
     return {
       url: process.env.VUE_APP_Target1 + process.env.VUE_APP_BASE_API,
@@ -162,34 +150,39 @@ export default {
         return;
       } else {
         let mediaitem = mediaInfos.pop();
-        wx.downloadImage({
-          serverId: mediaitem.mediaId,
-          isShowProgressTips: 0, // 默认为1,显示进度提示
-          success: (res) => {
-            wx.getLocalImgData({
-              localId: res.localId,
-              success: (res2) => {
-                this.imgArr.push({
-                  mediaId: mediaitem.mediaId,
-                  fileUrl: res2.localData,
-                });
-                this.downloadImage(mediaInfos);
-              },
-              fail: (err) => {
-                console.error('获取本地图片数据失败:', err);
-                this.$toast('获取图片数据失败');
-                this.toastLoading().clear();
-                this.downloadImage(mediaInfos);
-              },
-            });
-          },
-          fail: (err) => {
-            console.error('下载图片失败:', err);
-            this.$toast('下载图片失败,请重试');
-            // 可以选择继续下载其他图片或停止
-            this.downloadImage(mediaInfos);
-          },
-        });
+        if (mediaitem.fileUrl) {
+          this.imgArr.push(mediaitem);
+          return;
+        } else {
+          wx.downloadImage({
+            serverId: mediaitem.mediaId,
+            isShowProgressTips: 0, // 默认为1,显示进度提示
+            success: (res) => {
+              wx.getLocalImgData({
+                localId: res.localId,
+                success: (res2) => {
+                  this.imgArr.push({
+                    mediaId: mediaitem.mediaId,
+                    mediaFileUrl: res2.localData,
+                  });
+                  this.downloadImage(mediaInfos);
+                },
+                fail: (err) => {
+                  console.error('获取本地图片数据失败:', err);
+                  this.$toast('获取图片数据失败');
+                  this.toastLoading().clear();
+                  this.downloadImage(mediaInfos);
+                },
+              });
+            },
+            fail: (err) => {
+              console.error('下载图片失败:', err);
+              this.$toast('下载图片失败,请重试');
+              // 可以选择继续下载其他图片或停止
+              this.downloadImage(mediaInfos);
+            },
+          });
+        }
       }
     },
     deleteImg(index, urls) {