// 保存图片
saveImg() {
wx.downloadFile({
url: 'https://........',
success: function (res) {
console.log(res)
wx.saveImageToPhotosAlbum({ //视频 替换 wx.saveVideoToPhotosAlbum
filePath: res.tempFilePath,
success: function (res) {
wx.showToast({
title: '保存成功!',
icon: 'none',
duration: 1500
})
},
fail: function (err) {
if (err.errMsg === "saveImageToPhotosAlbum:fail auth deny") {
wx.showModal({
title: '提示',
content: '请先开启“保存到相册”功能',
success(res) {
if (res.confirm) {
wx.openSetting();
}
}
})
}
}
})
},
fail: function (err) {
wx.showToast({
title: '保存失败, 请重试!',
icon: 'none',
duration: 1500
})
}
})
},