lll
liukangdong
2024-08-01 e6e0218a1abd7395d00ade401c6ea6a02e7c3ece
wechat_staff/pages/download/index.js
@@ -42,12 +42,15 @@
          item.paddingStatus = 2
        }
      })
      this.setData({ downloadList })
      this.setData({
        downloadList
      })
      downloadList.forEach(item => {
        if (item.checked) {
          if (that.data.takeQrcode == 1) {
          getContentShareImg({
            articleId: `${downloadConfig.id}_${downloadConfig.path}`,
            type: this.takeQrcode ? 0 : 1,
              type: that.data.takeQrcode ? 1 : 0,
            imgurl: item.url
          }).then(res => {
            wx.downloadFile({
@@ -59,7 +62,9 @@
                    success: res => {
                      item.paddingStatus = 3
                      item.checked = false
                      that.setData({ downloadList })
                        that.setData({
                          downloadList
                        })
                      wx.showToast({
                        title: '保存成功',
                        icon: "none"
@@ -68,7 +73,9 @@
                    fail: res => {
                      item.paddingStatus = 4
                      item.checked = false
                      that.setData({ downloadList })
                        that.setData({
                          downloadList
                        })
                      wx.showToast({
                        title: '保存失败',
                        icon: "none"
@@ -80,6 +87,41 @@
              }
            })
          })
          }else{
            wx.downloadFile({
              url: item.url,
              success: res => {
                if (res.statusCode === 200) {
                  wx.saveImageToPhotosAlbum({
                    filePath: res.tempFilePath,
                    success: res => {
                      item.paddingStatus = 3
                      item.checked = false
                      that.setData({
                        downloadList
                      })
                      wx.showToast({
                        title: '保存成功',
                        icon: "none"
                      })
                    },
                    fail: res => {
                      item.paddingStatus = 4
                      item.checked = false
                      that.setData({
                        downloadList
                      })
                      wx.showToast({
                        title: '保存失败',
                        icon: "none"
                      })
                    }
                  })
                }
              }
            })
          }
        }
      })
    })
@@ -128,12 +170,14 @@
  itemCheck(e) {
    const i = e.currentTarget.dataset.i
    const {
      downloadList,
      checkedAll
      downloadList
    } = this.data
    let count = 0
    downloadList.forEach((item, index) => {
      if (index === i) {
        if (item.paddingStatus == 3) {
          item.paddingStatus = 0
        }
        item.checked = !item.checked
      }
      if (item.checked) {