فهرست منبع

退出时跳转到登出退出页面

louhangfei 1 سال پیش
والد
کامیت
e1bf33d36d
2فایلهای تغییر یافته به همراه10 افزوده شده و 3 حذف شده
  1. 4 3
      src/layout/components/Header/index.vue
  2. 6 0
      src/utils/getRedirectUrl.ts

+ 4 - 3
src/layout/components/Header/index.vue

@@ -226,8 +226,7 @@
   import { ElMessageBox, ElMessage } from 'element-plus';
   import { useDesignSetting } from '@/hooks/setting/useDesignSetting';
   import { Render, getRender } from '@/components/Render';
-  import urlJoin from 'url-join';
-  import { getRedirectUrl } from '@/utils/getRedirectUrl';
+  import { getLogoutUrl, getRedirectUrl } from '@/utils/getRedirectUrl';
   import { useGlobSetting } from '@/hooks/setting';
 
   defineEmits(['update:collapsed']);
@@ -385,7 +384,9 @@
         //     redirect: route.fullPath,
         //   },
         // });
-        window.location.href = getRedirectUrl();
+        const logoutUrl = getLogoutUrl();
+        console.log('logoutUrl', logoutUrl);
+        window.location.href = logoutUrl;
       });
     });
   };

+ 6 - 0
src/utils/getRedirectUrl.ts

@@ -1,4 +1,5 @@
 import { useGlobSetting } from '@/hooks/setting';
+import urlJoin from 'url-join';
 
 const { loginApp } = useGlobSetting();
 
@@ -6,3 +7,8 @@ export const getRedirectUrl = () => {
   const encodeUrl = encodeURIComponent(window.location.href);
   return loginApp + '?redirect=' + encodeUrl;
 };
+
+export const getLogoutUrl = () => {
+  if (!loginApp) return '';
+  return urlJoin(loginApp, 'logout');
+};