Commit 4cb39b56 by luyt

feat:添加下载权限判断

1 parent aa504631
......@@ -52,7 +52,9 @@ Page({
isAuthphone: true, //授权昵称弹窗显示,更多按钮显示
// 视频播放地址
videoSrc:'',
videoTitle:''
videoTitle:'',
//下载海报授权
showAuth: false,
},
observers: {
actNum: function (actNum) {
......@@ -200,10 +202,18 @@ Page({
content: '生成并下载页面为海报',
success: async res => {
if (res.confirm) {
// let hasAuth = await _this.toSetting()
// if(hasAuth){
_this.download()
// }
wx.getSetting({
success: (res)=> {
if(res.authSetting['scope.writePhotosAlbum']===false){
_this.setData({
showAuth: true
})
}else{
_this.download()
}
}
})
}
},
confirmText:'下载',
......@@ -365,6 +375,16 @@ Page({
}
})
},
authFail(){
wx.showToast({
title: "下载海报前需要您授权'添加到相册'权限",
icon: "none",
duration: 2500,
});
},
authSuccess(){
this.download()
},
// //模态框关闭
// modelClose() {
// this.triggerEvent("modelclose", false);
......
......@@ -57,4 +57,8 @@
<!-- !hasUserInfo && !isShow -->
<view wx:if="{{!hasUserInfo && isShare && isAuthphone}}" class="user-profile" bindtap="getUserProfile"></view>
<!-- 全屏视频组件 -->
<FullscreenVideo id="videocomp1" src="{{videoSrc}}" title="{{videoTitle}}"></FullscreenVideo>
\ No newline at end of file
<FullscreenVideo id="videocomp1" src="{{videoSrc}}" title="{{videoTitle}}"></FullscreenVideo>
<!-- 下载授权 -->
<block wx:if="{{showAuth}}">
<authorize title="下载前需要获取您的‘添加到相册’权限,是否打开授权设置?" scopeType="writePhotosAlbum" buttonType="openSetting" bindfail="authFail" bindsuccess="authSuccess" show="{{showAuth}}"></authorize>
</block>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!