diff --git a/commitlint.config.cjs b/commitlint.config.cjs index f30d2852..4ecb995f 100644 --- a/commitlint.config.cjs +++ b/commitlint.config.cjs @@ -21,6 +21,7 @@ module.exports = { "ci", // 修改 CI 配置、脚本 "revert", // 回滚 commit "chore", // 对构建过程或辅助工具和库的更改(不影响源文件、测试用例) + "wip", // 对构建过程或辅助工具和库的更改(不影响源文件、测试用例) ], ], "subject-case": [0], // subject大小写不做校验 diff --git a/src/api/user.ts b/src/api/user.ts index c9a40966..8b00d380 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -136,6 +136,23 @@ class UserAPI { }, }); } + + /** 获取个人中心用户信息 */ + static getProfile(id: number) { + return request({ + url: `${USER_BASE_URL}/${id}/profile`, + method: "get", + }); + } + + /** 修改个人中心用户信息 */ + static updateProfile(id: number, data: UserProfileForm) { + return request({ + url: `${USER_BASE_URL}/${id}/profile`, + method: "put", + data: data, + }); + } } export default UserAPI; @@ -143,7 +160,7 @@ export default UserAPI; /** 登录用户信息 */ export interface UserInfo { /** 用户ID */ - userId?: number; + userId: number; /** 用户名 */ username?: string; @@ -227,3 +244,51 @@ export interface UserForm { /** 用户名 */ username?: string; } + +/** 个人中心用户信息 */ +export interface UserProfileVO { + /** 用户ID */ + id?: number; + + /** 用户名 */ + username?: string; + + /** 昵称 */ + nickname?: string; + + /** 头像URL */ + avatar?: string; + + /** 性别 */ + gender?: number; + + /** 手机号 */ + mobile?: string; + + /** 邮箱 */ + email?: string; +} + +/** 个人中心用户信息表单 */ +export interface UserProfileForm { + /** 用户ID */ + id?: number; + + /** 用户名 */ + username?: string; + + /** 昵称 */ + nickname?: string; + + /** 头像URL */ + avatar?: string; + + /** 性别 */ + gender?: number; + + /** 手机号 */ + mobile?: string; + + /** 邮箱 */ + email?: string; +} diff --git a/src/layout/components/NavBar/components/NavbarAction.vue b/src/layout/components/NavBar/components/NavbarAction.vue index 0e595ee7..1a686b7f 100644 --- a/src/layout/components/NavBar/components/NavbarAction.vue +++ b/src/layout/components/NavBar/components/NavbarAction.vue @@ -77,6 +77,9 @@