|
|
@@ -47,12 +47,12 @@ const parseURL = (
|
|
|
return { basePath, paramsObject }
|
|
|
}
|
|
|
// 单点登录token验证函数
|
|
|
-const validateAndLogin = async () => {
|
|
|
+const validateAndLogin = async (code) => {
|
|
|
try {
|
|
|
const userStore = useUserStoreWithOut()
|
|
|
// 调用单点登录接口,传入外部token
|
|
|
// 这里根据你的实际接口调整
|
|
|
- const response = await userStore.ssoLogin()
|
|
|
+ const response = await userStore.ssoLogin(code)
|
|
|
// const response = {
|
|
|
// accessToken: "41f636cc7ff247129e4d4f205bc3a096",
|
|
|
// expiresTime: 1767094239442,
|
|
|
@@ -102,14 +102,14 @@ router.beforeEach(async (to, from, next) => {
|
|
|
loadStart()
|
|
|
|
|
|
const loginType = to.query.loginType as string
|
|
|
-
|
|
|
+ const code = to.query.code as string
|
|
|
// 处理单点登录
|
|
|
- if (loginType == 'cas') {
|
|
|
+ if (loginType == 'cas' && code) {
|
|
|
console.log('检测到SSO登录参数:', loginType )
|
|
|
|
|
|
try {
|
|
|
// 验证token并登录
|
|
|
- const loginSuccess = await validateAndLogin()
|
|
|
+ const loginSuccess = await validateAndLogin(code)
|
|
|
console.log('SSO登录结果:', loginSuccess)
|
|
|
if (loginSuccess) {
|
|
|
// 登录成功,清除URL中的token参数
|