| | |
| | | // 设置pageConfig |
| | | this.$store.dispatch('user/changeRealTabsConfig', []); |
| | | }) |
| | | } |
| | | }, |
| | | }, |
| | | computed: { |
| | | processAlarmMsg() { |
| | |
| | | <template> |
| | | <flex-layout class="page-home" no-bg> |
| | | <flex-layout class="page-home" no-bg ref="homeRoot"> |
| | | <page-header |
| | | slot="header" |
| | | :class="{ 'show-drawer': drawer }" |
| | | @handle-message="handleMessage" |
| | | ></page-header> |
| | | <div class="page-home-content" :class="{ 'show-drawer': drawer }"> |
| | | <div ref="homeContent" class="page-home-content" :class="{ 'show-drawer': drawer }"> |
| | | <div class="home-content-mask" v-if="showMash"></div> |
| | | <div class="tab-menu-left" @click="drawer = true"> |
| | | <i class="el-icon-s-operation"></i> |
| | | </div> |
| | |
| | | import marqueeLeft from "@/components/marqueeLeft"; |
| | | import getPageMenu from "@/assets/js/tools/getPageMenu"; |
| | | import { checkUserLogin, getAllRealAlarm } from "@/assets/js/api"; |
| | | import {Timeout} from "@/assets/js/tools"; |
| | | |
| | | let timer; |
| | | export default { |
| | |
| | | tabs: tabs, |
| | | drawer: false, |
| | | timer: "", |
| | | timer2: new Timeout(), |
| | | hdwDialog: false, |
| | | areas: [], |
| | | socket: "", |
| | | path: "ws://localhost:8919/fg/websocket/loginCheck", |
| | | lastTime: new Date().getTime(), |
| | | showMash: false, |
| | | }; |
| | | }, |
| | | watch: { |
| | |
| | | }, 5000); |
| | | }); |
| | | }, |
| | | changeLastTime() { |
| | | this.lastTime = new Date().getTime() |
| | | }, |
| | | listenLastTime() { |
| | | this.timer2.start(()=>{ |
| | | let lastTime = this.lastTime; |
| | | let currentTime = new Date().getTime(); //更新当前时间 |
| | | let timeOut = 30 * 60 * 1000; //设置超时时间: 30分 |
| | | if(currentTime - lastTime > timeOut){ //判断是否超时 |
| | | alert("长时间未操作,自动退出!"); |
| | | this.$router.push("/login"); |
| | | }else if(currentTime - lastTime > timeOut/2) { |
| | | this.showMash = true; |
| | | this.timer2.open(); |
| | | }else{ |
| | | this.showMash = false; |
| | | this.timer2.open(); |
| | | } |
| | | }, 1000); |
| | | |
| | | } |
| | | }, |
| | | computed: { |
| | | showMarqueeLeft() { |
| | |
| | | setInterval(() => { |
| | | this.getAllRealAlarm(); |
| | | }, 1000); |
| | | |
| | | // 开启监控鼠标移动 |
| | | window.addEventListener("mousemove", this.changeLastTime); |
| | | |
| | | // 启动监控 |
| | | this.listenLastTime(); |
| | | }, |
| | | destroyed() {}, |
| | | destroyed() { |
| | | // 移除监控鼠标移动 |
| | | window.removeEventListener("mousemove", this.changeLastTime); |
| | | this.timer2.stop(); |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | |
| | | line-height: 40px; |
| | | text-align: center; |
| | | } |
| | | .home-content-mask { |
| | | position: absolute; |
| | | width: 100%; |
| | | height: 100%; |
| | | z-index: 9999; |
| | | } |
| | | </style> |