浏览代码

单点登录退出跳转调整

xy 6 天之前
父节点
当前提交
705e4a43bc

+ 1 - 0
yudao-ui-admin-vue3/.env.prod

@@ -54,4 +54,5 @@ VITE_NODE_ENV=prod
 
 # CAS 统一登录平台地址
 VITE_CAS_LOGIN_URL=https://auth.gzsei.work/prod-api/protocols/cas20/login
+VITE_CAS_LOGOUT_URL=https://auth.gzsei.work/prod-api/protocols/cas20/logout
 VITE_CAS_SERVICE_URL=http://192.168.19.165:40081

+ 5 - 5
yudao-ui-admin-vue3/src/layout/components/UserInfo/src/UserInfo.vue

@@ -43,14 +43,14 @@ const loginOut = async () => {
     })
     await userStore.loginOut()
     tagsViewStore.delAllViews()
-    // 优先跳转到CAS统一登录平台,未配置则回退到系统登录页
-    const casLoginUrl = import.meta.env.VITE_CAS_LOGIN_URL
-    if (casLoginUrl) {
+    // 优先跳转到CAS统一登录平台,未配置则回退到系统登录页 跳转到退出页
+    const casLogoutUrl = import.meta.env.VITE_CAS_LOGOUT_URL
+    if (casLogoutUrl) {
       const serviceUrl = import.meta.env.VITE_CAS_SERVICE_URL
       if (serviceUrl) {
-        window.location.href = `${casLoginUrl}?service=${encodeURIComponent(serviceUrl)}`
+        window.location.href = `${casLogoutUrl}?service=${encodeURIComponent(serviceUrl)}`
       } else {
-        window.location.href = casLoginUrl
+        window.location.href = casLogoutUrl
       }
     } else {
       replace('/login?redirect=/index')

+ 1 - 0
yudao-ui-admin-vue3/types/env.d.ts

@@ -29,6 +29,7 @@ interface ImportMetaEnv {
   readonly VITE_SPREADJS_DESIGNER_KEY: string
   readonly VITE_CAS_LOGIN_URL: string
   readonly VITE_CAS_SERVICE_URL: string
+  readonly VITE_CAS_LOGOUT_URL: string
 }
 
 declare global {