refactor: 账号管理功能大体完成,后续优化与细节调整

This commit is contained in:
秋帆
2024-04-21 22:33:48 +08:00
parent 124674c530
commit 875b72b3a0
32 changed files with 1279 additions and 397 deletions

View File

@@ -54,5 +54,5 @@ export interface LoginResp {
// 第三方登录授权类型
export interface SocialAuthAuthorizeResp {
authorizeUrl: string;
}
authorizeUrl: string
}

View File

@@ -7,3 +7,11 @@ const BASE_URL = '/captcha'
export function getImageCaptcha() {
return http.get<Common.ImageCaptchaResp>(`${BASE_URL}/img`)
}
/**@desc 获取手机验证码 */
export function getPhoneCaptcha(query: { phone: string }) {
return http.get<boolean>(`${BASE_URL}/sms`, query)
}
/**@desc 获取邮箱验证码 */
export function getEmailCaptcha(query: { email: string }) {
return http.get<boolean>(`${BASE_URL}/mail`, query)
}

View File

@@ -222,3 +222,8 @@ export interface BasicConfigRecordResp {
site_logo?: string
site_favicon?: string
}
/** 绑定三方账号信息*/
export interface BindSocialAccountRes {
source: string
description: string
}

View File

@@ -37,3 +37,25 @@ export function exportUser(query: System.UserQuery) {
export function resetUserPwd(data: any, id: string) {
return http.patch(`${BASE_URL}/${id}/password`, data)
}
/** @desc 修改用户基础信息 */
export function updateUserBaseInfo(data: { nickname?: string; gender?: number }) {
return http.patch(`${BASE_URL}/basic/info`, data)
}
/** @desc 修改邮箱 */
export function updateUserEmail(data: { newEmail: string; captcha: string; currentPassword: string }) {
return http.patch(`${BASE_URL}/email`, data)
}
/**@desc 绑定三方账号 */
export function bindSocialAccount(source: string, data: any) {
return http.post(`${BASE_URL}/social/${source}`, data)
}
/**@desc 获取绑定的三方账号 */
export function getSocialAccount() {
return http.get<System.BindSocialAccountRes[]>(`${BASE_URL}/social`)
}
/**@desc 解绑三方账号 */
export function unbindSocialAccount(source: string) {
return http.del(`${BASE_URL}/social/${source}`)
}