This commit is contained in:
aihe 2024-06-16 16:08:53 +08:00
parent ae63a9b210
commit 3d09e6d3b9
4 changed files with 33 additions and 8 deletions

View File

@ -3,6 +3,7 @@
</template>
<script>
import { getSessionSystemInfo } from "@/session"
export default {
props: {
customintent: {
@ -30,8 +31,12 @@
}
},
created() {
this.initScan()
this.startScan();
let { hongWaiSwitch } = getSessionSystemInfo()
// 红外开启,才可使用该功能
if(hongWaiSwitch) {
this.initScan()
this.startScan();
}
},
onHide() {
// this.stopScan();

View File

@ -102,7 +102,7 @@
<u-text margin="0 0 0 30rpx" text="红线扫描模式" size="28" color="#333"></u-text>
</u-row>
<u-row>
<u-switch v-model="saomiao" active-color="#B12D29" size="34"></u-switch>
<u-switch v-model="hongWaiSwitch" @change="handleHongWaiChange" active-color="#B12D29" size="34"></u-switch>
</u-row>
</u-row>
<u-line></u-line>
@ -133,6 +133,7 @@
import { USERKEY } from "@/store/actionKey"
import { dealBtnMap } from "@/common/enum"
import * as apiService from "@/common/api"
import { setSessionSystemInfo, getSessionSystemInfo } from "@/session"
import { getAuthList, authCodeEnum } from "@/common/authCode"
import { getCurrentAppInfo, getSystemInfo, checkUpdate } from "@/common/appUpdate"
@ -164,6 +165,7 @@
props: {
},
data() {
let { hongWaiSwitch } = getSessionSystemInfo()
return {
staticInfo: {
commStat: {},
@ -171,8 +173,8 @@
},
saomiao: true,
curAppVersion: '',
curDeviceId: ''
curDeviceId: '',
hongWaiSwitch,
}
},
onShareAppMessage() {
@ -208,7 +210,11 @@
handleClearCache() {
// TODO
this.showToast('清除成功')
},
handleHongWaiChange(val){
setSessionSystemInfo({ hongWaiSwitch: val })
}
}
}
</script>

View File

@ -1,4 +1,4 @@
import { XTOKEN_KEY, USERINFO_KEY, BLUETOOTH_KEY, LOGININFO_KEY } from "./key"
import { XTOKEN_KEY, USERINFO_KEY, BLUETOOTH_KEY, LOGININFO_KEY, SYSTEM_INFO_KEY } from "./key"
export const setSessionXToken = (val = '')=> {
uni.setStorageSync(XTOKEN_KEY, val)
@ -33,4 +33,17 @@ export const getSessionLoginInfo = ()=> {
return uni.getStorageSync(LOGININFO_KEY) || {
remberPassport: []
}
}
}
export const setSessionSystemInfo = (val = {})=> {
// {
// hongWaiSwitch: false, // 红外扫描
// }
uni.setStorageSync(SYSTEM_INFO_KEY, val)
}
export const getSessionSystemInfo = ()=> {
return uni.getStorageSync(SYSTEM_INFO_KEY) || {
hongWaiSwitch: false
}
}

View File

@ -1,4 +1,5 @@
export const XTOKEN_KEY = 'XTOKEN_KEY'
export const USERINFO_KEY = 'USERINFO_KEY'
export const BLUETOOTH_KEY = 'BLUETOOTH_KEY'
export const LOGININFO_KEY = 'LOGININFO_KEY'
export const LOGININFO_KEY = 'LOGININFO_KEY'
export const SYSTEM_INFO_KEY = 'SYSTEM_INFO_KEY'