增加红外配置

This commit is contained in:
aihe 2024-10-12 16:48:47 +08:00
parent 5fe92a3e5e
commit d022bd46fd
5 changed files with 126 additions and 28 deletions

View File

@ -6,24 +6,22 @@
import { getSessionSystemInfo } from "@/session"
export default {
props: {
customintent: {
default () {
return {
// !!注意: 不同的设备配置项是不同的
scanDownKey: "KEYCODE_SCAN_L_DOWN",
actionKey: 'com.android.receive_scan_action',
codeKey: "data"
}
}
},
value: {
default () {
return ''
}
},
},
data() {
return {
data() {
let { hongWai } = getSessionSystemInfo()
let { actionKey = 'com.android.receive_scan_action', codeKey = 'data', scanDownKey = 'KEYCODE_SCAN_L_DOWN' } = hongWai || {}
return {
customintent: { // 默认配置
// !!注意: 不同的设备配置项是不同的
scanDownKey,
actionKey,
codeKey,
},
receiver: '',
filter: '',
codeQueryTag: false,
@ -84,11 +82,6 @@
// #endif
},
queryCode: function(code) {
// let { hongWaiSwitch } = getSessionSystemInfo()
// // 红外开启,才可使用该功能
// if(!hongWaiSwitch) {
// return false;
// }
let that = this;
// #ifdef APP
console.log('queryCode');

View File

@ -62,6 +62,12 @@
"style": {
"navigationBarTitleText": "修改密码"
}
},
{
"path": "pages/user/infraredInfo",
"style": {
"navigationBarTitleText": "红外扫码配置"
}
},
{
"path": "pages/user/withdraw",

View File

@ -101,15 +101,15 @@
</u-row>
</u-row>
<u-line></u-line>
<!-- <u-row custom-style="padding: 30rpx;" justify="between">
<u-row @click="goto(`user/infraredInfo`)" custom-style="padding: 30rpx;" justify="between">
<u-row>
<u-image :src="getCdnUrl(`mine/sao.png`)" height="34" width="34"></u-image>
<u-text margin="0 0 0 30rpx" text="红线扫描模式" size="28" color="#333"></u-text>
<u-text margin="0 0 0 30rpx" text="红线扫描" size="28" color="#333"></u-text>
</u-row>
<u-row>
<u-switch v-model="hongWaiSwitch" @change="handleHongWaiChange" active-color="#B12D29" size="34"></u-switch>
<u-icon name="arrow-right" size="32" color="#333"></u-icon>
</u-row>
</u-row> -->
</u-row>
<u-line></u-line>
<u-row @click="goto(`user/updatePassword`)" custom-style="padding: 30rpx;" justify="between">
<u-row>
@ -170,7 +170,6 @@
props: {
},
data() {
let { hongWaiSwitch } = getSessionSystemInfo()
return {
staticInfo: {
commStat: {},
@ -180,7 +179,6 @@
curAppVersion: '',
chkVRes: {},
curDeviceId: '',
hongWaiSwitch,
}
},
onShareAppMessage() {
@ -221,9 +219,6 @@
// TODO
this.showToast('清除成功')
},
handleHongWaiChange(val){
setSessionSystemInfo({ hongWaiSwitch: val })
}
}
}

102
pages/user/infraredInfo.vue Normal file
View File

@ -0,0 +1,102 @@
<template>
<tpx-page>
<tpx-layout>
<template v-slot:body>
<view class="com-jianju pos-rlt pb-30" style="padding-top: 2rpx;">
<view class="blcok-white radius-20">
<view class="">
<view class="">
<view class="mb-10 font-weight">监听扫码事件key</view>
<tpx-input v-model:value="submitParam.actionKey" placeholder="actionKey"></tpx-input>
</view>
<view class="mt-30">
<view class="mb-10 font-weight">扫码结果响应key</view>
<tpx-input v-model:value="submitParam.codeKey" placeholder="codeKey"></tpx-input>
</view>
</view>
</view>
</view>
</template>
<template v-slot:footer>
<view class="blcok-white-noradius">
<u-button @click="handleSubmit()" type="primary" size="large" shape="circle"
custom-style="height:80rpx;font-size: 30rpx;"
>确定</u-button>
</view>
</template>
</tpx-layout>
</tpx-page>
</template>
<script>
import { USERKEY } from "@/store/actionKey"
import { encrypt } from "@/common/libs/jsencrypt_utils"
import { checkParams } from "@/common/validate"
import { setSessionSystemInfo, getSessionSystemInfo } from "@/session"
export default {
props: {
},
computed: {
},
data() {
let { hongWai } = getSessionSystemInfo()
return {
queryOption: {
},
submitParam: {
...(hongWai || {}),
},
submitValidConfig: {
actionKey: { required: true, requiredMsg: 'actionKey不能为空' },
codeKey: { required: true, requiredMsg: 'codeKey不能为空' },
},
}
},
onShareAppMessage() {
return {
// title: '',
// path: 'TODO'
}
},
onLoad(queryOption) {
this.queryOption = queryOption
this.initData();
},
onUnload() {
},
methods: {
async initData() {
},
async handleSubmit() {
await checkParams(this.submitParam, this.submitValidConfig)
setSessionSystemInfo({
hongWai: this.submitParam
})
this.showToast("保存成功")
this.goBack()
},
}
}
</script>
<style lang="scss">
@import '@/common/uni-nvue.scss';
page {
background-color: #F6F6F6;
height: 100% !important;
}
</style>
<style scoped lang="scss">
</style>

View File

@ -38,7 +38,9 @@ export const getSessionLoginInfo = ()=> {
export const setSessionSystemInfo = (val = {})=> {
let oldVal = getSessionSystemInfo()
// {
// hongWaiSwitch: false, // 红外扫描
// hongWai: { // 红外扫描
//},
// lastActiveTime: 时间戳, // 上次活跃时间戳
// }
uni.setStorageSync(SYSTEM_INFO_KEY, { ...oldVal, ...val})
@ -46,6 +48,6 @@ export const setSessionSystemInfo = (val = {})=> {
export const getSessionSystemInfo = ()=> {
return uni.getStorageSync(SYSTEM_INFO_KEY) || {
hongWaiSwitch: false
hongWai: { }
}
}