| | |
| | | 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({ |
| | |
| | | success: res => { |
| | | item.paddingStatus = 3 |
| | | item.checked = false |
| | | that.setData({ downloadList }) |
| | | that.setData({ |
| | | downloadList |
| | | }) |
| | | wx.showToast({ |
| | | title: '保存成功', |
| | | icon: "none" |
| | |
| | | fail: res => { |
| | | item.paddingStatus = 4 |
| | | item.checked = false |
| | | that.setData({ downloadList }) |
| | | that.setData({ |
| | | downloadList |
| | | }) |
| | | wx.showToast({ |
| | | title: '保存失败', |
| | | icon: "none" |
| | |
| | | } |
| | | }) |
| | | }) |
| | | }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" |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | }) |
| | |
| | | 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) { |