From e6e0218a1abd7395d00ade401c6ea6a02e7c3ece Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期四, 01 八月 2024 18:20:28 +0800
Subject: [PATCH] lll
---
wechat_staff/pages/download/index.js | 70 ++++++++++++++++++++++++++++------
1 files changed, 57 insertions(+), 13 deletions(-)
diff --git a/wechat_staff/pages/download/index.js b/wechat_staff/pages/download/index.js
index aa5fd1e..dff5661 100644
--- a/wechat_staff/pages/download/index.js
+++ b/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) {
--
Gitblit v1.9.3