瀏覽代碼

优化退出登录

li.shaoyi 3 年之前
父節點
當前提交
86862697be
共有 2 個文件被更改,包括 7 次插入10 次删除
  1. 5 10
      src/App.vue
  2. 2 0
      src/services/bus/login.ts

+ 5 - 10
src/App.vue

@@ -22,7 +22,6 @@ import TimerUtils from '@/utils/timer/timerUtil';
 import { Modal } from 'ant-design-vue';
 import zhCN from 'ant-design-vue/es/locale/zh_CN';
 import { defineComponent, onMounted, provide, ref, watchEffect } from 'vue';
-
 let lastTime = new Date().getTime();
 
 // 设置太久没有操作界面,自动退出界面功能
@@ -79,15 +78,11 @@ export default defineComponent({
     eventBus.$on('logout', () => {
       tip.value = '跳转中...';
       spinning.value = true;
-      TimerUtils.setTimeout(
-        () => {
-          TimerUtils.clearAll();
-          spinning.value = false;
-          logout();
-        },
-        1000,
-        'logoutTimer'
-      );
+
+      window.setTimeout(() => {
+        spinning.value = false;
+        logout();
+      }, 1000)
     });
     onMounted(() => {
       setIcon();

+ 2 - 0
src/services/bus/login.ts

@@ -1,4 +1,5 @@
 import APP from '@/services';
+import timerUtil from '@/utils/timer/timerUtil'
 import { isAllEnum } from '@/services/bus/allEnum';
 import { checkTokenAction } from '@/services/bus/token';
 import { getAllEnums, GetPCMenus, getServerTime, queryErrorInfos, QueryTableDefine } from '@/services/go/commonService/index';
@@ -18,6 +19,7 @@ export const logout = (): void => {
     removeLoginData();
     APP.closeServer();
     APP.closeQuote();
+    timerUtil.clearAll();
     Router.replace('/login');
 };