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

拒绝权限问题

parent cf477d5d
......@@ -17,6 +17,8 @@
<!--cover-image class='flashIcon' :src='icon_light_on_white' @click="flashClick()"> </cover-image-->
</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>
</view>
......@@ -53,6 +55,7 @@
canvasWidth:0,
canvasHeight:0,
restuleImage:'',
authSetting:[]
}
},
onLoad(e) {
......@@ -67,6 +70,15 @@
})
//this.address = ''
},
onShow(){
// uni.authorize({
// scope: 'scope.writePhotosAlbum',
// success() {
// console.log('userLocation')
// // uni.getLocation()
// }
// })
},
methods: {
goPage(){
// 进入图片预览页
......@@ -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() {
let that = this
this.ctx.takePhoto({
quality: 'high',
......@@ -251,10 +278,39 @@
},
fail() {
// console.log('保存本地相册 失败')
uni.showToast({
icon:'none',
title:'保存本地相册失败'
let txt = '保存本地相册失败'
uni.getSetting({
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