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

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

Binary file not shown.

7
pages.json

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

10
pages/feedback/Feedback.vue

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

4
pages/history/History.vue

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

106
pages/scan/Scan.nvue

@ -36,7 +36,7 @@
</template> </template>
<script> <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" import permision from "@/js_sdk/wa-permission/permission.js"
const hwscan = uni.requireNativePlugin('LY-HWScan') const hwscan = uni.requireNativePlugin('LY-HWScan')
export default { export default {
@ -65,8 +65,6 @@
}, },
async onShow(){ async onShow(){
let that = this; let that = this;
//打开db
await that.openSqlite();
if(that.$refs.scanComponent){ if(that.$refs.scanComponent){
setTimeout(function(){ setTimeout(function(){
that.$refs.scanComponent.remoteResume(); that.$refs.scanComponent.remoteResume();
@ -84,9 +82,15 @@
// } // }
}, },
onLoad(){
let that = this;
//打开db
that.openSqlite();
//初始化,创建表
that.createTable();
},
onHide() { onHide() {
let that = this; let that = this;
that.closedb();
if(that.$refs.scanComponent){ if(that.$refs.scanComponent){
that.$refs.scanComponent.remotePause(); that.$refs.scanComponent.remotePause();
} }
@ -94,7 +98,9 @@
//that.hasPermission = false; //that.hasPermission = false;
}, },
onUnload() { onUnload() {
let that = this;
// this.$refs.scanComponent.releaseAssets() // this.$refs.scanComponent.releaseAssets()
that.closedb();
}, },
methods: { methods: {
@ -198,6 +204,38 @@
this.$refs.scanComponent.releaseAssets(); 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(){ async openSqlite(){
try{ try{
@ -219,38 +257,38 @@
}, },
async clearData(){ // async clearData(){
try{ // try{
await executeSql("DELETE FROM scan_code") // await executeSql("DELETE FROM scan_code")
uni.showToast({ // uni.showToast({
title:"清除数据成功", // title:"清除数据成功",
icon:"none" // icon:"none"
}); // });
}catch(e){ // }catch(e){
uni.showToast({ // uni.showToast({
title:"清除数据报错,请查看控制台", // title:"清除数据报错,请查看控制台",
icon:"none" // icon:"none"
}); // });
console.error("清除数据报错",e) // console.error("清除数据报错",e)
} // }
}, // },
async deleteTable(){ // async deleteTable(){
try{ // try{
await executeSql("drop table scan_code") // await executeSql("drop table scan_code")
uni.showToast({ // uni.showToast({
title:"删除数据表成功", // title:"删除数据表成功",
icon:"none" // icon:"none"
}) // })
}catch(e){ // }catch(e){
uni.showToast({ // uni.showToast({
title:"删除数据表失败", // title:"删除数据表失败",
icon:"none" // icon:"none"
}) // })
console.error("删除数据表失败scan_code",e) // console.error("删除数据表失败scan_code",e)
} // }
}, // },
//根据扫码返回结果判断跳转到哪个指定页面 //根据扫码返回结果判断跳转到哪个指定页面
jumpToPage(url,category,data){ jumpToPage(url,category,data){

7
pages/setting/Setting.vue

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

4
pages/webview/webview.vue

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

Loading…
Cancel
Save