update 优化 三方登录不同域名获取不到租户id问题
This commit is contained in:
parent
3c713c9258
commit
72610ab194
@ -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);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user