getAuthorAdmin(){
let that = this;
wx.getSetting({
success(res) {
if (res.authSetting['scope.writePhotosAlbum']) {
//保存相册的逻辑
} else if (res.authSetting['scope.writePhotosAlbum'] === undefined) {
wx.showToast({
title: '请打开添加到相册',
icon:"none"
})
wx.authorize({
scope: 'scope.writePhotosAlbum',
success() {
//保存相册的逻辑
},
fail(){
wx.showToast({
title: '您未授权,无法保存到相册',
icon: 'none'
})
}
})
}else {
wx.showToast({
title: '请打开添加到相册',
icon:"none"
})
wx.openSetting({
success(res) {
if (res.authSetting['scope.writePhotosAlbum']) {
//保存相册的逻辑
}else{
wx.showToast({
title:'您未授权,无法保存到相册',
icon:'none'
})
}
}
})
}
}
})
},
微信小程序提示用户授权相册权限
最新推荐文章于 2024-06-19 16:05:43 发布