Prechádzať zdrojové kódy

添加退出登录功能

huangbin 4 rokov pred
rodič
commit
4e2df62ada
1 zmenil súbory, kde vykonal 10 pridanie a 3 odobranie
  1. 10 3
      src/layout/components/header.vue

+ 10 - 3
src/layout/components/header.vue

@@ -50,6 +50,9 @@ import { openModal } from '@/common/setup/modal/index';
 import { UserOutlined } from '@ant-design/icons-vue';
 import Setting from '@/views/setting/index.vue';
 import { getUserName } from '@/services/bus/user';
+import { logout } from '@/services/bus/login';
+import APP from '@/services';
+import Router from '@/router';
 
 // 设置
 const setFn = () => {
@@ -66,9 +69,13 @@ const setFn = () => {
     ];
     const { openAction } = openModal('logout');
     function chooseSetMenu(path: string) {
-        // chooseSetupItem.value = path;
-        openAction();
-        console.log(path);
+        if (path === 'logout') {
+            logout();
+            APP.closeServer();
+            Router.replace('/login');
+        } else {
+            openAction();
+        }
         visible.value = false;
     }