// 授权
wx.authorize({
scope: 'scope.writePhotosAlbum',
success(res) {
// 用户已经同意
console.log(res);
wx.saveImageToPhotosAlbum({
filePath: that.data.RQImg,
success: function (res) {
console.log(res);
},
fail: function (res) {
console.log()
console.log(res);
}
})
},
fail: function (res) {
console.log("图片获取失败");
wx.showModal({
title: '提示',
content: '若不微信授权,将无法保存图片,点击取消可重新获取授权',
success: function (res) {
if (res.confirm) {
console.log('用户点击确定');
} else if (res.cancel) {
console.log('用户点击取消');
wx.openSetting({
success: function (res) {
if (!res.authSetting["scope.writePhotosAlbum"]) {
//这里是授权成功之后 填写你重新获取数据的js
that().Menu();
}
}
})
}
}
})
},
})