diff --git a/src/api/system/social/auth.ts b/src/api/system/social/auth.ts index 17a46d3..69f0d7e 100644 --- a/src/api/system/social/auth.ts +++ b/src/api/system/social/auth.ts @@ -1,10 +1,14 @@ import request from '@/utils/request'; // 绑定账号 -export function authBinding(source: string) { +export function authBinding(source: string, tenantId: string) { return request({ url: '/auth/binding/' + source, - method: 'get' + method: 'get', + params: { + tenantId: tenantId, + domain: window.location.host + } }); } diff --git a/src/layout/components/SocialCallback/index.vue b/src/layout/components/SocialCallback/index.vue index 7edae44..1cfeca8 100644 --- a/src/layout/components/SocialCallback/index.vue +++ b/src/layout/components/SocialCallback/index.vue @@ -17,8 +17,9 @@ const loading = ref(true); const code = route.query.code as string; const state = route.query.state as string; const source = route.query.source as string; -const tenantId = route.query.tenantId as string ? route.query.tenantId as string : '000000'; -const domain = route.query.domain as string; +const stateJson = JSON.parse(atob(state)); +const tenantId = stateJson.tenantId as string ? stateJson.tenantId as string : '000000'; +const domain = stateJson.domain as string; const processResponse = async (res: any) => { if (res.code !== 200) { @@ -67,6 +68,7 @@ const init = async () => { let urlFull = new URL(window.location.href); urlFull.host = domain; window.location.href = urlFull.toString(); + return; } const data: LoginData = { diff --git a/src/views/login.vue b/src/views/login.vue index 02c7d77..ca2903f 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -191,10 +191,10 @@ const initTenantList = async () => { * @param type */ const doSocialLogin = (type: string) => { - authBinding(type).then((res: any) => { + authBinding(type, loginForm.value.tenantId).then((res: any) => { if (res.code === HttpStatus.SUCCESS) { // 获取授权地址跳转 - window.location.href = res.data + '&tenantId=' + loginForm.value.tenantId + '&domain=' + window.location.host; + window.location.href = res.data; } else { ElMessage.error(res.msg); } diff --git a/src/views/system/user/profile/thirdParty.vue b/src/views/system/user/profile/thirdParty.vue index ad090c4..957122a 100644 --- a/src/views/system/user/profile/thirdParty.vue +++ b/src/views/system/user/profile/thirdParty.vue @@ -84,9 +84,9 @@ const unlockAuth = (row: any) => { }; const authUrl = (source: string) => { - authBinding(source).then((res: any) => { + authBinding(source, useUserStore().tenantId).then((res: any) => { if (res.code === 200) { - window.location.href = res.data + '&tenantId=' + useUserStore().tenantId + '&domain=' + window.location.host; + window.location.href = res.data; } else { proxy?.$modal.msgError(res.msg); }