uu
This commit is contained in:
parent
14e63a4959
commit
6d9e6a2b16
16
App.vue
16
App.vue
@ -8,6 +8,7 @@
|
||||
// import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
|
||||
import { USERKEY, COMMONKEY } from "@/store/actionKey"
|
||||
import { checkUpdate } from "@/common/appUpdate"
|
||||
import { setSessionSystemInfo, getSessionSystemInfo } from "@/session"
|
||||
import { onPushMessage } from "@/common/messageNotice"
|
||||
|
||||
export default {
|
||||
@ -49,9 +50,11 @@
|
||||
},
|
||||
onShow: function() {
|
||||
console.log('HHH Show')
|
||||
this.updateActiveTime()
|
||||
this.appCheckUpdate()
|
||||
},
|
||||
onHide: function() {
|
||||
this.updateActiveTime({ directUpdate: true })
|
||||
console.log('HHH Hide')
|
||||
},
|
||||
globalData: {
|
||||
@ -68,6 +71,19 @@
|
||||
// }
|
||||
checkUpdate()
|
||||
// #endif
|
||||
},
|
||||
async updateActiveTime(opt = {}){
|
||||
let { directUpdate } = opt
|
||||
let { lastActiveTime } = getSessionSystemInfo()
|
||||
let curTime = new Date().valueOf()
|
||||
let diff = (curTime - lastActiveTime)
|
||||
// 活跃时间间隔超过一个小时 需要重新登录
|
||||
if(diff > 1000 * 60 * 60 && !directUpdate) {
|
||||
await this.$store.dispatch(USERKEY.LOGOUT)
|
||||
this.goto(`login/login`, 2)
|
||||
} else {
|
||||
setSessionSystemInfo({ lastActiveTime: curTime })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,6 +38,7 @@ export const getSessionLoginInfo = ()=> {
|
||||
export const setSessionSystemInfo = (val = {})=> {
|
||||
// {
|
||||
// hongWaiSwitch: false, // 红外扫描
|
||||
// lastActiveTime: 时间戳, // 上次活跃时间戳
|
||||
// }
|
||||
uni.setStorageSync(SYSTEM_INFO_KEY, val)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user