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 @@
+
+ 如果需要创建管理员账号,请先注册一个任意类型的新账号,然后联系网站管理员将您设为管理员
+
-
+
用户注册
{{info}}
@@ -32,7 +37,10 @@
-
+
上传头像
@@ -69,7 +77,7 @@
- 我同意本站的许可条款
+ 我同意本站的许可条款
注册
@@ -93,8 +101,10 @@
}
};
return {
+ fileList:[],
canRegister:false,
loading:false,
+ modal1:false,
info:'',
form: {
username: '',
@@ -171,9 +181,34 @@
}
})
},
- handleSuccess (res, file) {
- console.log(res.data)
+ handleAvatarSuccess(res, file, fileList) {
+ console.log(res)
+ this.form.avatarSrc = res;
+ this.fileList=[]
+ this.$Message.success('上传头像成功!')
},
+ uuid() {
+ var s = [];
+ var hexDigits = "0123456789abcdef";
+ for (var i = 0; i < 36; i++) {
+ s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
+ }
+ s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
+ s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
+ s[8] = s[13] = s[18] = s[23] = "-";
+
+ var uuid = s.join("");
+ return uuid;
+ }
+ },
+ computed:{
+ upData:function () {
+ let uuid=this.uuid();
+ return {
+ path: 'social/',
+ saveName: uuid
+ }
+ }
}
})
diff --git a/src/main/webapp/jsp/account/userCenter.jsp b/src/main/webapp/jsp/account/userCenter.jsp
index f7a8509..1043d75 100644
--- a/src/main/webapp/jsp/account/userCenter.jsp
+++ b/src/main/webapp/jsp/account/userCenter.jsp
@@ -11,169 +11,196 @@
- 用户中心
-
-
-
-
-
-
-
-
-
-
-
+ 用户中心
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
- <%@ include file="/jsp/header.html" %>
-
-
-
-
-
- <%@ include file="/jsp/aside.html" %>
-
-
-
-
-
-
-
-
-
-<%-- :before-upload="beforeAvatarUpload"--%>
- >
-
-
-
-
-
-
-
-
-
-
-
- 修改密码
-
-
-
-
-
- 保存
-
-
-
-
-
+
+
+
+ <%@ include file="/jsp/header.html" %>
+
+
+
+
+
+ <%@ include file="/jsp/aside.html" %>
+
+
+
+
+
+
+
+
+
+ >
+
+
+
+
+
+
+
+
+
+
+
+ 修改密码
+
+
+
+
+
+
+ 保存
+
+
+
+
+
+
+
-
-
+
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 @@
+
+
+ 给与权限
+
+
+ 设为管理员
+
+
@@ -166,6 +174,32 @@
}
})
})
+ },
+ setAdmin(id){
+ this.$messageBox.confirm(
+ '确认要将该用户设置为管理员吗?',
+ '警告',
+ {
+ confirmButtonText: '确认',
+ cancelButtonText: '取消',
+ type: 'warning',
+ }
+ )
+ .then(() => {
+ axios({
+ method: "get",
+ url: "/admin/setAdmin?userId="+id,
+ }).then(res=>{
+ if(res.data==="error")
+ {
+ this.$message.error('设置失败!')
+ }
+ else
+ {
+ this.$message.success('设置成功!')
+ }
+ })
+ })
}
},
computed:{
@@ -196,4 +230,4 @@
app.mount("#app");
-