Bläddra i källkod

修复修改功能

yin_yu820 2 år sedan
förälder
incheckning
a461afe863
2 ändrade filer med 37 tillägg och 5 borttagningar
  1. 3 1
      src/utils/config.js
  2. 34 4
      src/views/activityMan/siteInspection/siteInspectionInfo.vue

+ 3 - 1
src/utils/config.js

@@ -4,7 +4,9 @@ if (process.env.NODE_ENV === 'development') {
     // 开发环境
     //APP_SERVER_URL = 'http://192.168.139.110:8084'
     //APP_SERVER_URL = 'http://192.168.139.74:8080'
-    APP_SERVER_URL = 'http://localhost:8084'
+    APP_SERVER_URL = 'http://192.168.139.77:8084'
+    //APP_SERVER_URL = 'http://localhost:8084'
+    
 } else {
     // 生产环境
     APP_SERVER_URL = 'http://123.57.226.179:8010/hs'

+ 34 - 4
src/views/activityMan/siteInspection/siteInspectionInfo.vue

@@ -70,6 +70,7 @@
               :max-count="fileList.length"
               capture="camera"
               accept=""
+              @click-preview="downHandle"
             >
             </van-uploader>
           </template>
@@ -124,17 +125,45 @@
           info.value.enclosure.split("|").forEach((item) => {
             console.log(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 = () => {
@@ -155,6 +184,7 @@
         onClickLeft,
         info,
         fileList,
+        downHandle,
         isLoading,
         update,
       };