Bläddra i källkod

修复修改功能

yin_yu820 2 år sedan
förälder
incheckning
4c31ba16f9

+ 29 - 2
src/views/activityMan/securityFacilitiesErr/securityFacilitiesErrInfo.vue

@@ -80,6 +80,7 @@
                 :max-count="fileList.length"
                 capture="camera"
                 accept=""
+                @click-preview="downHandle"
               >
               </van-uploader>
             </template>
@@ -140,15 +141,40 @@
 
           info.value.enclosure.split("|").forEach((item) => {
             if (item.trim().length > 0) {
+              // fileList.value.push({
+              //   name: decodeURIComponent(item.substring(item.lastIndexOf("/") + 1)),
+              //   url: $base + item.replace('程序附件//','程序附件/'),
+              // });
+
               fileList.value.push({
-                name: decodeURIComponent(item.substring(item.lastIndexOf("/") + 1)),
-                url: $base + item.replace('程序附件//','程序附件/'),
+                file: {
+                  name: decodeURIComponent(
+                    item.substring(item.lastIndexOf("/") + 1)
+                  ),
+                },
+                url: $base + item.replace("程序附件//", "程序附件/"),
               });
             }
           });
           isLoading.value = false;
         });
       });
+      /**
+     * 下载文件 网页端可用
+     */
+      const downHandle = (fileObj) => {
+        if(!(fileObj.file.name.includes(".jpg")||fileObj.file.name.includes(".jpeg")||fileObj.file.name.includes(".png"))){
+          // 声明a标签
+          const aEle = document.createElement("a");
+          // 设置下载文件名
+          aEle.download = fileObj.file.name;
+          // 下载地址
+          aEle.href = fileObj.url;
+          // 调用下载
+          aEle.click();
+        }
+        
+      };
 
       // 审核通过
       const update = () => {
@@ -169,6 +195,7 @@
         onClickLeft,
         info,
         fileList,
+        downHandle,
         isLoading,
         update,
       };