From 94ccb9a657c22cb9ee2778d8a2208fc5f9c0bca2 Mon Sep 17 00:00:00 2001 From: PeterAlbus Date: Thu, 23 Dec 2021 15:59:29 +0800 Subject: [PATCH] finished avatar upload and some little functions. --- .../controller/AdminController.java | 10 + .../com/peteralbus/service/UserService.java | 7 + src/main/webapp/jsp/account/register.jsp | 45 ++- src/main/webapp/jsp/account/userCenter.jsp | 329 ++++++++++-------- src/main/webapp/jsp/admin/users.jsp | 36 +- src/main/webapp/jsp/header.html | 2 +- src/main/webapp/jsp/teacher/manageGroup.jsp | 6 +- .../webapp/jsp/teacher/modifyActivity.jsp | 6 +- 8 files changed, 281 insertions(+), 160 deletions(-) diff --git a/src/main/java/com/peteralbus/controller/AdminController.java b/src/main/java/com/peteralbus/controller/AdminController.java index 109c4e6..229f684 100644 --- a/src/main/java/com/peteralbus/controller/AdminController.java +++ b/src/main/java/com/peteralbus/controller/AdminController.java @@ -76,4 +76,14 @@ public class AdminController } return "error"; } + @ResponseBody + @RequestMapping("/setAdmin") + public String setAdmin(Long userId) + { + if(userService.setAdmin(userId)>0) + { + return "success"; + } + return "error"; + } } diff --git a/src/main/java/com/peteralbus/service/UserService.java b/src/main/java/com/peteralbus/service/UserService.java index a120f92..fa2be04 100644 --- a/src/main/java/com/peteralbus/service/UserService.java +++ b/src/main/java/com/peteralbus/service/UserService.java @@ -93,4 +93,11 @@ public class UserService { return userDao.selectById(userId); } + + public int setAdmin(Long userId) + { + User user=userDao.selectById(userId); + user.setUserClass(0); + return userDao.updateById(user); + } } diff --git a/src/main/webapp/jsp/account/register.jsp b/src/main/webapp/jsp/account/register.jsp index 3cd95e6..84bd307 100644 --- a/src/main/webapp/jsp/account/register.jsp +++ b/src/main/webapp/jsp/account/register.jsp @@ -20,11 +20,16 @@
+ +

如果需要创建管理员账号,请先注册一个任意类型的新账号,然后联系网站管理员将您设为管理员

+
diff --git a/src/main/webapp/jsp/admin/users.jsp b/src/main/webapp/jsp/admin/users.jsp index d42c5c1..6237417 100644 --- a/src/main/webapp/jsp/admin/users.jsp +++ b/src/main/webapp/jsp/admin/users.jsp @@ -73,6 +73,14 @@ + + + +