Commit e1dec8d0 by 杨北旺

优化授权

1 parent 20ea01e7
......@@ -170,8 +170,11 @@ Component({
wx.$api.showToast('保存成功')
},
fail(err) {
const auth = _this.selectComponent('#auth')
auth.check()
if(err.errMsg=='saveImageToPhotosAlbum:fail auth deny'){
_this.triggerEvent('showAuth',true)
}
// const auth = _this.selectComponent('#auth')
// auth.check()
}
}
)
......
......@@ -140,11 +140,6 @@ Component({
// 分享活动(复制链接)
copyActivityUrl(e) {
wx.getSetting({
success: (res)=> {
if(res.authSetting['scope.writePhotosAlbum']===false){
this.triggerEvent('showAuth',true)
}else{
let { item } = e.currentTarget.dataset
let thisPage = wx.$router.getPageInstance()
wx.$api.showLoading()
......@@ -181,9 +176,6 @@ Component({
},
})
})
}
}
})
},
......
......@@ -217,6 +217,9 @@ Page({
*/
onShareAppMessage: function () {
},
authFail(){
},
toShowAuth(){
this.setData({
showAuth:true
......
......@@ -39,11 +39,13 @@
<!-- 预约安装弹窗 -->
<install-popup show="{{showPopup}}" data="{{installItem}}" bind:hidePopup="hidePopup"></install-popup>
<!-- 分享活动弹窗 -->
<share-popup data="{{sharePopupData}}"></share-popup>
<share-popup bind:showAuth="toShowAuth" data="{{sharePopupData}}"></share-popup>
<!-- <van-popup show="{{ showSharePopup }}" round bind:close="onClose">
<image style="width: 352rpx; height: 352rpx;" src="{{imagePath}}"></image>
</van-popup> -->
</view>
</block>
<authorize scopeType="writePhotosAlbum" bindfail="authFail" show="{{showAuth}}" id="auth"></authorize>
<block wx:if="{{showAuth}}">
<authorize title="下载前需要获取您的‘添加到相册’权限,是否打开授权设置?" scopeType="writePhotosAlbum" buttonType="openSetting" bindfail="authFail" show="{{showAuth}}" id="auth"></authorize>
</block>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!