修改登录,绑定学生相关界面
This commit is contained in:
+12
-3
@@ -85,7 +85,10 @@ export type RefreshTokenResponse = {
|
||||
* 密码登录
|
||||
*/
|
||||
export function apiLogin(params: LoginParams): Promise<ApiResponse<UserInfo> | null> {
|
||||
return post<UserInfo>('/api/auth/login', params)
|
||||
return post<any>('/api/v1/Parents/Login', { phone: params.phone, password: params.password, loginType: 0 }).then((res) => {
|
||||
if (!res || !res.data) return null
|
||||
return { code: res.code, message: res.message, data: { userId: String(res.data.parentId), phone: res.data.phone, nickname: res.data.name, avatar: '', token: res.data.token, refreshToken: '' } }
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,7 +109,13 @@ export function apiSendCode(params: SendCodeParams): Promise<ApiResponse<SendCod
|
||||
* 注册
|
||||
*/
|
||||
export function apiRegister(params: RegisterParams): Promise<ApiResponse<UserInfo> | null> {
|
||||
return post<UserInfo>('/api/auth/register', params)
|
||||
const relations = ['爸爸', '妈妈', '爷爷', '奶奶', '外公', '外婆', '其他亲属']
|
||||
return post<any>('/api/v1/Parents/Bind', {
|
||||
name: params.parentName,
|
||||
phone: params.phone,
|
||||
password: params.password,
|
||||
students: params.students.map((id) => ({ userId: Number(id), relation: relations.indexOf(params.relationship) + 1 }))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -134,5 +143,5 @@ export function apiRefreshToken(params: RefreshTokenParams): Promise<ApiResponse
|
||||
* 退出登录
|
||||
*/
|
||||
export function apiLogout(): Promise<ApiResponse<null> | null> {
|
||||
return post<null>('/api/auth/logout')
|
||||
return post<null>('/api/v1/Parents/Logout')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user