From 89e7ed902461f28d6a7dd3e6c927eaf40b154f5e Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期四, 15 八月 2024 10:12:07 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
wechat_staff/pages/download/index.js | 75 +++++++++++++++++++++++++++++++------
1 files changed, 62 insertions(+), 13 deletions(-)
diff --git a/wechat_staff/pages/download/index.js b/wechat_staff/pages/download/index.js
index aa5fd1e..2c3d458 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,25 @@
fail: res => {
item.paddingStatus = 4
item.checked = false
- that.setData({ downloadList })
+ that.setData({
+ downloadList
+ })
wx.showToast({
title: '淇濆瓨澶辫触',
icon: "none"
})
}
})
-
+
}
+ },
+ fail(err) {
+ wx.showToast({
+ title: '鍥剧墖涓嬭浇澶辫触',icon: 'none'
+ })
}
})
- })
+ }
}
})
})
@@ -128,12 +175,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