Commit e1dec8d0 by 杨北旺

优化授权

1 parent 20ea01e7
...@@ -170,8 +170,11 @@ Component({ ...@@ -170,8 +170,11 @@ Component({
wx.$api.showToast('保存成功') wx.$api.showToast('保存成功')
}, },
fail(err) { fail(err) {
const auth = _this.selectComponent('#auth') if(err.errMsg=='saveImageToPhotosAlbum:fail auth deny'){
auth.check() _this.triggerEvent('showAuth',true)
}
// const auth = _this.selectComponent('#auth')
// auth.check()
} }
} }
) )
......
...@@ -140,11 +140,6 @@ Component({ ...@@ -140,11 +140,6 @@ Component({
// 分享活动(复制链接) // 分享活动(复制链接)
copyActivityUrl(e) { copyActivityUrl(e) {
wx.getSetting({
success: (res)=> {
if(res.authSetting['scope.writePhotosAlbum']===false){
this.triggerEvent('showAuth',true)
}else{
let { item } = e.currentTarget.dataset let { item } = e.currentTarget.dataset
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance()
wx.$api.showLoading() wx.$api.showLoading()
...@@ -181,9 +176,6 @@ Component({ ...@@ -181,9 +176,6 @@ Component({
}, },
}) })
}) })
}
}
})
}, },
......
...@@ -217,6 +217,9 @@ Page({ ...@@ -217,6 +217,9 @@ Page({
*/ */
onShareAppMessage: function () { onShareAppMessage: function () {
}, },
authFail(){
},
toShowAuth(){ toShowAuth(){
this.setData({ this.setData({
showAuth:true showAuth:true
......
...@@ -39,11 +39,13 @@ ...@@ -39,11 +39,13 @@
<!-- 预约安装弹窗 --> <!-- 预约安装弹窗 -->
<install-popup show="{{showPopup}}" data="{{installItem}}" bind:hidePopup="hidePopup"></install-popup> <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"> <!-- <van-popup show="{{ showSharePopup }}" round bind:close="onClose">
<image style="width: 352rpx; height: 352rpx;" src="{{imagePath}}"></image> <image style="width: 352rpx; height: 352rpx;" src="{{imagePath}}"></image>
</van-popup> --> </van-popup> -->
</view> </view>
</block> </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!