|
|
<!DOCTYPE html>
|
|
|
<html lang="zh-CN">
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
<title>课堂管理系统</title>
|
|
|
<style>
|
|
|
body {
|
|
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
|
background: linear-gradient(135deg, #283c86, #45a247); /* 深蓝到绿色的渐变 */
|
|
|
height: 100vh;
|
|
|
margin: 0;
|
|
|
display: flex;
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
color: #ffffff;
|
|
|
}
|
|
|
|
|
|
.container {
|
|
|
text-align: center;
|
|
|
background: rgba(50, 50, 70, 0.9); /* 更深的背景色 */
|
|
|
padding: 40px;
|
|
|
border-radius: 20px;
|
|
|
box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5);
|
|
|
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
|
backdrop-filter: blur(10px); /* 增加模糊效果 */
|
|
|
}
|
|
|
|
|
|
h1 {
|
|
|
margin-bottom: 40px;
|
|
|
font-size: 2.5em;
|
|
|
text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5); /* 文字阴影 */
|
|
|
}
|
|
|
|
|
|
.button-group {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
gap: 20px;
|
|
|
}
|
|
|
|
|
|
button {
|
|
|
padding: 15px 30px;
|
|
|
font-size: 1.2em;
|
|
|
border: none;
|
|
|
border-radius: 50px;
|
|
|
background: linear-gradient(45deg, #6a82fb, #fc5c7d); /* 渐变按钮 */
|
|
|
color: white;
|
|
|
cursor: pointer;
|
|
|
transition: transform 0.2s, background 0.3s, box-shadow 0.3s;
|
|
|
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
|
|
|
}
|
|
|
|
|
|
button:hover {
|
|
|
background: linear-gradient(45deg, #5a72d6, #e54d84); /* 悬停时加深 */
|
|
|
transform: translateY(-3px); /* 悬停时上移效果 */
|
|
|
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
|
|
|
}
|
|
|
|
|
|
@media (max-width: 600px) {
|
|
|
.button-group {
|
|
|
flex-direction: column;
|
|
|
}
|
|
|
}
|
|
|
</style>
|
|
|
</head>
|
|
|
<body>
|
|
|
|
|
|
<div class="container">
|
|
|
<h1>2024K班课堂管理系统</h1>
|
|
|
<div class="button-group">
|
|
|
<button onclick="window.location.href='dianming.html'">课堂点名</button>
|
|
|
<button onclick="window.location.href='select.html'">随机提问</button>
|
|
|
<button onclick="window.location.href='score_display.html'">积分排名</button>
|
|
|
<button onclick="document.getElementById('fileInput').click()">导入学生名单</button>
|
|
|
<input type="file" id="fileInput" accept=".xlsx" style="display:none;" onchange="importStudents(event)">
|
|
|
<button onclick="downloadScores()">导出学生成绩</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<script>
|
|
|
function downloadScores() {
|
|
|
window.location.href = '/api/export-scores';
|
|
|
}
|
|
|
|
|
|
async function importStudents() {
|
|
|
const fileInput = document.getElementById('fileInput');
|
|
|
const file = fileInput.files[0]; // 获取选中的文件
|
|
|
|
|
|
if (!file) {
|
|
|
alert('请选择一个文件');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
const formData = new FormData();
|
|
|
formData.append('file', file); // 将文件添加到FormData中,键名为'file'
|
|
|
|
|
|
try {
|
|
|
const response = await fetch('/api/upload', { // 假设后端API的路径为/api/upload
|
|
|
method: 'POST',
|
|
|
body: formData
|
|
|
});
|
|
|
|
|
|
if (response.ok) {
|
|
|
const result = await response.json();
|
|
|
console.log('上传成功:', result);
|
|
|
alert('学生名单导入成功!');
|
|
|
} else {
|
|
|
console.error('上传失败:', response.statusText);
|
|
|
alert('导入失败,请重试。');
|
|
|
}
|
|
|
} catch (error) {
|
|
|
console.error('请求错误:', error);
|
|
|
alert('发生错误,请检查控制台了解详细信息。');
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
</body>
|
|
|
</html>
|