From 674629269c729dae1b39657da77a8e5edb4989b9 Mon Sep 17 00:00:00 2001 From: ray <1490493387@qq.com> Date: Wed, 14 Aug 2024 08:21:38 +0800 Subject: [PATCH] =?UTF-8?q?wip:=20:construction:=20=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commitlint.config.cjs | 1 + src/api/user.ts | 67 ++++++++++++++++++- .../NavBar/components/NavbarAction.vue | 8 +++ src/views/demo/websocket.vue | 21 +++--- src/views/profile/index.vue | 31 ++++----- vite.config.ts | 1 + 6 files changed, 101 insertions(+), 28 deletions(-) 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 @@