emis-app/session/index.js

54 lines
1.2 KiB
JavaScript
Raw Normal View History

2024-06-16 08:08:53 +00:00
import { XTOKEN_KEY, USERINFO_KEY, BLUETOOTH_KEY, LOGININFO_KEY, SYSTEM_INFO_KEY } from "./key"
2024-02-21 12:23:38 +00:00
export const setSessionXToken = (val = '')=> {
uni.setStorageSync(XTOKEN_KEY, val)
}
export const getSessionXToken = ()=> {
return uni.getStorageSync(XTOKEN_KEY) || ''
2024-02-21 12:23:38 +00:00
}
export const setSessionUserInfo = (val = {})=> {
uni.setStorageSync(USERINFO_KEY, val)
}
export const getSessionUserInfo = ()=> {
return uni.getStorageSync(USERINFO_KEY) || {}
2024-05-12 16:49:19 +00:00
}
export const setSessionBluetoothInfo = (val = {})=> {
uni.setStorageSync(BLUETOOTH_KEY, val)
}
export const getSessionBluetoothInfo = ()=> {
return uni.getStorageSync(BLUETOOTH_KEY) || {}
2024-05-25 08:57:03 +00:00
}
export const setSessionLoginInfo = (val = {})=> {
uni.setStorageSync(LOGININFO_KEY, val)
}
export const getSessionLoginInfo = ()=> {
return uni.getStorageSync(LOGININFO_KEY) || {
remberPassport: []
}
2024-06-16 08:08:53 +00:00
}
export const setSessionSystemInfo = (val = {})=> {
2024-08-05 14:51:32 +00:00
let oldVal = getSessionSystemInfo()
2024-06-16 08:08:53 +00:00
// {
2024-10-12 08:48:47 +00:00
// hongWai: { // 红外扫描
//},
2024-07-30 06:01:00 +00:00
// lastActiveTime: 时间戳, // 上次活跃时间戳
2024-06-16 08:08:53 +00:00
// }
2024-08-05 14:51:32 +00:00
uni.setStorageSync(SYSTEM_INFO_KEY, { ...oldVal, ...val})
2024-06-16 08:08:53 +00:00
}
export const getSessionSystemInfo = ()=> {
return uni.getStorageSync(SYSTEM_INFO_KEY) || {
2024-10-12 08:48:47 +00:00
hongWai: { }
2024-06-16 08:08:53 +00:00
}
}