Browse Source

二维码管理循环展示数据

qymljy 2 months ago
parent
commit
68e23992c3
2 changed files with 17 additions and 7 deletions
  1. 15 5
      public/codeToFile.html
  2. 2 2
      src/HDrpManagement/codeManage/index.vue

+ 15 - 5
public/codeToFile.html

@@ -54,7 +54,6 @@
         </div>
         <div class="margin-style" id="dataContainer"></div>
         <script>
-            let dataList = []
             window.onload = async function(){
                 var loc=location.href;
                 var n1=loc.length;
@@ -93,18 +92,29 @@
                             iconSrc = './img/default.svg';
                         }
                         div.innerHTML = `
-                    <div class="div-border" >
-                        <img src="${iconSrc}" class="img-style">
-                        <div class="content-style">${item.remarks}</div>
-                    </div>
+                            <div class="div-border" >
+                                <img src="${iconSrc}" class="img-style">
+                                <div class="content-style">${item.remarks}</div>
+                            </div>
                 `;
                         dataContainer.appendChild(div);
+                        div.addEventListener('click', function() {
+                            console.log(item.attinfos[0].url)
+                            downloadFile(item.attinfos[0].url)
+                        });
                     })
                 })
                 .catch(function (error) {
                     console.log(error);
                 });
             }
+            function downloadFile(fileUrl, fileType){
+                const link = document.createElement('a');
+                link.href = fileUrl
+                document.body.appendChild(link);
+                link.click();
+                document.body.removeChild(link);
+            }
         </script>
     </body>
 </html>

+ 2 - 2
src/HDrpManagement/codeManage/index.vue

@@ -45,8 +45,8 @@ export default {
   data(){
     return {
       dialogVisible:false,
-      // url:'http://61.164.207.46:8000/yosweb/codeToFile.html',
-      url:'http://192.168.3.146:8000/yosweb/codeToFile.html',
+      url:'http://61.164.207.46:8000/yosweb/codeToFile.html',
+      // url:'http://192.168.3.146:8000/yosweb/codeToFile.html',
       bigUrl:''
     }
   },