Commit 4cb39b56 by luyt

feat:添加下载权限判断

1 parent aa504631
...@@ -52,7 +52,9 @@ Page({ ...@@ -52,7 +52,9 @@ Page({
isAuthphone: true, //授权昵称弹窗显示,更多按钮显示 isAuthphone: true, //授权昵称弹窗显示,更多按钮显示
// 视频播放地址 // 视频播放地址
videoSrc:'', videoSrc:'',
videoTitle:'' videoTitle:'',
//下载海报授权
showAuth: false,
}, },
observers: { observers: {
actNum: function (actNum) { actNum: function (actNum) {
...@@ -200,10 +202,18 @@ Page({ ...@@ -200,10 +202,18 @@ Page({
content: '生成并下载页面为海报', content: '生成并下载页面为海报',
success: async res => { success: async res => {
if (res.confirm) { if (res.confirm) {
// let hasAuth = await _this.toSetting() wx.getSetting({
// if(hasAuth){ success: (res)=> {
_this.download() if(res.authSetting['scope.writePhotosAlbum']===false){
// } _this.setData({
showAuth: true
})
}else{
_this.download()
}
}
})
} }
}, },
confirmText:'下载', confirmText:'下载',
...@@ -365,6 +375,16 @@ Page({ ...@@ -365,6 +375,16 @@ Page({
} }
}) })
}, },
authFail(){
wx.showToast({
title: "下载海报前需要您授权'添加到相册'权限",
icon: "none",
duration: 2500,
});
},
authSuccess(){
this.download()
},
// //模态框关闭 // //模态框关闭
// modelClose() { // modelClose() {
// this.triggerEvent("modelclose", false); // this.triggerEvent("modelclose", false);
......
...@@ -57,4 +57,8 @@ ...@@ -57,4 +57,8 @@
<!-- !hasUserInfo && !isShow --> <!-- !hasUserInfo && !isShow -->
<view wx:if="{{!hasUserInfo && isShare && isAuthphone}}" class="user-profile" bindtap="getUserProfile"></view> <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 \ 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!