lll
liukangdong
2024-08-01 e6e0218a1abd7395d00ade401c6ea6a02e7c3ece
wechat_staff/pages/download/index.js
@@ -42,16 +42,54 @@
          item.paddingStatus = 2
        }
      })
      this.setData({ downloadList })
      this.setData({
        downloadList
      })
      downloadList.forEach(item => {
        if (item.checked) {
          getContentShareImg({
            articleId: `${downloadConfig.id}_${downloadConfig.path}`,
            type: this.takeQrcode ? 0 : 1,
            imgurl: item.url
          }).then(res => {
          if (that.data.takeQrcode == 1) {
            getContentShareImg({
              articleId: `${downloadConfig.id}_${downloadConfig.path}`,
              type: that.data.takeQrcode ? 1 : 0,
              imgurl: item.url
            }).then(res => {
              wx.downloadFile({
                url: res.data,
                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"
                        })
                      }
                    })
                  }
                }
              })
            })
          }else{
            wx.downloadFile({
              url: res.data,
              url: item.url,
              success: res => {
                if (res.statusCode === 200) {
                  wx.saveImageToPhotosAlbum({
@@ -59,7 +97,9 @@
                    success: res => {
                      item.paddingStatus = 3
                      item.checked = false
                      that.setData({ downloadList })
                      that.setData({
                        downloadList
                      })
                      wx.showToast({
                        title: '保存成功',
                        icon: "none"
@@ -68,18 +108,20 @@
                    fail: res => {
                      item.paddingStatus = 4
                      item.checked = false
                      that.setData({ downloadList })
                      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) {