update 优化 三方登录不同域名获取不到租户id问题

This commit is contained in:
疯狂的狮子Li 2024-06-18 18:44:17 +08:00
parent 3c713c9258
commit 72610ab194
2 changed files with 8 additions and 12 deletions

View File

@ -17,18 +17,22 @@ const loading = ref(true);
const code = route.query.code as string; const code = route.query.code as string;
const state = route.query.state as string; const state = route.query.state as string;
const source = route.query.source as string; const source = route.query.source as string;
const tenantId = localStorage.getItem('tenantId') ? (localStorage.getItem('tenantId') as string) : '000000'; const tenantId = route.query.tenantId as string ? route.query.tenantId as string : '000000';
const processResponse = async (res: any) => { const processResponse = async (res: any) => {
if (res.code !== 200) { if (res.code !== 200) {
throw new Error(res.msg); throw new Error(res.msg);
} }
if (res.data !== null) { if (res.data !== null && res.data.access_token !== null) {
setToken(res.data.access_token); setToken(res.data.access_token);
} }
ElMessage.success(res.msg); ElMessage.success(res.msg);
setTimeout(() => { setTimeout(() => {
location.href = import.meta.env.VITE_APP_CONTEXT_PATH + 'index'; if (res.data !== null && res.data.domain !== null) {
location.href = res.data.domain + import.meta.env.VITE_APP_CONTEXT_PATH + 'index';
} else {
location.href = import.meta.env.VITE_APP_CONTEXT_PATH + 'index';
}
}, 2000); }, 2000);
}; };

View File

@ -186,14 +186,6 @@ const initTenantList = async () => {
} }
}; };
//
watch(
() => loginForm.value.tenantId,
() => {
localStorage.setItem('tenantId', String(loginForm.value.tenantId));
}
);
/** /**
* 第三方登录 * 第三方登录
* @param type * @param type
@ -202,7 +194,7 @@ const doSocialLogin = (type: string) => {
authBinding(type).then((res: any) => { authBinding(type).then((res: any) => {
if (res.code === HttpStatus.SUCCESS) { if (res.code === HttpStatus.SUCCESS) {
// //
window.location.href = res.data; window.location.href = res.data + '&tenantId=' + loginForm.value.tenantId;
} else { } else {
ElMessage.error(res.msg); ElMessage.error(res.msg);
} }