feat(三方登录):新增微信登录功能和三方登录页面配置

This commit is contained in:
Zhunianya
2026-03-10 16:13:31 +08:00
parent 1e362f233b
commit 1630f510da
3 changed files with 988 additions and 377 deletions

View File

@@ -93,12 +93,6 @@ export function bindLogin(data) {
});
}
export function getErrorMsg(errorId) {
return request({
url: '/auth/getErrorMsg/' + errorId,
method: 'get',
});
}
// 三方登录注册绑定
@@ -113,3 +107,103 @@ export function bindRegister(data) {
data: data,
});
}
//短信登录获取验证码
export function getSmsLoginCaptcha(phoneNumber) {
return request({
url: '/notify/smsLoginCaptcha?phoneNumber=' + phoneNumber,
method: 'get',
});
}
// 短信登录
export function smsLogin(data) {
return request({
url: '/auth/sms/login',
method: 'post',
data: data,
});
}
export function getErrorMsg(errorId) {
return request({
url: '/auth/getErrorMsg/' + errorId,
method: 'get',
});
}
// 忘记密码发送短信
export function getSmsForgetPassword(phoneNumber) {
return request({
url: '/notify/smsForgetPassword?phoneNumber=' + phoneNumber,
method: 'get',
});
}
// 忘记密码重置用户密码
export function forgetPwdReset(data) {
return request({
url: '/system/user/forgetPwdReset',
method: 'put',
data: data,
});
}
// ========== OAUTH 2.0 相关 ==========
export function getAuthorize(clientId) {
return request({
url: '/oauth2/authorize?clientId=' + clientId,
method: 'get',
});
}
export function authorize(responseType, clientId, redirectUri, state, autoApprove, checkedScopes, uncheckedScopes) {
// 构建 scopes
const scopes = {};
for (const scope of checkedScopes) {
scopes[scope] = true;
}
for (const scope of uncheckedScopes) {
scopes[scope] = false;
}
// 发起请求
return request({
url: '/oauth2/authorize',
headers: {
'Content-type': 'application/x-www-form-urlencoded',
},
params: {
response_type: responseType,
client_id: clientId,
redirect_uri: redirectUri,
state: state,
auto_approve: autoApprove,
scope: JSON.stringify(scopes),
},
method: 'post',
});
}
//登录
export function oauthLogin(data) {
return request({
url: '/auth/ssoLogin',
method: 'post',
data: data,
});
}
//修改语言
export function changeLanguage(lang) {
return request({
url: '/changeLanguage',
method: 'get',
headers: {
isToken: false,
},
params: {
lang: lang,
},
});
}