chushihua

This commit is contained in:
li
2026-01-26 23:20:48 +08:00
commit 7b5aab0206
22521 changed files with 3300090 additions and 0 deletions
+90
View File
@@ -0,0 +1,90 @@
<template>
<div id="app" @click="getLastTime">
<router-view/>
</div>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'App',
data(){
return {
routeName: null,
lastTime:localStorage.getItem("lastTime"),
currentTime: new Date().getTime(),
timeOut :5*60*1000 //设置超时时间: 5分
}
},
mounted: function() {
var _this=this;
clearInterval(window['checkLoginTime']);
setTimeout(function(){
if(_this.routeName!="login"&&_this.webconfig.isSetExpired&&_this.routeName!="play_tel"){
window['checkLoginTime']= window.setInterval(_this.checkTimeout, 10000);
}
},0)
},
methods: {
getLastTime:function(){
var _this=this;
if(_this.routeName!="login"&&_this.webconfig.isSetExpired&&_this.routeName!="play_tel"){
localStorage.setItem("lastTime", new Date().getTime());
/* 定时器 间隔30秒检测是否长时间未操作页面 */
clearInterval(window['checkLoginTime']);
window['checkLoginTime'] = window.setInterval(_this.checkTimeout, 10000);
// debugger;
}
},
checkTimeout() {
var _this=this;
_this.currentTime = new Date().getTime(); //更新当前时间
_this.lastTime = localStorage.getItem("lastTime");
if (Number(_this.currentTime) - Number(_this.lastTime) > _this.timeOut) { //判断是否超时
console.log("超时");
this.$message.error('长时间没操作,请重新登录!');
this.$cookies.remove('userInfo');
this.$router.push('/');
localStorage.removeItem('lastTime');
clearInterval(window['checkLoginTime']);
window.location.reload();
}
}
},
computed: {
...mapState(['webconfig'])
},
watch:{
$route:{
handler: function(newData){
var _this=this;
this.routeName=newData.name;
var table_id=0;
// 判断台名 传tab_id
if(newData.name=='play'){
table_id=parseInt(this.$route.query.table);
}else{
table_id=0;
}
this.$store.dispatch('updateKeepline',table_id);
},
immediate:true
},
}
}
</script>
<style>
</style>