Commit d56ffa8c authored by 和慭琛's avatar 和慭琛

再次授权相关问题

第二轮提测版本
parent ff1b16d6
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<u-swiper <u-swiper
@click="imageClick" @click="imageClick"
@change="changeSwipter" @change="changeSwipter"
img-mode="scaleToFill" img-mode="aspectFill"
bg-color="#333333" bg-color="#333333"
:height="600" :list="swiperList" :height="600" :list="swiperList"
:autoplay="false" :autoplay="false"
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
onLoad(e) { onLoad(e) {
this.getProductList() this.getProductList()
}, },
methods: { methods: {
......
<template> <template>
<view class="blackBackColor"> <view class="blackBackColor">
<camera device-position="back" flash="off" style='width:100%; height:100vh;'> <camera device-position="back" flash="off" style='width:100%; height:100vh;' @error="cameraRefuse">
<cover-view class="locationView"> <cover-view class="locationView">
<cover-view class="locationText u-m-l-20 u-m-t-30">经度:{{longitude}}</cover-view> <cover-view class="locationText u-m-l-20 u-m-t-30">经度:{{longitude}}</cover-view>
<cover-view class="locationText u-m-l-20 u-m-t-10">维度:{{latitude}}</cover-view> <cover-view class="locationText u-m-l-20 u-m-t-10">维度:{{latitude}}</cover-view>
...@@ -17,8 +17,8 @@ ...@@ -17,8 +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 @click="openSetting">打开设置页</button-->
<button open-type="openSetting" @opensetting="callback">打开设置页1111</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>
...@@ -153,9 +153,74 @@ ...@@ -153,9 +153,74 @@
that.longitude = res.longitude that.longitude = res.longitude
that.latitude = res.latitude that.latitude = res.latitude
that.baiduLocation() that.baiduLocation()
},
fail() {
that.showLocationAuthModal()
} }
}); });
}, },
//定位 再次授权弹窗
showLocationAuthModal:function (){
let that = this
uni.showModal({
content:'拒绝授权将无法定位当前位置,是否去设置打开?',
confirmText: "确认",
cancelText: '取消',
success(res) {
if(res.confirm){
that.openLocationSetting()
}
if(res.cancel){
uni.navigateBack({
})
}
},
fail() {
console.log('')
}
})
},
//定位设置界面
openLocationSetting() {
let that = this
wx.openSetting({
success(res) {
console.log(res, 'openSetting.res')
console.log(res.authSetting, 'openSetting.res.authSetting')
console.log(res.authSetting['scope.camera'], 'openSetting.res.authSetting.scope.camera')
console.log(res.authSetting['scope.userInfo'], 'openSetting.res.authSetting.scope.userInfo')
if( res.authSetting['scope.userInfo'] && res.authSetting['scope.userInfo'] == true){
console.log('33333location reload page')
that.reloadPage()
}else{
that.showLocationAuthModal()
console.log('444444')
}
}
})
},
//刷新当前页
reloadPage:function (){
uni.redirectTo({
url:'/pages/photo/try'
});
},
//获取 水印 本地缓存路径 //获取 水印 本地缓存路径
getMarkPath: function() { getMarkPath: function() {
...@@ -176,18 +241,68 @@ ...@@ -176,18 +241,68 @@
callback(res) { callback(res) {
console.log(res, 'res-callback') console.log(res, 'res-callback')
}, },
openSetting() {
//相机设置界面
openCameraSetting() {
let that = this
wx.openSetting({ wx.openSetting({
success(res) { success(res) {
console.log(res.authSetting, 'openSetting')
// res.authSetting = { console.log(res, 'openSetting.res')
// "scope.userInfo": true, console.log(res.authSetting, 'openSetting.res.authSetting')
// "scope.userLocation": true console.log(res.authSetting['scope.camera'], 'openSetting.res.authSetting.scope.camera')
// } console.log(res.authSetting['scope.userInfo'], 'openSetting.res.authSetting.scope.userInfo')
if( res.authSetting['scope.camera'] && res.authSetting['scope.camera'] == true){
console.log('11111camera reload page')
that.reloadPage()
}else{
that.showCameraAuthModal()
console.log('222222')
}
} }
}) })
return
}, },
//相机 再次授权弹窗
showCameraAuthModal:function (){
let that = this
uni.showModal({
content:'拒绝授权将无法拍照,是否去设置打开?',
confirmText: "确认",
cancelText: '取消',
success(res) {
if(res.confirm){
that.openCameraSetting()
}
if(res.cancel){
uni.navigateBack({
})
}
},
fail() {
console.log('')
}
})
},
//相机拒绝授权
cameraRefuse:function (){
console.log('相机拒绝授权')
this.showCameraAuthModal()
},
//第一步: 拍照 //第一步: 拍照
takePhoto() { takePhoto() {
...@@ -312,12 +427,39 @@ ...@@ -312,12 +427,39 @@
}) })
let timer = setTimeout(() => { let timer = setTimeout(() => {
that.goBack() that.goBack()
}, 2000) }, 1500)
}, },
fail() { fail() {
// console.log('保存本地相册 失败') // console.log('保存本地相册 失败')
///*
uni.showToast({
icon: 'none',
title: '保存本地相册失败'
})
uni.setStorage({
key: 'photo_tempPath',
data: tempImagePath,
success: function () {
console.log('tempImagePath save success');
let timer = setTimeout(() => {
that.showAlbumAuthModal()
}, 1500)
}
});
//*/
/*
let txt = '保存本地相册失败' let txt = '保存本地相册失败'
uni.getSetting({ uni.getSetting({
success(res) { success(res) {
let authSetting = res.authSetting let authSetting = res.authSetting
...@@ -330,6 +472,7 @@ ...@@ -330,6 +472,7 @@
}) })
} }
}) })
*/
// wx.openSetting({ // wx.openSetting({
// success (res) { // success (res) {
// console.log(res.authSetting,'openSetting') // console.log(res.authSetting,'openSetting')
...@@ -353,6 +496,69 @@ ...@@ -353,6 +496,69 @@
} }
}) })
}, },
//相册 再次授权弹窗
showAlbumAuthModal:function (){
let that = this
uni.showModal({
content:'拒绝授权照片将无法保存到本地相册,是否去设置打开?',
confirmText: "确认",
cancelText: '取消',
success(res) {
if(res.confirm){
that.openAlbumSetting()
}
if(res.cancel){
uni.navigateBack({
})
}
},
fail() {
console.log('')
}
})
},
//相机设置界面
openAlbumSetting() {
let that = this
wx.openSetting({
success(res) {
console.log(res, 'openSetting.res')
console.log(res.authSetting, 'openSetting.res.authSetting')
console.log(res.authSetting['scope.writePhotosAlbum'], 'openSetting.res.authSetting.scope.writePhotosAlbum')
if( res.authSetting['scope.writePhotosAlbum'] && res.authSetting['scope.writePhotosAlbum'] == true){
console.log('11111camera reload page')
uni.getStorage({
key:'photo_tempPath',
success: function (res) {
that.saveToLocal(res.data)
}
})
//that.reloadPage()
}else{
that.showAlbumAuthModal()
console.log('222222')
}
}
})
},
//获取当前时间 //获取当前时间
getTime: function() { getTime: function() {
......
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