From 1ce1b525e7470ebaaeb0d5cd1e59bd905c1a7114 Mon Sep 17 00:00:00 2001 From: surprise <15810472099@163.com> Date: 星期二, 05 三月 2024 18:07:32 +0800 Subject: [PATCH] 代码更新 --- src/App.vue | 81 +++++++++++++++++++++++++++++++++++++--- 1 files changed, 74 insertions(+), 7 deletions(-) diff --git a/src/App.vue b/src/App.vue index af410cb..93a9652 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,16 +1,83 @@ <template> - <router-view /> + <div id="app"> + <router-view /> + </div> </template> - <script> -import Index from "./components/index"; +import { rotate } from 'ol/transform'; +import router from './router'; export default { name: "App", - components: { - Index, + computed: {}, + components: {}, + data() { + return {}; }, + created() { + + }, + mounted() { + window.addEventListener('beforeunload', e => { + sessionStorage.setItem('beforeunload', 1); + }); + + // 鐩戝惉椤甸潰鍒锋柊 + if (sessionStorage.getItem('beforeunload') == 1) { + let name = sessionStorage.getItem("routerName"); + + if (name) { + this.$nextTick(function () { + this.$router.push({ path: name }); //濡傛灉sessionStorage瀛樺湪璺敱锛屽幓缂撳瓨鐨勮矾鐢� + }) + } else { + this.$nextTick(function () { + this.$router.push({ path: '/' }); //涓嶅瓨鍦ㄥ瓨鍌紝鍘讳富椤� + }) + } + } + + this.addListenerExpire(); + }, + methods: { + addListenerExpire() { + var timeViewer = setInterval((res) => { + if (this.$store.state.listenTime && window.localStorage.getItem("LFToken")) { + var result = JSON.parse(window.localStorage.getItem("LFToken")) + var time = this.$store.state.listenTime + (parseInt(result.autoLogOut) * 60 * 1000); + var timeire = new Date().getTime(); + var token_time = result.expire; + + if (timeire >= token_time) { + router.push('/login') + localStorage.removeItem("LFToken"); + clearInterval(timeViewer) + } + if (timeire >= time) { + router.push('/login') + localStorage.removeItem("LFToken"); + clearInterval(timeViewer) + } + } + }, 5000) + } + }, + }; </script> - -<style> +<style lang="less" scoped> +// #app { +// font-family: Avenir, Helvetica, Arial, sans-serif; +// -webkit-font-smoothing: antialiased; +// -moz-osx-font-smoothing: grayscale; +// text-align: center; +// color: #2c3e50; +// } +#app { + /*涓夎绠ご鐨勯鑹�*/ + scrollbar-arrow-color: #fff; + /*婊氬姩鏉℃粦鍧楁寜閽殑棰滆壊*/ + scrollbar-face-color: #dfebff; + /*婊氬姩鏉℃暣浣撻鑹�*/ + scrollbar-track-color: #536c97; +} </style> -- Gitblit v1.9.3