安卓扫码器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
2.3 KiB

2 years ago
<template>
<view class="content">
<view class="textBoard">
<text style="color: #fff; font-size: 48rpx;">Need permissions?</text>
</view>
<view class="textBoard">
<text style="color: #fff; font-size: 36rpx;">Camera permission is requeired to</text>
</view>
<view class="textBoard">
<text style="color: #0186FF; font-size: 36rpx;">QR Code Scanner & barcode Reader.</text>
</view>
<view class="textBoard">
<text style="color: #fff; font-size: 36rpx;">1.Open settings</text>
</view>
<view class="textBoard">
<text style="color: #fff; font-size: 36rpx;">2.Tap permissions</text>
</view>
<view class="textBoard">
<text style="color: #fff; font-size: 36rpx;">3.Turn on Camera</text>
</view>
<view class="textBoard">
<tn-button @click="setPermission()" :backgroundColor="btnBackgroundColor" :fontColor="btnFontColor" width="300rpx" height="100rpx"
:fontSize="btnFontSize">Open settings</tn-button>
</view>
</view>
</template>
<script>
import permision from "@/js_sdk/wa-permission/permission.js"
export default {
data() {
return {
btnFontSize: 36,
btnBackgroundColor: '#0186ff',
btnFontColor: '#fff',
}
},
2 years ago
async onLaunch() {
let that = this;
that.ifAppOnlaunched = true;
that.$isResolve()
},
2 years ago
async onShow(){
let that = this;
2 years ago
if(!that.ifAppOnlaunched){
await that.$onLaunched;
console.log('setonShow')
await that.requestAndroidPermission('android.permission.CAMERA');
2 years ago
}
},
onHide() {
console.log('onHide')
},
onUnload(){
console.log('onUnload')
},
methods: {
//打开设置权限界面
setPermission(){
permision.gotoAppPermissionSetting();
},
//判断是否有相机权限
async requestAndroidPermission(permisionID) {
let that = this;
var result = await permision.requestAndroidPermission(permisionID)
console.log('setting判断权限结果',result)
2 years ago
if (result == '1') {
//有权限,跳转到扫码界面
that.jumpToRights('/pages/scan/Scan');
}
2 years ago
},
//跳转到授权设置页面
jumpToRights(url){
uni.switchTab({
url: url
})
}
}
}
</script>
<style lang="scss">
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #1F222B;
height:100vh;
}
.textBoard{
margin-top: 1vh;
}
</style>