|
@@ -3,8 +3,11 @@
|
|
<!-- position: absolute;left: 100000px; 隐藏canvas画布 -->
|
|
<!-- position: absolute;left: 100000px; 隐藏canvas画布 -->
|
|
<canvas style="width: 100%; height: 100vh;position: absolute;left: 100000px;" canvas-id="canvas" id="canvas"></canvas>
|
|
<canvas style="width: 100%; height: 100vh;position: absolute;left: 100000px;" canvas-id="canvas" id="canvas"></canvas>
|
|
<!-- 相机组件 -->
|
|
<!-- 相机组件 -->
|
|
- <camera device-position="back" flash="auto" style="width: 100%; height: 100vh">
|
|
|
|
|
|
+ <camera device-position="back" @initdone="cameraInit" flash="auto" style="width: 100%; height: 100vh">
|
|
<cover-image src="@/static/scan-frame/cameraBg.png" class="cover-img"> </cover-image>
|
|
<cover-image src="@/static/scan-frame/cameraBg.png" class="cover-img"> </cover-image>
|
|
|
|
+ <cover-view class="noAuth" v-if="showAuth" @click="openAuth">
|
|
|
|
+ 您未开启摄像机权限,<cover-view class="btns">请点击开启权限</cover-view>
|
|
|
|
+ </cover-view>
|
|
<cover-view class="scanBtn" v-if="scanShow">
|
|
<cover-view class="scanBtn" v-if="scanShow">
|
|
<cover-view class="beat" @click="scan">
|
|
<cover-view class="beat" @click="scan">
|
|
<cover-image class="beatImg" src="@/static/scan-frame/album.png"></cover-image>
|
|
<cover-image class="beatImg" src="@/static/scan-frame/album.png"></cover-image>
|
|
@@ -30,36 +33,36 @@ export default {
|
|
return {
|
|
return {
|
|
scanShow: true, // 显示操作按钮
|
|
scanShow: true, // 显示操作按钮
|
|
sysinfo: null, // 设备信息
|
|
sysinfo: null, // 设备信息
|
|
- imageInfo: null // 拍照图片信息
|
|
|
|
|
|
+ imageInfo: null ,// 拍照图片信息
|
|
|
|
+ showAuth: false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onReady() {
|
|
onReady() {
|
|
const sysinfo = uni.getSystemInfoSync()
|
|
const sysinfo = uni.getSystemInfoSync()
|
|
this.sysinfo = sysinfo
|
|
this.sysinfo = sysinfo
|
|
},
|
|
},
|
|
- onLoad() {
|
|
|
|
|
|
+ onShow() {
|
|
|
|
+ const _this = this
|
|
uni.getSetting({
|
|
uni.getSetting({
|
|
success(res) {
|
|
success(res) {
|
|
console.log(res.authSetting['scope.camera'])
|
|
console.log(res.authSetting['scope.camera'])
|
|
- if(!res.authSetting['scope.camera']){
|
|
|
|
- uni.showModal({
|
|
|
|
- title: '您未开启摄像机权限',
|
|
|
|
- content: '请点击右上角,然后在设置里面开启。',
|
|
|
|
- success: (ret) => {
|
|
|
|
- if(ret.confirm){
|
|
|
|
- uni.openSetting({
|
|
|
|
- success(res) {
|
|
|
|
- console.log(res.authSetting)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
|
|
+ _this.showAuth = !res.authSetting['scope.camera']
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ cameraInit(e){
|
|
|
|
+ this.showAuth = false
|
|
|
|
+ },
|
|
|
|
+ openAuth(){
|
|
|
|
+ uni.openSetting({
|
|
|
|
+ success(res) {
|
|
|
|
+ if(res.authSetting['scope.camera']){
|
|
|
|
+ uni.navigateBack()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
// 手动输入
|
|
// 手动输入
|
|
inputs(){
|
|
inputs(){
|
|
uni.redirectTo({
|
|
uni.redirectTo({
|
|
@@ -223,6 +226,17 @@ export default {
|
|
height: 100vh;
|
|
height: 100vh;
|
|
z-index: 1;
|
|
z-index: 1;
|
|
}
|
|
}
|
|
|
|
+ .noAuth{
|
|
|
|
+ width: 100%;
|
|
|
|
+ z-index: 999998;
|
|
|
|
+ position: fixed;
|
|
|
|
+ bottom: 55vh;
|
|
|
|
+ text-align: center;
|
|
|
|
+ color: #999;
|
|
|
|
+ .btns{
|
|
|
|
+ color: dodgerblue;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
.scanBtn {
|
|
.scanBtn {
|
|
width: 100%;
|
|
width: 100%;
|
|
z-index: 99999;
|
|
z-index: 99999;
|