Commit 1741eb39 authored by 李俊赕's avatar 李俊赕

拒绝权限问题

parent cf477d5d
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
<!--cover-image class='flashIcon' :src='icon_light_on_white' @click="flashClick()"> </cover-image--> <!--cover-image class='flashIcon' :src='icon_light_on_white' @click="flashClick()"> </cover-image-->
</cover-view> </cover-view>
<button @click="openSetting">打开设置页</button>
<button open-type="openSetting" @opensetting="callback">打开设置页1111</button>
<canvas v-show='showImage' canvas-id="canvas" :style="{'width':canvasWidth+'px','height': canvasHeight + 'px'}"></canvas> <canvas v-show='showImage' canvas-id="canvas" :style="{'width':canvasWidth+'px','height': canvasHeight + 'px'}"></canvas>
</view> </view>
...@@ -53,6 +55,7 @@ ...@@ -53,6 +55,7 @@
canvasWidth:0, canvasWidth:0,
canvasHeight:0, canvasHeight:0,
restuleImage:'', restuleImage:'',
authSetting:[]
} }
}, },
onLoad(e) { onLoad(e) {
...@@ -67,6 +70,15 @@ ...@@ -67,6 +70,15 @@
}) })
//this.address = '' //this.address = ''
}, },
onShow(){
// uni.authorize({
// scope: 'scope.writePhotosAlbum',
// success() {
// console.log('userLocation')
// // uni.getLocation()
// }
// })
},
methods: { methods: {
goPage(){ goPage(){
// 进入图片预览页 // 进入图片预览页
...@@ -126,9 +138,24 @@ ...@@ -126,9 +138,24 @@
}) })
}, },
callback(res){
console.log(res,'res-callback')
},
openSetting(){
wx.openSetting({
success (res) {
console.log(res.authSetting,'openSetting')
// res.authSetting = {
// "scope.userInfo": true,
// "scope.userLocation": true
// }
}
})
return
},
//第一步: 拍照 //第一步: 拍照
takePhoto() { takePhoto() {
let that = this let that = this
this.ctx.takePhoto({ this.ctx.takePhoto({
quality: 'high', quality: 'high',
...@@ -251,10 +278,39 @@ ...@@ -251,10 +278,39 @@
}, },
fail() { fail() {
// console.log('保存本地相册 失败') // console.log('保存本地相册 失败')
uni.showToast({ let txt = '保存本地相册失败'
icon:'none', uni.getSetting({
title:'保存本地相册失败' success(res) {
let authSetting = res.authSetting
if(!authSetting['scope.writePhotosAlbum']){
txt = '请打开相册权限'
}
uni.showToast({
icon:'none',
title:txt
})
}
}) })
// wx.openSetting({
// success (res) {
// console.log(res.authSetting,'openSetting')
// // res.authSetting = {
// // "scope.userInfo": true,
// // "scope.userLocation": true
// // }
// }
// })
// uni.authorize({
// scope: 'scope.writePhotosAlbum',
// success() {
// console.log('userLocation')
// uni.openSetting({
// success(res) {
// console.log(res,'openSetting')
// }
// });
// }
// })
} }
}) })
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment