From 8ab86de45b9ddf1ebde415f262f4b40727f53989 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期四, 25 七月 2024 10:18:07 +0800
Subject: [PATCH] ''

---
 wechat_staff/pages/download/index.js |   76 ++++++++++++++++++++++++++++++--------
 1 files changed, 60 insertions(+), 16 deletions(-)

diff --git a/wechat_staff/pages/download/index.js b/wechat_staff/pages/download/index.js
index e1c090c..c6066ce 100644
--- a/wechat_staff/pages/download/index.js
+++ b/wechat_staff/pages/download/index.js
@@ -7,7 +7,11 @@
    * 椤甸潰鐨勫垵濮嬫暟鎹�
    */
   data: {
-    bottomLift: ''
+    bottomLift: '',
+    downloadList: [],
+    checkedAll: false,
+    showParam: false,
+    takeQrcode: true
   },
 
   /**
@@ -19,25 +23,65 @@
       bottomLift: app.bottomLift
     })
   },
-
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
-   */
-  onReady() {
-  },
-
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
-   */
   onShow() {
-    eventBus.on('batchDown', val => {
-      console.log('val', val);
+    const downloadList = wx.getStorageSync('downloadList') || []
+    let temp = downloadList.map(i => {
+      // paddingStatus锛� 0鏈笅杞�1姝e湪涓嬭浇2绛夊緟涓嬭浇3涓嬭浇瀹屾垚
+      return {
+        url: i,
+        paddingStatus: 0,
+        checked: false
+      }
     })
+    this.setData({ downloadList: temp })
+    setTimeout(() => {
+      wx.setStorageSync('downloadList', [])
+    },500)
   },
+  openParam() {
+    const downloadList = this.data.downloadList.filter(i => i.checked)
+    if(downloadList.length === 0) return wx.showToast({title: '璇峰厛閫夋嫨瑕佷笅杞界殑娴锋姤', icon: 'none'})
+    this.setData({ showParam: true })
+  },
+  onClose() {
+    this.setData({ showParam: false })
+  },
+  downCheck(e) {
+    const takeQrcode = e.currentTarget.dataset.flag
+    console.log('takeQrcode', takeQrcode);
+    this.setData({ takeQrcode })
+  },
+  subDownload() {
+    const downloadList = this.data.downloadList
+    downloadList.forEach(item => {
+      if(item.checked){
+        
+      }
+    })
 
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌
-   */
+    this.setData({ showParam: false })
+  },
+  itemCheck(e) {
+    const i = e.currentTarget.dataset.i
+    const { downloadList, checkedAll } = this.data
+    let count = 0
+    downloadList.forEach((item, index) => {
+      if(index === i){
+        item.checked = !item.checked
+      }
+      if(item.checked) {
+        count ++
+      }
+    })
+    this.setData({ checkedAll: count == downloadList.length,  downloadList})
+  },
+  allCheck() {
+    const { downloadList, checkedAll } = this.data
+    downloadList.forEach(item => {
+      item.checked = !checkedAll
+    })
+    this.setData({ checkedAll: !checkedAll, downloadList })
+  },
   onHide() {
 
   },

--
Gitblit v1.9.3