Update index.html

main
luoyonghuang 2 months ago
parent 9a54ab08f0
commit d9960ef64c

@ -1,72 +1,107 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh-CN"> <html lang="zh-CN">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>课堂管理系统</title> <title>课堂管理系统</title>
<style> <style>
body { body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #6e8efb, #a777e3); background: linear-gradient(135deg, #6e8efb, #a777e3);
height: 100vh; height: 100vh;
margin: 0; margin: 0;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
color: white; color: white;
} }
.container { .container {
text-align: center; text-align: center;
background: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.1);
padding: 40px; padding: 40px;
border-radius: 20px; border-radius: 20px;
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37); box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
backdrop-filter: blur(8.5px); backdrop-filter: blur(8.5px);
-webkit-backdrop-filter: blur(8.5px); -webkit-backdrop-filter: blur(8.5px);
border: 1px solid rgba(255, 255, 255, 0.18); border: 1px solid rgba(255, 255, 255, 0.18);
} }
h1 { h1 {
margin-bottom: 40px; margin-bottom: 40px;
font-size: 2.5em; font-size: 2.5em;
} }
.button-group { .button-group {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 20px; gap: 20px;
} }
button { button {
padding: 15px 30px; padding: 15px 30px;
font-size: 1.2em; font-size: 1.2em;
border: none; border: none;
border-radius: 50px; border-radius: 50px;
background-color: #ff5722; background-color: #ff5722;
color: white; color: white;
cursor: pointer; cursor: pointer;
transition: transform 0.2s, background-color 0.3s; transition: transform 0.2s, background-color 0.3s;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
} }
button:hover { button:hover {
background-color: #ff3d00; background-color: #ff3d00;
transform: scale(1.05); transform: scale(1.05);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
} }
@media (max-width: 600px) { @media (max-width: 600px) {
.button-group { .button-group {
flex-direction: column; flex-direction: column;
} }
} }
</style> </style>
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<h1>课堂管理系统</h1> <h1>课堂管理系统</h1>
<div class="button-group"> <div class="button-group">
<button onclick="window.location.href='dianming.html'">课堂点名</button> <button onclick="window.location.href='dianming.html'">课堂点名</button>
<button onclick="window.location.href='select.html'">随机提问</button> <button onclick="window.location.href='select.html'">随机提问</button>
<button onclick="window.location.href='score_display.html'">积分显示</button> <button onclick="window.location.href='score_display.html'">积分显示</button>
</div> <button onclick="document.getElementById('fileInput').click()">导入学生名单</button>
</div> <input type="file" id="fileInput" accept=".xlsx" style="display:none;" onchange="importStudents(event)">
</div>
</body> </div>
</html>
<script>
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>

Loading…
Cancel
Save