From a98ea9c3878e41318b85edea2ba0735e2a3e8926 Mon Sep 17 00:00:00 2001 From: abab2320 <1589841436@qq.com> Date: Tue, 1 Apr 2025 16:46:02 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=88=9D=E6=AD=A5?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Front/vue-unilife/package.json | 1 + Front/vue-unilife/pnpm-lock.yaml | 3 + Front/vue-unilife/src/components/LogPage.vue | 4 +- .../src/components/Personal/AcountManager.vue | 187 +++++++++++++++++- .../src/components/Personal/Personal.vue | 16 +- Front/前端环境.md | 9 +- 6 files changed, 202 insertions(+), 18 deletions(-) diff --git a/Front/vue-unilife/package.json b/Front/vue-unilife/package.json index 6b23c2e..b53d3a7 100644 --- a/Front/vue-unilife/package.json +++ b/Front/vue-unilife/package.json @@ -9,6 +9,7 @@ "preview": "vite preview" }, "dependencies": { + "@element-plus/icons-vue": "^2.3.1", "@vue/shared": "^3.5.13", "axios": "^1.8.3", "element-plus": "^2.9.7", diff --git a/Front/vue-unilife/pnpm-lock.yaml b/Front/vue-unilife/pnpm-lock.yaml index 9a44cde..f958087 100644 --- a/Front/vue-unilife/pnpm-lock.yaml +++ b/Front/vue-unilife/pnpm-lock.yaml @@ -8,6 +8,9 @@ importers: .: dependencies: + '@element-plus/icons-vue': + specifier: ^2.3.1 + version: 2.3.1(vue@3.5.13(typescript@5.7.3)) '@vue/shared': specifier: ^3.5.13 version: 3.5.13 diff --git a/Front/vue-unilife/src/components/LogPage.vue b/Front/vue-unilife/src/components/LogPage.vue index 16f4cac..21adf4f 100644 --- a/Front/vue-unilife/src/components/LogPage.vue +++ b/Front/vue-unilife/src/components/LogPage.vue @@ -137,7 +137,7 @@ const onLoginSubmit = () => { if(login_password_email.value == testEmail.value && login_password.value == testPassword.value) { console.log('测试登录成功') console.log(router) - router.push({name:'Personal'}) + router.push({name:'Home'}) } else { login().then((res) => { if(res.code === 200) { @@ -314,7 +314,7 @@ async function login(){ padding: 0; } - body{ + :global(body){ height: 100vh;; /*弹性布局,水平垂直居中*/ display:flex; diff --git a/Front/vue-unilife/src/components/Personal/AcountManager.vue b/Front/vue-unilife/src/components/Personal/AcountManager.vue index 6da00db..f3f925f 100644 --- a/Front/vue-unilife/src/components/Personal/AcountManager.vue +++ b/Front/vue-unilife/src/components/Personal/AcountManager.vue @@ -1,17 +1,190 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/Front/vue-unilife/src/components/Personal/Personal.vue b/Front/vue-unilife/src/components/Personal/Personal.vue index fc8a4ba..2769359 100644 --- a/Front/vue-unilife/src/components/Personal/Personal.vue +++ b/Front/vue-unilife/src/components/Personal/Personal.vue @@ -99,17 +99,17 @@ export default defineComponent({ justify-content:center; align-items:center; font:900 100px ''; - color:rgba(110,90,240,0.3); + color:rgba(175, 90, 240, 0.308); background-color: #e4e9f5; } .shell{ - position:absolute; + position:fixed; top:0%; left:0%; width:84px; height:100%; - background-color:#fff; + background-color:#ead1fb; z-index:9999; transition:width 0.5s; padding-left:10px; @@ -145,7 +145,7 @@ export default defineComponent({ } .active{ - background-color: #e4e9f5; + background-color: #fff; border-top-left-radius: 50px; border-bottom-left-radius: 50px; } @@ -158,7 +158,7 @@ export default defineComponent({ width:30px; height:30px; border-bottom-right-radius:25px; - box-shadow:5px 5px 0 5px #e4e9f5; + box-shadow:5px 5px 0 5px #fff; background:transparent; } @@ -170,7 +170,7 @@ export default defineComponent({ width:30px; height:30px; border-top-right-radius: 25px; - box-shadow:5px -5px 0 5px #e4e9f5; + box-shadow:5px -5px 0 5px #fff; background:transparent; } @@ -194,7 +194,7 @@ export default defineComponent({ height:70px; color:#333; transition:0.5s; - color: rgb(110,90,240) + color: rgb(153, 109, 240) } .icon i{ @@ -218,7 +218,7 @@ export default defineComponent({ .shell ul li:hover a .icon, .shell ul li:hover a .text { - color: #ffa117;/*字体和图标被选中后的颜色 */ + color: #f3e7e9;/*字体和图标被选中后的颜色 */ } .active a .icon::before{ diff --git a/Front/前端环境.md b/Front/前端环境.md index e2facf6..4e311b5 100644 --- a/Front/前端环境.md +++ b/Front/前端环境.md @@ -52,4 +52,11 @@ pnpm add element-plus pnpm i vue-router pnpm add vue-router@4 ``` -用来完成界面跳转,同时完成vuerouter与ts的适配 \ No newline at end of file +用来完成界面跳转,同时完成vuerouter与ts的适配 + + + +### 安装elementplus的icon库 +``` +pnpm install @element-plus/icons-vue +``` \ No newline at end of file From 1351060646f1863bddf71634cfcf652cd4842f4e Mon Sep 17 00:00:00 2001 From: abab2320 <1589841436@qq.com> Date: Mon, 7 Apr 2025 09:25:35 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E7=95=8C=E9=9D=A2=E5=B8=83=E5=B1=80=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/Personal/AcountManager.vue | 621 ++++++++++++++---- 1 file changed, 479 insertions(+), 142 deletions(-) diff --git a/Front/vue-unilife/src/components/Personal/AcountManager.vue b/Front/vue-unilife/src/components/Personal/AcountManager.vue index f3f925f..3066b14 100644 --- a/Front/vue-unilife/src/components/Personal/AcountManager.vue +++ b/Front/vue-unilife/src/components/Personal/AcountManager.vue @@ -15,176 +15,513 @@ export default defineComponent({ \ No newline at end of file From d05eb50b441a61b91dc23b0d6b3fc3e8d78c2eda Mon Sep 17 00:00:00 2001 From: 2991692032 Date: Mon, 7 Apr 2025 10:10:00 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UniLife开发文档.md | 156 +++++++++++++++++- .../unilife/controller/UserController.java | 15 +- 2 files changed, 159 insertions(+), 12 deletions(-) diff --git a/UniLife开发文档.md b/UniLife开发文档.md index fbfdd20..249af4d 100644 --- a/UniLife开发文档.md +++ b/UniLife开发文档.md @@ -66,8 +66,8 @@ | id | BIGINT | PRIMARY KEY, AUTO_INCREMENT | 用户ID | | username | VARCHAR(50) | NOT NULL, UNIQUE | 用户名 | | email | VARCHAR(100) | NOT NULL, UNIQUE | 邮箱地址(学校邮箱) | -| password | VARCHAR(255) | NOT NULL | 密码(加密存储) | -| nickname | VARCHAR(50) | NOT NULL | 昵称 | +| password | VARCHAR(255) | NOT NULL | 密码(加密存储 | +| | | | | | avatar | VARCHAR(255) | | 头像URL | | bio | TEXT | | 个人简介 | | gender | TINYINT | | 性别(0-未知, 1-男, 2-女) | @@ -256,3 +256,155 @@ CREATE TABLE `users` ( } ``` +### 3.2用户信息管理模块 + +#### 3.2.1获取用户个人信息 + +#### 请求信息 + +- **URL**: `/users/profile` +- **方法**: `GET` +- **描述**: 获取当前登录用户的个人资料信息 + +#### 响应结果 + +```json +Copy{ + "code": 200, + "message": "success", + "data": { + "id": 12345, + "username": "student123", + "email": "student@school.edu", + "nickname": "测试员", + "avatar": "https://example.com/avatars/default.png", + "bio": "这是一个个人简介", + "gender": 2, + "studentId": "20220101001", + "department": "计算机学院", + "major": "软件工程", + "grade": "2023级", + "points": 100, + "role": 0, + "isVerified": 1 + } +} +``` + +#### 3.2.2 更新用户个人信息 + +#### 请求信息 + +- **URL**: `/users/profile` +- **方法**: `PUT` +- **描述**: 更新当前登录用户的个人资料 + + + +#### 请求参数 + +```json +Copy{ + "nickname": "新昵称", + "bio": "这是更新后的个人简介", + "gender": 2, + "department": "计算机学院", + "major": "软件工程", + "grade": "2023级" +} +``` + +#### 响应结果 + +```json +Copy{ + "code": 200, + "message": "更新成功", + "data": null +} +``` + +#### 3.2.3 修改用户密码 + +#### 请求信息 + +- **URL**: `/users/password` +- **方法**: `PUT` +- **描述**: 修改当前登录用户的密码 + +#### 请求参数 + +```json +Copy{ + "oldPassword": "旧密码", + "newPassword": "新密码", + "confirmPassword": "确认新密码" +} +``` + +#### 响应结果 + +```json +Copy{ + "code": 200, + "message": "密码修改成功", + "data": null +} +``` + +#### 3.2.4 上传用户头像 + +#### 请求信息 + +- **URL**: `/users/avatar` +- **方法**: `POST` +- **描述**: 上传或更新用户头像 + + + +#### 请求参数 + +``` +Copy + +file: [图片文件] +``` + +#### 响应结果 + +```json +Copy{ + "code": 200, + "message": "头像上传成功", + "data": { + "avatar": "https://example.com/avatars/user_123456.jpg" + } +} +``` + +### 2.5 更新用户邮箱 + +#### 请求信息 + +- **URL**: `/users/email` +- **方法**: `PUT` +- **描述**: 更新用户邮箱地址 + +#### 请求参数 + +```json +Copy{ + "email": "new_email@school.edu", + "code": "123456" // 邮箱验证码 +} +``` + +#### 响应结果 + +```json +Copy{ + "code": 200, + "message": "邮箱更新成功", + "data": null +} +``` diff --git a/unilife-server/src/main/java/com/unilife/controller/UserController.java b/unilife-server/src/main/java/com/unilife/controller/UserController.java index 8e6bd5f..5496c03 100644 --- a/unilife-server/src/main/java/com/unilife/controller/UserController.java +++ b/unilife-server/src/main/java/com/unilife/controller/UserController.java @@ -6,7 +6,6 @@ import com.unilife.model.dto.LoginDTO; import com.unilife.model.dto.LoginEmailDTO; import com.unilife.model.dto.RegisterDTO; import com.unilife.model.vo.LoginVO; -import com.unilife.model.vo.RegisterVO; import com.unilife.service.UserService; import com.unilife.utils.BaseContext; import com.unilife.utils.JwtUtil; @@ -14,14 +13,12 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; -import java.time.Duration; @Api(tags = "用户管理") @@ -34,19 +31,17 @@ public class UserController { private UserService userService; @Autowired private JwtUtil jwtUtil; - @Autowired - private StringRedisTemplate stringRedisTemplate; @ApiOperation(value = "用户注册") @PostMapping("register") - public Result register(@RequestBody RegisterDTO registerDTO, HttpServletRequest request) { + public Result register(@RequestBody RegisterDTO registerDTO, HttpServletRequest request) { return userService.register(registerDTO,request); } @ApiOperation(value = "用户登录") @PostMapping("login") - public Result login(@RequestBody LoginDTO loginDTO,HttpServletRequest request) { - Result login = userService.login(loginDTO,request); + public Result login(@RequestBody LoginDTO loginDTO,HttpServletRequest request) { + Result login = userService.login(loginDTO,request); //登陆成功后生成jwt令牌 LoginVO vo=(LoginVO) login.getData(); if (vo == null) { @@ -63,7 +58,7 @@ public class UserController { @ApiOperation(value = "获取邮箱验证码") @PostMapping("code") - public Result getCode(@RequestBody EmailDTO emailDto,HttpServletRequest request) { + public Result getCode(@RequestBody EmailDTO emailDto,HttpServletRequest request) { String email=emailDto.getEmail(); log.debug("收到的原始邮箱: {}", email); return userService.sendVerificationCode(email,request); @@ -71,7 +66,7 @@ public class UserController { @ApiOperation(value = "邮箱验证码登录") @PostMapping("login/code") - public Result loginWithEmailCode(@RequestBody LoginEmailDTO loginEmailDTO,HttpServletRequest request) { + public Result loginWithEmailCode(@RequestBody LoginEmailDTO loginEmailDTO,HttpServletRequest request) { return userService.loginWithEmail(loginEmailDTO,request); } From 9e7d6170150aea9b09073cfa3e67b36f69b2f9c5 Mon Sep 17 00:00:00 2001 From: abab2320 <1589841436@qq.com> Date: Tue, 8 Apr 2025 08:17:24 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=BC=80=E5=8F=91=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UniLife开发文档.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/UniLife开发文档.md b/UniLife开发文档.md index 249af4d..eb3c115 100644 --- a/UniLife开发文档.md +++ b/UniLife开发文档.md @@ -1,3 +1,5 @@ +[TOC] + ## 一、API规范 ### 1.1 基础信息 @@ -308,9 +310,6 @@ Copy{ "nickname": "新昵称", "bio": "这是更新后的个人简介", "gender": 2, - "department": "计算机学院", - "major": "软件工程", - "grade": "2023级" } ``` @@ -336,9 +335,8 @@ Copy{ ```json Copy{ - "oldPassword": "旧密码", + "code": "验证码", "newPassword": "新密码", - "confirmPassword": "确认新密码" } ```