xml:
<view class='btn download' bindtap="downloadphoto">
<image src='../../image/btn_1.png' mode="widthFix"></image>
<text>下载照片</text>
</view>
js:
主要先获取到图片地址:
downloadphoto: function (event) {
var that = this;
var url = that.data.imgurl;
console.log(that.data.imgurl)
// console.log(url)
//获取相册授权
wx.getSetting({
success(res) {
if (!res.authSetting['scope.writePhotosAlbum']) {
wx.authorize({
scope: 'scope.writePhotosAlbum',
success() { //这里是用户同意授权后的回调
that.saveImgToPhotosAlbumTap(url);
},
fail() { //这里是用户拒绝授权后的回调
that.setData({
saveImgBtnHidden: true,
openSettingBtnHidden: