feat: 社交平台登录

This commit is contained in:
dhb52
2023-10-15 14:26:20 +08:00
parent 889334bc37
commit 4d77d7e136
6 changed files with 369 additions and 5 deletions

View File

@ -284,8 +284,13 @@ const doSocialLogin = async (type: number) => {
})
}
// 计算 redirectUri
// tricky: type、redirect需要先encode一次否则钉钉回调会丢失。
// 配合 Login/SocialLogin.vue#getUrlValue() 使用
const redirectUri =
location.origin + '/social-login?type=' + type + '&redirect=' + (redirect.value || '/')
location.origin +
'/social-login?' +
encodeURIComponent(`type=${type}&redirect=${redirect.value || '/'}`)
// 进行跳转
const res = await LoginApi.socialAuthRedirect(type, encodeURIComponent(redirectUri))
window.location.href = res