add frontpage

This commit is contained in:
xtaodada 2024-05-12 19:06:54 +08:00
parent b66da66286
commit 6757125a4e
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
18 changed files with 459 additions and 0 deletions

13
pom.xml
View File

@ -56,6 +56,19 @@
<artifactId>jsp-api</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -0,0 +1,50 @@
<%@ page import="java.awt.*" %>
<%@ page import="java.util.Random" %>
<%@ page import="java.awt.image.BufferedImage" %>
<%@ page import="javax.imageio.ImageIO" %>
<%@ page contentType="image/jpeg" %>
<%!
Color getRandColor(int fc, int bc) {
Random random = new Random();
if (fc > 255) fc = 255;
if (bc > 255) bc = 255;
int r = fc + random.nextInt(bc - fc);
int g = fc + random.nextInt(bc - fc);
int b = fc + random.nextInt(bc - fc);
return new Color(r, g, b);
}
%>
<%
out.clear();
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
int width = 60, height = 20;
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics g = image.getGraphics();
Random random = new Random();
g.setColor(getRandColor(200, 250));
g.fillRect(0, 0, width, height);
g.setFont(new Font("Times New Roman", Font.PLAIN, 18));
g.setColor(getRandColor(160, 200));
for (int i = 0; i < 200; i++) {
int x = random.nextInt(width);
int y = random.nextInt(height);
int xl = random.nextInt(12);
int yl = random.nextInt(12);
g.drawLine(x, y, x + xl, y + yl);
}
StringBuilder sRand = new StringBuilder();
for (int i = 0; i < 4; i++) {
String rand = String.valueOf(random.nextInt(10));
sRand.append(rand);
g.setColor(new Color(20 + random.nextInt(110), 20 + random.nextInt(110), 20 + random.nextInt(110)));
g.drawString(rand, 13 * i + 6, 16);
}
session.setAttribute("sessioncode", sRand.toString());
g.dispose();
ServletOutputStream s = response.getOutputStream();
ImageIO.write(image, "JPEG", s);
s.close();
%>

View File

@ -0,0 +1,52 @@
<%--
Created by IntelliJ IDEA.
User: xtaod
Date: 2023/12/24
Time: 12:09
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page isELIgnored="false" %>
<c:set var="webroot" value="${pageContext.request.contextPath}"/>
<c:choose>
<c:when test="${not empty sessionScope.username}">
<hr>
<div class="dropdown">
<a href="#" class="d-flex align-items-center link-body-emphasis text-decoration-none dropdown-toggle"
data-bs-toggle="dropdown" aria-expanded="false">
<img src="${webroot}/upload/${sessionScope.username}.jpg" alt="" width="32" height="32"
class="rounded-circle me-2">
<strong>${sessionScope.username}</strong>
</a>
<ul class="dropdown-menu text-small shadow">
<li><a class="dropdown-item" href="${webroot}/record.do">我的登录历史</a></li>
<li><a class="dropdown-item" href="${webroot}/stu/pass.jsp">修改密码</a></li>
<li>
<hr class="dropdown-divider">
</li>
<li><a class="dropdown-item" href="${webroot}/logout.jsp">退出登录</a></li>
</ul>
</div>
</c:when>
<c:when test="${not empty sessionScope.adminuser}">
<hr>
<div class="dropdown">
<a href="#" class="d-flex align-items-center link-body-emphasis text-decoration-none dropdown-toggle"
data-bs-toggle="dropdown" aria-expanded="false">
<img src="${webroot}/images/logo.jpg" alt="" width="32" height="32" class="rounded-circle me-2">
<strong>${sessionScope.adminuser.adminname}</strong>
</a>
<ul class="dropdown-menu text-small shadow">
<li><a class="dropdown-item" href="${webroot}/admin/record.do">我的登录历史</a></li>
<li><a class="dropdown-item" href="${webroot}/admin/pass.jsp">修改密码</a></li>
<li>
<hr class="dropdown-divider">
</li>
<li><a class="dropdown-item" href="${webroot}/logout.jsp">退出登录</a></li>
</ul>
</div>
</c:when>
</c:choose>

View File

@ -0,0 +1,19 @@
<%--
Created by IntelliJ IDEA.
User: xtaod
Date: 2023/12/9
Time: 16:04
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page isELIgnored="false" %>
<c:set var="webroot" value="${pageContext.request.contextPath}"/>
<footer class="justify-content-between align-items-center py-1 my-1 border-top">
<p class="text-body-secondary">&copy; 2024 重庆文理学院</p>
<p class="text-body-secondary">邮编402160</p>
<p class="text-body-secondary">重庆市永川区红河大道319号</p>
</footer>

View File

@ -0,0 +1,25 @@
<%--
Created by IntelliJ IDEA.
User: xtaod
Date: 2023/12/9
Time: 16:03
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page isELIgnored="false" %>
<c:set var="webroot" value="${pageContext.request.contextPath}"/>
<div class="d-flex flex-column flex-shrink-0 p-3 bg-body-tertiary" style="width: 280px;">
<a href="${webroot}/"
class="d-flex align-items-center mb-3 mb-md-0 me-md-auto link-body-emphasis text-decoration-none">
<img src="${webroot}/images/logo.jpg" alt="" width="32" height="32" class="rounded-circle me-2">
<span class="fs-4">维修管理系统</span>
</a>
<hr>
<%@ include file="./menu.jsp" %>
<%@ include file="./dropdown.jsp" %>
<%@ include file="./footer.jsp" %>
</div>
<div class="b-example-divider b-example-vr"></div>

View File

@ -0,0 +1,31 @@
<%--
Created by IntelliJ IDEA.
User: xtaod
Date: 2023/12/24
Time: 12:08
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page isELIgnored="false" %>
<c:set var="webroot" value="${pageContext.request.contextPath}"/>
<ul class="nav nav-pills flex-column mb-auto">
<c:choose>
<c:when test="${not empty sessionScope.username}">
<li class="nav-item">
<a href="${webroot}/stu/notice.jsp" class="nav-link link-body-emphasis" aria-current="page">
>> 主页
</a>
</li>
</c:when>
<c:otherwise>
<li class="nav-item">
<a href="${webroot}/" class="nav-link link-body-emphasis" aria-current="page">
>> 主页
</a>
</li>
</c:otherwise>
</c:choose>
</ul>

86
src/main/webapp/index.jsp Normal file
View File

@ -0,0 +1,86 @@
<%--
Created by IntelliJ IDEA.
User: xtaod
Date: 2023/12/9
Time: 10:18
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page isELIgnored="false" %>
<c:set var="title" value="登录"/>
<c:set var="webroot" value="${pageContext.request.contextPath}"/>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>${title}</title>
<link rel="stylesheet" href="${webroot}/styles/bootstrap.min.css" crossorigin="anonymous">
<script src="${webroot}/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="${webroot}/styles/sidebar.css" crossorigin="anonymous">
<link rel="stylesheet" href="${webroot}/styles/index.css" crossorigin="anonymous">
</head>
<body>
<main class="d-flex flex-nowrap">
<%@ include file="./includes/header.jsp" %>
<main class="form-signin w-100 m-auto">
<div class="toast-container position-fixed bottom-0 end-0 p-3">
<div id="liveToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header">
<img src="${webroot}/images/logo.jpg" class="rounded me-2" width="32" height="32">
<strong class="me-auto">提示</strong>
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
<div class="toast-body">
1、请牢记您注册时填写的用户名和密码登录本系统时您需要提供正确的用户名和密码</br>
2、忘记用户名或者密码请联系学校管理员
</div>
</div>
</div>
<form action="${webroot}/login.do" method="post" >
<img class="mb-4" src="${webroot}/images/logo.jpg" alt="" width="72" height="72">
<h1 class="h3 mb-3 fw-normal">请先登录</h1>
<c:if test="${not empty requestScope.stuLoginMess}">
<div class="alert alert-warning" role="alert">
${requestScope.stuLoginMess}
</div>
</c:if>
<div class="form-floating">
<input type="text" class="form-control" name="username" id="username" value="${username}" required>
<label for="username">用户名</label>
</div>
<div class="form-floating">
<input type="password" class="form-control" name="password" id="password" value="${password}" required>
<label for="password">密码</label>
</div>
<div class="input-group mb-3">
<input type="text" class="form-control" placeholder="验证码" name="code" id="code" required>
<span class="input-group-text">
<img src="${pageContext.request.contextPath}/includes/code.jsp" id="imagecode"
title="点击图片可刷新验证码"
onclick="this.src='${pageContext.request.contextPath}/includes/code.jsp?'+Math.random()">
</span>
</div>
<input class="btn btn-primary w-100 py-2" type="submit" id="submit">
<br/><br/>
</form>
<a href="${webroot}/register.jsp">
<button class="btn btn-primary w-100 py-2">去注册</button>
</a>
</main>
</main>
<script src="${webroot}/js/pass.js" type="javascript"></script>
<script>
const toastLiveExample = document.getElementById('liveToast')
const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastLiveExample)
toastBootstrap.show()
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

45
src/main/webapp/js/echarts.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,42 @@
window.onload = function () {
// var reset = document.getElementById('reset');
var fm = document.getElementsByTagName('form')[0];
var stuAddMess = document.getElementById('stuPassMess');
var password = document.getElementById('password');
var confirmpass = document.getElementById('confirmpass');
var code = document.getElementById('code');
// reset.onclick = function () {
// password.value = '';
// confirmpass.value = '';
// code.value = '';
// password.focus();
// };
fm.addEventListener('submit', function(event) {
if (fm.checkValidity() === false) {
event.preventDefault();
event.stopPropagation();
}
if (!/^\w{6,20}$/.test(password.value)) {// 密码验证
stuAddMess.innerHTML = "* 密码不合法!";
password.value = '';
password.focus();
event.preventDefault();
event.stopPropagation();
}
if (password.value !== confirmpass.value) {// 密码确认验证
stuAddMess.innerHTML = "* 两次输入的密码不一致,请重新输入!";
password.value = '';
confirmpass.value = '';
password.focus();
event.preventDefault();
event.stopPropagation();
}
if (!/^\d{4}$/.test(code.value)) {// 验证码验证
stuAddMess.innerHTML = "* 验证码错误!";
code.value = '';
code.focus();
event.preventDefault();
event.stopPropagation();
}
}, false);
};

View File

@ -0,0 +1,4 @@
function record(url, value, pageSize) {
const pageNo = value.split("/")[0].trim();
location.href = url + "pageNo=" + pageNo + "&pageSize=" + pageSize;
}

View File

@ -0,0 +1,40 @@
window.onload = function () {
var reset = document.getElementById('reset');
var fm = document.getElementsByTagName('form')[0];
var stuAddMess = document.getElementById('stuAddMess');
reset.onclick = function () {
username.value = '';
password.value = '';
confirmpass.value = '';
code.value = '';
username.focus();
};
fm.onsubmit = function () {
if (!/^\w{6,20}$/.test(username.value)) {// 用户名验证
stuAddMess.innerHTML = "* 用户名不合法!";
username.value = '';
username.focus();
return false;
}
if (!/^\w{6,20}$/.test(password.value)) {// 密码验证
stuAddMess.innerHTML = "* 密码不合法!";
password.value = '';
password.focus();
return false;
}
if (password.value !== confirmpass.value) {// 密码确认验证
stuAddMess.innerHTML = "* 两次输入的密码不一致,请重新输入!";
password.value = '';
confirmpass.value = '';
password.focus();
return false;
}
if (!/^\d{4}$/.test(code.value)) {// 验证码验证
stuAddMess.innerHTML = "* 验证码错误!";
code.value = '';
code.focus();
return false;
}
return true;
};
};

View File

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,5 @@
.scrollspy {
max-height: 100vh;
margin-top: 0.5rem;
overflow: auto;
}

View File

@ -0,0 +1,20 @@
.form-signin {
max-width: 330px;
padding: 1rem;
}
.form-signin .form-floating:focus-within {
z-index: 2;
}
.form-signin input[name="username"] {
margin-bottom: -1px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-signin input[name="password"] {
margin-bottom: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}

View File

@ -0,0 +1,14 @@
.b-example-divider {
width: 100%;
height: 3rem;
background-color: rgba(0, 0, 0, .1);
border: solid rgba(0, 0, 0, .15);
border-width: 1px 0;
box-shadow: inset 0 .5em 1.5em rgba(0, 0, 0, .1), inset 0 .125em .5em rgba(0, 0, 0, .15);
}
.b-example-vr {
flex-shrink: 0;
width: 1.5rem;
height: 100vh;
}