You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

197 lines
6.3 KiB

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>课堂点名系统</title>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
<style>
@keyframes gradientAnimation {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
body {
background: linear-gradient(120deg, #a1c4fd, #c2e9fb, #c2e9fb, #a1c4fd);
background-size: 300% 300%;
animation: gradientAnimation 10s ease infinite;
color: #fff;
font-family: Arial, sans-serif;
}
.container {
background: rgba(255, 255, 255, 0.85);
border-radius: 10px;
padding: 30px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
color: #000;
transform: translateY(100px);
opacity: 0;
transition: all 0.5s ease-in-out;
}
.container.show {
transform: translateY(0);
opacity: 1;
}
.card {
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
transform: scale(0.9);
transition: transform 0.3s ease-in-out;
}
.card:hover {
transform: scale(1);
}
h1, h2 {
font-weight: 400;
position: relative;
display: inline-block;
color: #3399ff;
}
h1::after, h2::after {
content: '';
position: absolute;
width: 100%;
transform: scaleX(0);
height: 3px;
bottom: 0;
left: 0;
background-color: #3399ff;
transform-origin: bottom right;
transition: transform 0.25s ease-out;
}
h1:hover::after, h2:hover::after {
transform: scaleX(1);
transform-origin: bottom left;
}
.btn-primary, .btn-success, .btn-info, .btn-secondary {
border-radius: 50px;
transition: background-color 0.3s ease;
}
.btn-primary:hover, .btn-success:hover, .btn-info:hover, .btn-secondary:hover {
background-color: #3399ff;
color: #fff;
}
.fab {
position: fixed;
right: 30px;
bottom: 30px;
background: #3399ff;
color: #fff;
border-radius: 50%;
width: 60px;
height: 60px;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
cursor: pointer;
transition: background-color 0.3s ease;
}
.fab:hover {
background-color: #2673d1;
}
.fab i {
font-size: 24px;
}
</style>
</head>
<body>
<div class="container mt-4" id="main-container">
<h1 class="text-center">课堂点名系统</h1>
<div class="alert alert-success" th:if="${message}">
<span th:text="${message}"></span>
</div>
<div class="card p-4">
<form method="post" action="/upload" enctype="multipart/form-data" th:if="${uploadSuccess == null}">
<div class="form-group">
<label for="file">文件上传区域</label>
<input type="file" class="form-control-file" id="file" name="file" required>
</div>
<button type="submit" class="btn btn-primary btn-block">上传</button>
</form>
</div>
<hr th:if="${uploadSuccess != null}">
<div class="card p-4" th:if="${uploadSuccess != null}">
<form method="post" action="/pick">
<button type="submit" class="btn btn-success btn-block">
<i class="fas fa-random"></i> 随机点名
</button>
</form>
</div>
<hr>
<div class="card p-4" th:if="${pickedStudent != null}">
<h2>点到的学生:</h2>
<p>姓名:<span th:text="${pickedStudent.name}"></span></p>
<p>学号:<span th:text="${pickedStudent.studentId}"></span></p>
<form method="post" action="/updatePoints">
<input type="hidden" name="studentId" th:value="${pickedStudent.id}">
<div class="form-group">
<label for="points">调整积分:</label>
<input type="number" class="form-control" id="points" name="points" step="0.1" value="1" required>
</div>
<button type="submit" class="btn btn-info btn-block">更新积分</button>
</form>
<form method="post" action="/pick" class="mt-3">
<button type="submit" class="btn btn-secondary btn-block">开始下一次点名</button>
</form>
</div>
<hr>
<div class="card p-4">
<h2>学生名单:</h2>
<table class="table table-striped table-bordered mt-3">
<thead class="thead-dark">
<tr>
<th>姓名</th>
<th>学号</th>
<th>积分</th>
</tr>
</thead>
<tbody>
<tr th:each="student : ${students}">
<td th:text="${student.name}"></td>
<td th:text="${student.studentId}"></td>
<td th:text="${student.points}"></td>
</tr>
</tbody>
</table>
</div>
</div>
<a href="/pick" class="fab">
<i class="fas fa-random"></i>
</a>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
const container = document.getElementById('main-container');
container.classList.add('show');
});
</script>
</body>
</html>