Browse Source

完善代码

master
chengkun 2 years ago
parent
commit
9c954320a5
  1. 8
      manifest.json
  2. BIN
      nativeplugins/LY-HWScan/android/uniplugin_hwscan-release.aar
  3. 7
      pages.json
  4. 10
      pages/feedback/Feedback.vue
  5. 4
      pages/history/History.vue
  6. 119
      pages/policy/Policy.vue
  7. 21
      pages/rights/RightsSetting.vue
  8. 106
      pages/scan/Scan.nvue
  9. 7
      pages/setting/Setting.vue
  10. 4
      pages/webview/webview.vue

8
manifest.json

@ -11,7 +11,7 @@
"nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"alwaysShowBeforeRender" : false,
"waiting" : false,
"autoclose" : true,
"delay" : 0
@ -102,9 +102,9 @@
"splashscreen" : {
"androidStyle" : "default",
"android" : {
"hdpi" : "F:/次元节点doc/扫码项目文件/icon/splash-480x762.png",
"xhdpi" : "F:/次元节点doc/扫码项目文件/icon/splash-720x1242.png",
"xxhdpi" : "F:/次元节点doc/扫码项目文件/icon/splash-1080x1882.png"
"hdpi" : "",
"xhdpi" : "",
"xxhdpi" : ""
},
"useOriginalMsgbox" : false,
"iosStyle" : "common"

BIN
nativeplugins/LY-HWScan/android/uniplugin_hwscan-release.aar

Binary file not shown.

7
pages.json

@ -24,13 +24,6 @@
"enablePullDownRefresh": false
}
},
{
"path": "pages/policy/Policy",
"style": {
"navigationBarTitleText": "Policy",
"enablePullDownRefresh": false
}
},
{
"path": "pages/rights/RightsSetting",
"style": {

10
pages/feedback/Feedback.vue

@ -1,11 +1,11 @@
<template>
<view class="content">
<view class="radioStyle">
<tn-radio-group v-model="radioValue" width="100%" wrap :size="radioGroupSize">
<tn-radio :iconSize="iconSize" :labelSize="labelSize" v-for="(item, index) in radioList" :key="index" :name="item.name" :disabled="item.disabled">
<tn-checkbox-group v-model="radioValue" width="100%" wrap :size="radioGroupSize">
<tn-checkbox :iconSize="iconSize" :labelSize="labelSize" v-for="(item, index) in radioList" :key="index" :name="item.name" :disabled="item.disabled">
<view class="radioFont">{{ item.name }}</view>
</tn-radio>
</tn-radio-group>
</tn-checkbox>
</tn-checkbox-group>
</view>
<view class="radioBtn">
<tn-button @click="submitFeedback()" backgroundColor="#0186ff" width="600rpx" height="100rpx"
@ -23,7 +23,7 @@
labelSize: 45,
iconSize: 40,
btnFontSize: 36,
radioValue: '',
radioValue: [],
radioList:[
{
'name': 'Scan faild',

4
pages/history/History.vue

@ -112,6 +112,10 @@
await that.getData();
},
onHide() {
// let that = this;
// that.closedb();
},
onUnload() {
let that = this;
that.closedb();
},

119
pages/policy/Policy.vue

@ -1,119 +0,0 @@
<template>
<view class="content">
<!-- <view class="radioStyle">
<tn-radio-group v-model="radioValue" width="100%" wrap :size="radioGroupSize">
<tn-radio :iconSize="iconSize" :labelSize="labelSize" v-for="(item, index) in radioList" :key="index" :name="item.name" :disabled="item.disabled">
<view class="radioFont">{{ item.name }}</view>
</tn-radio>
</tn-radio-group>
</view>
<view class="radioBtn">
<tn-button @click="submitFeedback()" backgroundColor="#0186ff" width="600rpx" height="100rpx"
:fontSize="btnFontSize">Submit</tn-button>
</view>
<tn-toast ref="toast"></tn-toast> -->
<text style="color: #fff; font-size: 48rpx;"> this is policy</text>
</view>
</template>
<script>
export default {
data() {
return {
radioGroupSize: 45,
labelSize: 45,
iconSize: 40,
btnFontSize: 36,
radioValue: '',
radioList:[
{
'name': 'Scan faild',
'disabled': false
},
{
'name': 'Too many ads',
'disabled': false
},
{
'name': 'Need more infomation',
'disabled': false
},
{
'name': 'Bugs',
'disabled': false
},
{
'name': 'Other',
'disabled': false
}
]
}
},
onLoad() {
//starTipStatus
//this.setStarTipStatus(false);
},
onHide() {
},
methods: {
//
// setStarTipStatus(value){
// uni.setStorageSync('starTipStatus', value);
// },
//
// submitFeedback(){
// let that = this;
// if(that.radioValue == '' || that.radioValue == null){
// that.$refs.toast.show({
// title: 'Fail',
// content: 'please select one!',
// icon: 'fail',
// duration: 3000
// })
// }else{
// that.$refs.toast.show({
// title: 'Success',
// content: 'Thanks for feedback!',
// icon: 'success',
// duration: 3000
// })
// //
// setTimeout(() =>{
// uni.navigateBack();
// }, 3000);
// }
// }
}
}
</script>
<style lang="scss">
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
background-color: #1F222B;
height:100vh;
}
.radioStyle{
//border: 1px solid red;
margin-top: 50rpx;
margin-left: 50rpx;
padding-top: 100rpx;
}
.radioFont{
color: #fff;
//margin-top: 50rpx;
}
.radioBtn{
//border: 1px solid yellow;
margin-top: 600rpx;
}
</style>

21
pages/rights/RightsSetting.vue

@ -33,19 +33,25 @@
btnFontSize: 36,
btnBackgroundColor: '#0186ff',
btnFontColor: '#fff',
hasRequestedPermission: false
hasRequestedPermission: false,
permissionStatus: false
}
},
async onShow(){
let that = this;
if (!that.hasRequestedPermission) {
console.log('进入了判断setting权限',that.hasRequestedPermission)
await that.requestAndroidPermission('android.permission.CAMERA');
}
// else{
// console.log('settingtrue',that.hasRequestedPermission)
const res = await that.requestAndroidPermission('android.permission.CAMERA');
console.log('res',res);
// if (result == 1) {
// //,
// that.jumpToRights('/pages/scan/Scan');
// }
}
else{
console.log('setting权限状态已变更为true,进入扫码页',that.hasRequestedPermission)
that.jumpToRights('/pages/scan/Scan');
}
},
onHide() {
this.hasRequestedPermission = false;
@ -67,10 +73,7 @@
var result = await permision.requestAndroidPermission(permisionID)
console.log('setting判断权限结果',result)
that.hasRequestedPermission = true;
if (result == 1) {
//,
that.jumpToRights('/pages/scan/Scan');
}
return result;
},
//

106
pages/scan/Scan.nvue

@ -36,7 +36,7 @@
</template>
<script>
import { openSqlite,executeSql,closedb} from "@/utils/database";
import { isTable,executeSql,openSqlite,closedb } from "@/utils/database";
import permision from "@/js_sdk/wa-permission/permission.js"
const hwscan = uni.requireNativePlugin('LY-HWScan')
export default {
@ -65,8 +65,6 @@
},
async onShow(){
let that = this;
//打开db
await that.openSqlite();
if(that.$refs.scanComponent){
setTimeout(function(){
that.$refs.scanComponent.remoteResume();
@ -84,9 +82,15 @@
// }
},
onLoad(){
let that = this;
//打开db
that.openSqlite();
//初始化,创建表
that.createTable();
},
onHide() {
let that = this;
that.closedb();
if(that.$refs.scanComponent){
that.$refs.scanComponent.remotePause();
}
@ -94,7 +98,9 @@
//that.hasPermission = false;
},
onUnload() {
let that = this;
// this.$refs.scanComponent.releaseAssets()
that.closedb();
},
methods: {
@ -198,6 +204,38 @@
this.$refs.scanComponent.releaseAssets();
},
// 创建表
async createTable(){
let sql = this.createTableSql_outbound()
try{
let exist = await isTable(this.tableName)
console.log("表是否存在",exist)
if(!exist){
let res = await executeSql(sql)
console.log("新增表scancode",res)
}else{
console.log("表scancode已存在")
}
}catch(e){
uni.showToast({
title:"create table error",
icon:"none"
})
console.error("新增表报错scancode",e)
}
},
//创建表语句
createTableSql_outbound(){
return "CREATE TABLE IF NOT EXISTS `scan_code` (" +
" `id` INTEGER PRIMARY KEY AUTOINCREMENT," +
" `category` varchar(50) DEFAULT NULL ," +
" `content` text DEFAULT NULL ," +
" `createTime` datetime DEFAULT CURRENT_TIMESTAMP ," +
" `updateTime` datetime DEFAULT NULL default(datetime('now','localtime'))" +
"); "
},
// 打开数据库
async openSqlite(){
try{
@ -219,38 +257,38 @@
},
async clearData(){
try{
await executeSql("DELETE FROM scan_code")
uni.showToast({
title:"清除数据成功",
icon:"none"
});
}catch(e){
uni.showToast({
title:"清除数据报错,请查看控制台",
icon:"none"
});
console.error("清除数据报错",e)
}
},
// async clearData(){
// try{
// await executeSql("DELETE FROM scan_code")
// uni.showToast({
// title:"清除数据成功",
// icon:"none"
// });
// }catch(e){
// uni.showToast({
// title:"清除数据报错,请查看控制台",
// icon:"none"
// });
// console.error("清除数据报错",e)
// }
// },
async deleteTable(){
try{
await executeSql("drop table scan_code")
uni.showToast({
title:"删除数据表成功",
icon:"none"
})
}catch(e){
uni.showToast({
title:"删除数据表失败",
icon:"none"
})
console.error("删除数据表失败scan_code",e)
}
// async deleteTable(){
// try{
// await executeSql("drop table scan_code")
// uni.showToast({
// title:"删除数据表成功",
// icon:"none"
// })
// }catch(e){
// uni.showToast({
// title:"删除数据表失败",
// icon:"none"
// })
// console.error("删除数据表失败scan_code",e)
// }
},
// },
//根据扫码返回结果判断跳转到哪个指定页面
jumpToPage(url,category,data){

7
pages/setting/Setting.vue

@ -187,7 +187,7 @@
languageLabel: 'English', //
languageValue: 0, //
searchLanguageFlag: true, //
privacyUrl: 'https://docs.google.com/document/d/1Ll7e3UBv8iRCaZ9TrsXZOC5MWMp8xl04SfYkhPgIwAc/edit?usp=sharing',
webEngineList:[
{
"value": 0,
@ -260,8 +260,11 @@
//
gotoPolicy(){
let that = this;
console.log('点击了跳转政策')
let url = encodeURIComponent(that.privacyUrl);
uni.navigateTo({
url: '/pages/policy/Policy'
url: '/pages/webview/webview?url=' + url
});
},

4
pages/webview/webview.vue

@ -1,6 +1,6 @@
<template>
<view>
<web-view :src="url"></web-view>
<web-view :src="url" :progress="false"></web-view>
</view>
</template>
@ -13,7 +13,7 @@
},
onLoad(option) {
let that = this;
that.url = option.url
that.url = decodeURIComponent(option.url)
console.log('that.url',that.url)
},

Loading…
Cancel
Save