dashboard for student/teacher

Signed-off-by: Chenx221 <chenx221@yandex.com>
This commit is contained in:
Chenx221 2023-06-17 11:39:21 +08:00
parent ec49018b9b
commit d3aea486af
12 changed files with 537 additions and 18 deletions

View File

@ -21,6 +21,8 @@
<security:csrf disabled="true"/> <security:csrf disabled="true"/>
<!-- 限制访问↓--> <!-- 限制访问↓-->
<security:intercept-url pattern="/dashboard" access="hasRole('admin')"/> <security:intercept-url pattern="/dashboard" access="hasRole('admin')"/>
<security:intercept-url pattern="/dashboard-t" access="hasRole('teacher')"/>
<security:intercept-url pattern="/dashboard-s" access="hasRole('student')"/>
<security:intercept-url pattern="/student/**" access="hasRole('admin')"/> <security:intercept-url pattern="/student/**" access="hasRole('admin')"/>
<security:intercept-url pattern="/course/**" access="hasRole('admin')"/> <security:intercept-url pattern="/course/**" access="hasRole('admin')"/>
<security:intercept-url pattern="/score/**" access="hasRole('admin')"/> <security:intercept-url pattern="/score/**" access="hasRole('admin')"/>

View File

@ -0,0 +1,113 @@
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<title>面板</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700;900&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/mdb.min.css" />
</head>
<body style="font-family: 'Noto Sans SC Regular',serif">
<!--Main Navigation-->
<header>
<nav class="navbar navbar-expand-lg navbar-light bg-light" style="z-index: 1;min-height: 58.59px">
<div class="container">
<button class="navbar-toggler" type="button" data-mdb-toggle="collapse"
data-mdb-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<i class="fas fa-bars"></i>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<a class="navbar-brand mt-2 mt-lg-0" href="#">
<i class="fas fa-chalkboard-user me-2"></i>
教务管理系统
</a>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="/dashboard">首页</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown1" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
学生管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown1">
<li><a class="dropdown-item" href="/student/all">学生信息显示</a></li>
<li><a class="dropdown-item" href="/student/infomodv2">学生信息修改</a></li>
<li>
<hr class="dropdown-divider" />
</li>
<li><a class="dropdown-item" href="/score/all">成绩查看</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown3" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
课程管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown3">
<li><a class="dropdown-item" href="/course/all">课程查看</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown4" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
系统管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown4">
<li><a class="dropdown-item" href="#">个人设定</a></li>
<li><a class="dropdown-item" href="#">版本信息</a></li>
</ul>
</li>
</ul>
</div>
<div class="dropdown">
<a class="dropdown-toggle d-flex align-items-center hidden-arrow" href="#"
id="navbarDropdownMenuAvatar" role="button" data-mdb-toggle="dropdown" aria-expanded="false">
<i class="fas fa-circle-user fa-lg me-1"></i>
${username}
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownMenuAvatar">
<li>
<a class="dropdown-item" href="${pageContext.request.contextPath}/logout">登出</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<!--Main Navigation-->
<!--Main layout-->
<main>
<div class="bg-image shadow-2-strong vh-100"
style="background-image: url('${pageContext.request.contextPath}/resources/img/jason-blackeye-nyL-rzwP-Mk-unsplash.jpg');margin-top: -58.59px;">
<div class="mask d-flex align-items-center h-100" style="background-color: hsla(0, 0%, 100%, 0.5);">
</div>
</div>
</main>
<!--Main layout-->
<!-- Footer -->
<footer class="bg-link text-center text-lg-start ">
</footer>
<!-- Footer -->
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/js/mdb.min.js"></script>
</body>
</html>

View File

@ -0,0 +1,116 @@
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<title>面板</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700;900&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/mdb.min.css" />
</head>
<body style="font-family: 'Noto Sans SC Regular',serif">
<!--Main Navigation-->
<header>
<nav class="navbar navbar-expand-lg navbar-light bg-light" style="z-index: 1;min-height: 58.59px">
<div class="container">
<button class="navbar-toggler" type="button" data-mdb-toggle="collapse"
data-mdb-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<i class="fas fa-bars"></i>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<a class="navbar-brand mt-2 mt-lg-0" href="#">
<i class="fas fa-chalkboard-user me-2"></i>
教务管理系统
</a>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="/dashboard">首页</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown1" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
学生管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown1">
<li><a class="dropdown-item" href="/student/all">学生信息显示</a></li>
<li><a class="dropdown-item" href="/student/queryinfo">学生信息查询</a></li>
<li><a class="dropdown-item" href="/student/modstep1">学生信息修改(旧)</a></li>
<li><a class="dropdown-item" href="/student/infomodv2">学生信息修改</a></li>
<li>
<hr class="dropdown-divider" />
</li>
<li><a class="dropdown-item" href="/score/all">成绩查看</a></li>
<li><a class="dropdown-item" href="/score/infomodv2">成绩管理</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown3" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
课程管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown3">
<li><a class="dropdown-item" href="/course/all">课程查看</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown4" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
系统管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown4">
<li><a class="dropdown-item" href="#">个人设定</a></li>
<li><a class="dropdown-item" href="#">版本信息</a></li>
</ul>
</li>
</ul>
</div>
<div class="dropdown">
<a class="dropdown-toggle d-flex align-items-center hidden-arrow" href="#"
id="navbarDropdownMenuAvatar" role="button" data-mdb-toggle="dropdown" aria-expanded="false">
<i class="fas fa-circle-user fa-lg me-1"></i>
${username}
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownMenuAvatar">
<li>
<a class="dropdown-item" href="${pageContext.request.contextPath}/logout">登出</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<!--Main Navigation-->
<!--Main layout-->
<main>
<div class="bg-image shadow-2-strong vh-100"
style="background-image: url('${pageContext.request.contextPath}/resources/img/jason-blackeye-nyL-rzwP-Mk-unsplash.jpg');margin-top: -58.59px;">
<div class="mask d-flex align-items-center h-100" style="background-color: hsla(0, 0%, 100%, 0.5);">
</div>
</div>
</main>
<!--Main layout-->
<!-- Footer -->
<footer class="bg-link text-center text-lg-start ">
</footer>
<!-- Footer -->
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/js/mdb.min.js"></script>
</body>
</html>

View File

@ -101,11 +101,13 @@
<h1 class="text-center mb-4" style="font-family: 'Noto Sans SC Light',serif"> <h1 class="text-center mb-4" style="font-family: 'Noto Sans SC Light',serif">
用户登录</h1> 用户登录</h1>
<div class="form-outline mb-4"> <div class="form-outline mb-4">
<input type="text" id="form1Example1" class="form-control" name="username" required/> <input type="text" id="form1Example1" class="form-control" name="username"
required/>
<label class="form-label" for="form1Example1">用户名</label> <label class="form-label" for="form1Example1">用户名</label>
</div> </div>
<div class="form-outline mb-4"> <div class="form-outline mb-4">
<input type="password" id="form1Example2" class="form-control" name="password" required/> <input type="password" id="form1Example2" class="form-control" name="password"
required/>
<label class="form-label" for="form1Example2">密码</label> <label class="form-label" for="form1Example2">密码</label>
</div> </div>
<div class="row mb-4"> <div class="row mb-4">
@ -118,12 +120,12 @@
</div> </div>
</div> </div>
<div class="col"> <div class="col">
<a href="#!">忘记密码?</a> <a href="#" onclick="showNote()">忘记密码?</a>
</div> </div>
</div> </div>
<button type="submit" class="btn btn-primary btn-block mb-4">登录</button> <button type="submit" class="btn btn-primary btn-block mb-4">登录</button>
<div class="text-center" style="margin-bottom: 25px;"> <div class="text-center" style="margin-bottom: 25px;">
<p>还没有账号? <a href="#!">注册一个</a></p> <p>还没有账号? <a href="#" onclick="showReg()">注册一个</a></p>
</div> </div>
</form> </form>
</div> </div>
@ -133,15 +135,18 @@
<h1 class="text-center mb-4" style="font-family: 'Noto Sans SC Light',serif"> <h1 class="text-center mb-4" style="font-family: 'Noto Sans SC Light',serif">
用户注册</h1> 用户注册</h1>
<div class="form-outline mb-4"> <div class="form-outline mb-4">
<input type="text" id="registerUsername" class="form-control" name="username" required/> <input type="text" id="registerUsername" class="form-control" name="username"
required/>
<label class="form-label" for="registerUsername">用户名</label> <label class="form-label" for="registerUsername">用户名</label>
</div> </div>
<div class="form-outline mb-4"> <div class="form-outline mb-4">
<input type="password" id="registerPassword" class="form-control" name="password" required/> <input type="password" id="registerPassword" class="form-control"
name="password" required/>
<label class="form-label" for="registerPassword">密码</label> <label class="form-label" for="registerPassword">密码</label>
</div> </div>
<div class="form-outline mb-4"> <div class="form-outline mb-4">
<input type="password" id="registerRepeatPassword" class="form-control" name="re-password" required/> <input type="password" id="registerRepeatPassword" class="form-control"
name="re-password" required/>
<label class="form-label" for="registerRepeatPassword">重复密码</label> <label class="form-label" for="registerRepeatPassword">重复密码</label>
</div> </div>
<div class="form-check d-flex justify-content-center mb-4"> <div class="form-check d-flex justify-content-center mb-4">
@ -234,7 +239,12 @@
$('#exampleModal2').modal('show'); $('#exampleModal2').modal('show');
</c:if> </c:if>
}); });
function showNote() {
alert("功能尚未实现,请联系管理员重置密码");
}
function showReg(){
document.getElementById("tab-register").click();
}
</script> </script>
</body> </body>
</html> </html>

View File

@ -28,4 +28,23 @@ public class ViewController {
return "dashboard"; // 返回 dashboard 视图名 return "dashboard"; // 返回 dashboard 视图名
} }
@RequestMapping(path = "/dashboard-t", method = {RequestMethod.GET, RequestMethod.POST})
public String showDashboardT(Model model) {
String username = new UsernameHelper().getCurrentUsername();
if (username != null) {
model.addAttribute("username", username);
}
// model.addAttribute("errorMessage","null");
return "dashboard_t"; // 返回 dashboard 视图名
}
@RequestMapping(path = "/dashboard-s", method = {RequestMethod.GET, RequestMethod.POST})
public String showDashboardS(Model model) {
String username = new UsernameHelper().getCurrentUsername();
if (username != null) {
model.addAttribute("username", username);
}
// model.addAttribute("errorMessage","null");
return "dashboard_s"; // 返回 dashboard 视图名
}
} }

View File

@ -1,6 +1,7 @@
package cyou.chenx221.handler; package cyou.chenx221.handler;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler; import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -8,13 +9,30 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Collection;
@Component @Component
public class CustomAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler { public class CustomAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
@Override @Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
// 移除 errorMessage 属性
request.getSession().removeAttribute("errorMessage"); request.getSession().removeAttribute("errorMessage");
Collection<? extends GrantedAuthority> authorities = authentication.getAuthorities();
for (GrantedAuthority authority : authorities) {
if (authority.getAuthority().equals("ROLE_admin")) {
response.sendRedirect("/dashboard");
return;
} else if (authority.getAuthority().equals("ROLE_teacher")) {
response.sendRedirect("/dashboard-t");
return;
} else if (authority.getAuthority().equals("ROLE_student")) {
response.sendRedirect("/dashboard-s");
return;
}
}
// 如果没有匹配的角色或者无法确定跳转的目标页面则默认跳转到 "/dashboard"
super.onAuthenticationSuccess(request, response, authentication); super.onAuthenticationSuccess(request, response, authentication);
} }
} }

View File

@ -21,6 +21,8 @@
<security:csrf disabled="true"/> <security:csrf disabled="true"/>
<!-- 限制访问↓--> <!-- 限制访问↓-->
<security:intercept-url pattern="/dashboard" access="hasRole('admin')"/> <security:intercept-url pattern="/dashboard" access="hasRole('admin')"/>
<security:intercept-url pattern="/dashboard-t" access="hasRole('teacher')"/>
<security:intercept-url pattern="/dashboard-s" access="hasRole('student')"/>
<security:intercept-url pattern="/student/**" access="hasRole('admin')"/> <security:intercept-url pattern="/student/**" access="hasRole('admin')"/>
<security:intercept-url pattern="/course/**" access="hasRole('admin')"/> <security:intercept-url pattern="/course/**" access="hasRole('admin')"/>
<security:intercept-url pattern="/score/**" access="hasRole('admin')"/> <security:intercept-url pattern="/score/**" access="hasRole('admin')"/>

View File

@ -0,0 +1,113 @@
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<title>面板</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700;900&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/mdb.min.css" />
</head>
<body style="font-family: 'Noto Sans SC Regular',serif">
<!--Main Navigation-->
<header>
<nav class="navbar navbar-expand-lg navbar-light bg-light" style="z-index: 1;min-height: 58.59px">
<div class="container">
<button class="navbar-toggler" type="button" data-mdb-toggle="collapse"
data-mdb-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<i class="fas fa-bars"></i>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<a class="navbar-brand mt-2 mt-lg-0" href="#">
<i class="fas fa-chalkboard-user me-2"></i>
教务管理系统
</a>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="/dashboard">首页</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown1" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
学生管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown1">
<li><a class="dropdown-item" href="/student/all">学生信息显示</a></li>
<li><a class="dropdown-item" href="/student/infomodv2">学生信息修改</a></li>
<li>
<hr class="dropdown-divider" />
</li>
<li><a class="dropdown-item" href="/score/all">成绩查看</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown3" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
课程管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown3">
<li><a class="dropdown-item" href="/course/all">课程查看</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown4" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
系统管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown4">
<li><a class="dropdown-item" href="#">个人设定</a></li>
<li><a class="dropdown-item" href="#">版本信息</a></li>
</ul>
</li>
</ul>
</div>
<div class="dropdown">
<a class="dropdown-toggle d-flex align-items-center hidden-arrow" href="#"
id="navbarDropdownMenuAvatar" role="button" data-mdb-toggle="dropdown" aria-expanded="false">
<i class="fas fa-circle-user fa-lg me-1"></i>
${username}
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownMenuAvatar">
<li>
<a class="dropdown-item" href="${pageContext.request.contextPath}/logout">登出</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<!--Main Navigation-->
<!--Main layout-->
<main>
<div class="bg-image shadow-2-strong vh-100"
style="background-image: url('${pageContext.request.contextPath}/resources/img/jason-blackeye-nyL-rzwP-Mk-unsplash.jpg');margin-top: -58.59px;">
<div class="mask d-flex align-items-center h-100" style="background-color: hsla(0, 0%, 100%, 0.5);">
</div>
</div>
</main>
<!--Main layout-->
<!-- Footer -->
<footer class="bg-link text-center text-lg-start ">
</footer>
<!-- Footer -->
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/js/mdb.min.js"></script>
</body>
</html>

View File

@ -0,0 +1,116 @@
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<title>面板</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700;900&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/mdb.min.css" />
</head>
<body style="font-family: 'Noto Sans SC Regular',serif">
<!--Main Navigation-->
<header>
<nav class="navbar navbar-expand-lg navbar-light bg-light" style="z-index: 1;min-height: 58.59px">
<div class="container">
<button class="navbar-toggler" type="button" data-mdb-toggle="collapse"
data-mdb-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<i class="fas fa-bars"></i>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<a class="navbar-brand mt-2 mt-lg-0" href="#">
<i class="fas fa-chalkboard-user me-2"></i>
教务管理系统
</a>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="/dashboard">首页</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown1" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
学生管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown1">
<li><a class="dropdown-item" href="/student/all">学生信息显示</a></li>
<li><a class="dropdown-item" href="/student/queryinfo">学生信息查询</a></li>
<li><a class="dropdown-item" href="/student/modstep1">学生信息修改(旧)</a></li>
<li><a class="dropdown-item" href="/student/infomodv2">学生信息修改</a></li>
<li>
<hr class="dropdown-divider" />
</li>
<li><a class="dropdown-item" href="/score/all">成绩查看</a></li>
<li><a class="dropdown-item" href="/score/infomodv2">成绩管理</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown3" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
课程管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown3">
<li><a class="dropdown-item" href="/course/all">课程查看</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown4" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
系统管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown4">
<li><a class="dropdown-item" href="#">个人设定</a></li>
<li><a class="dropdown-item" href="#">版本信息</a></li>
</ul>
</li>
</ul>
</div>
<div class="dropdown">
<a class="dropdown-toggle d-flex align-items-center hidden-arrow" href="#"
id="navbarDropdownMenuAvatar" role="button" data-mdb-toggle="dropdown" aria-expanded="false">
<i class="fas fa-circle-user fa-lg me-1"></i>
${username}
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownMenuAvatar">
<li>
<a class="dropdown-item" href="${pageContext.request.contextPath}/logout">登出</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<!--Main Navigation-->
<!--Main layout-->
<main>
<div class="bg-image shadow-2-strong vh-100"
style="background-image: url('${pageContext.request.contextPath}/resources/img/jason-blackeye-nyL-rzwP-Mk-unsplash.jpg');margin-top: -58.59px;">
<div class="mask d-flex align-items-center h-100" style="background-color: hsla(0, 0%, 100%, 0.5);">
</div>
</div>
</main>
<!--Main layout-->
<!-- Footer -->
<footer class="bg-link text-center text-lg-start ">
</footer>
<!-- Footer -->
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/js/mdb.min.js"></script>
</body>
</html>

View File

@ -101,11 +101,13 @@
<h1 class="text-center mb-4" style="font-family: 'Noto Sans SC Light',serif"> <h1 class="text-center mb-4" style="font-family: 'Noto Sans SC Light',serif">
用户登录</h1> 用户登录</h1>
<div class="form-outline mb-4"> <div class="form-outline mb-4">
<input type="text" id="form1Example1" class="form-control" name="username" required/> <input type="text" id="form1Example1" class="form-control" name="username"
required/>
<label class="form-label" for="form1Example1">用户名</label> <label class="form-label" for="form1Example1">用户名</label>
</div> </div>
<div class="form-outline mb-4"> <div class="form-outline mb-4">
<input type="password" id="form1Example2" class="form-control" name="password" required/> <input type="password" id="form1Example2" class="form-control" name="password"
required/>
<label class="form-label" for="form1Example2">密码</label> <label class="form-label" for="form1Example2">密码</label>
</div> </div>
<div class="row mb-4"> <div class="row mb-4">
@ -118,12 +120,12 @@
</div> </div>
</div> </div>
<div class="col"> <div class="col">
<a href="#!">忘记密码?</a> <a href="#" onclick="showNote()">忘记密码?</a>
</div> </div>
</div> </div>
<button type="submit" class="btn btn-primary btn-block mb-4">登录</button> <button type="submit" class="btn btn-primary btn-block mb-4">登录</button>
<div class="text-center" style="margin-bottom: 25px;"> <div class="text-center" style="margin-bottom: 25px;">
<p>还没有账号? <a href="#!">注册一个</a></p> <p>还没有账号? <a href="#" onclick="showReg()">注册一个</a></p>
</div> </div>
</form> </form>
</div> </div>
@ -133,15 +135,18 @@
<h1 class="text-center mb-4" style="font-family: 'Noto Sans SC Light',serif"> <h1 class="text-center mb-4" style="font-family: 'Noto Sans SC Light',serif">
用户注册</h1> 用户注册</h1>
<div class="form-outline mb-4"> <div class="form-outline mb-4">
<input type="text" id="registerUsername" class="form-control" name="username" required/> <input type="text" id="registerUsername" class="form-control" name="username"
required/>
<label class="form-label" for="registerUsername">用户名</label> <label class="form-label" for="registerUsername">用户名</label>
</div> </div>
<div class="form-outline mb-4"> <div class="form-outline mb-4">
<input type="password" id="registerPassword" class="form-control" name="password" required/> <input type="password" id="registerPassword" class="form-control"
name="password" required/>
<label class="form-label" for="registerPassword">密码</label> <label class="form-label" for="registerPassword">密码</label>
</div> </div>
<div class="form-outline mb-4"> <div class="form-outline mb-4">
<input type="password" id="registerRepeatPassword" class="form-control" name="re-password" required/> <input type="password" id="registerRepeatPassword" class="form-control"
name="re-password" required/>
<label class="form-label" for="registerRepeatPassword">重复密码</label> <label class="form-label" for="registerRepeatPassword">重复密码</label>
</div> </div>
<div class="form-check d-flex justify-content-center mb-4"> <div class="form-check d-flex justify-content-center mb-4">
@ -234,7 +239,12 @@
$('#exampleModal2').modal('show'); $('#exampleModal2').modal('show');
</c:if> </c:if>
}); });
function showNote() {
alert("功能尚未实现,请联系管理员重置密码");
}
function showReg(){
document.getElementById("tab-register").click();
}
</script> </script>
</body> </body>
</html> </html>