savePic: function (e) {
console.log(’----’ + this.data.payQrCodeUrl)
// wx.canvasToTempFilePath({
wx.downloadFile({
url: this.data.payQrCodeUrl,
success: function (res) {
console.log(‘图片保存’ + JSON.stringify(res))
wx.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: function (res) {
console.log(res)
wx.showToast({
title: ‘图片保存成功’,
icon: ‘success’,
duration: 2000
})
},
fail: function (res) {
console.log(“用户拒绝–”+err);
if (err.errMsg === “saveImageToPhotosAlbum:fail auth deny”) {
console.log(“当初用户拒绝,再次发起授权”)
wx.openSetting({
success(settingdata) {
console.log("----settingdata----"+settingdata)
if (settingdata.authSetting[‘scope.writePhotosAlbum’]) {
console.log(‘获取权限成功,给出再次点击图片保存到相册的提示。’)
} else {
console.log(‘获取权限失败,给出不给权限就无法正常使用的提示’)
}
}
})
}
}
})
},
fail: function () {
console.log(‘fail’)
}
})
},
saveImageToPhotosAlbum保存图片,在打开调试的时候,可以保存,关闭调试就保存不了50/