feat:增加个人中心:20% 支持左侧的个人信息
This commit is contained in:
@@ -1,2 +1 @@
|
||||
export * from './auth';
|
||||
export * from './user';
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
import type { UserInfo } from '@vben/types';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*/
|
||||
export async function getUserInfoApi() {
|
||||
return requestClient.get<UserInfo>('/system/user/profile/get');
|
||||
}
|
||||
63
apps/web-antd/src/api/system/user/profile/index.ts
Normal file
63
apps/web-antd/src/api/system/user/profile/index.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace SystemUserProfileApi {
|
||||
/** 社交用户信息 */
|
||||
export interface SocialUser {
|
||||
type: number;
|
||||
openid: string;
|
||||
}
|
||||
|
||||
/** 用户个人中心信息 */
|
||||
export interface UserProfileRespVO {
|
||||
id: number;
|
||||
username: string;
|
||||
nickname: string;
|
||||
email?: string;
|
||||
mobile?: string;
|
||||
sex?: number;
|
||||
avatar?: string;
|
||||
loginIp: string;
|
||||
loginDate: string;
|
||||
createTime: string;
|
||||
roles: any[];
|
||||
dept: any;
|
||||
posts: any[];
|
||||
socialUsers: SocialUser[];
|
||||
}
|
||||
|
||||
/** 更新密码请求 */
|
||||
export interface UpdatePasswordReqVO {
|
||||
oldPassword: string;
|
||||
newPassword: string;
|
||||
}
|
||||
|
||||
/** 更新个人信息请求 */
|
||||
export interface UpdateProfileReqVO {
|
||||
nickname: string;
|
||||
email?: string;
|
||||
mobile?: string;
|
||||
sex?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取登录用户信息 */
|
||||
export function getUserProfile() {
|
||||
return requestClient.get<SystemUserProfileApi.UserProfileRespVO>('/system/user/profile/get');
|
||||
}
|
||||
|
||||
/** 修改用户个人信息 */
|
||||
export function updateUserProfile(data: SystemUserProfileApi.UpdateProfileReqVO) {
|
||||
return requestClient.put('/system/user/profile/update', data);
|
||||
}
|
||||
|
||||
/** 修改用户个人密码 */
|
||||
export function updateUserPassword(data: SystemUserProfileApi.UpdatePasswordReqVO) {
|
||||
return requestClient.put('/system/user/profile/update-password', data);
|
||||
}
|
||||
|
||||
/** 上传用户个人头像 */
|
||||
export function updateUserAvatar(file: File) {
|
||||
const formData = new FormData();
|
||||
formData.append('avatarFile', file);
|
||||
return requestClient.put('/system/user/profile/update-avatar', formData);
|
||||
}
|
||||
Reference in New Issue
Block a user