Files
gc-plan/week7/backend/src/main/resources/static/index.html
2026-04-29 23:45:17 +08:00

106 lines
4.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>学生管理系统 v2</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<!-- 登录面板 -->
<div class="container" id="login-panel">
<header>
<h1>📚 学生管理系统 v2</h1>
<p class="subtitle">Spring Security + JWT + Redis</p>
</header>
<div class="login-card">
<h2>登录</h2>
<p class="hint">默认账号admin/123456 (管理员) 或 user/123456 (普通用户)</p>
<div class="form-group">
<input type="text" id="login-username" placeholder="用户名" autofocus>
</div>
<div class="form-group">
<input type="password" id="login-password" placeholder="密码">
</div>
<div class="error-msg" id="login-error"></div>
<button class="btn btn-primary btn-block" onclick="doLogin()">登录</button>
<p class="hint small" style="margin-top:12px">
没有账号?<a href="#" onclick="showRegister()">注册</a>
</p>
</div>
</div>
<!-- 注册面板 -->
<div class="container" id="register-panel" style="display:none">
<header><h1>📚 注册</h1></header>
<div class="login-card">
<h2>注册新账号</h2>
<div class="form-group"><input type="text" id="reg-username" placeholder="用户名"></div>
<div class="form-group"><input type="password" id="reg-password" placeholder="密码"></div>
<div class="error-msg" id="reg-error"></div>
<button class="btn btn-primary btn-block" onclick="doRegister()">注册</button>
<p class="hint small" style="margin-top:12px"><a href="#" onclick="showLogin()">返回登录</a></p>
</div>
</div>
<!-- 主面板 -->
<div class="container" id="main-panel" style="display:none">
<header class="main-header">
<div>
<h1>📚 学生管理系统 v2</h1>
<span id="user-info"></span>
</div>
<button class="btn btn-outline btn-sm" onclick="logout()">退出</button>
</header>
<div class="toolbar">
<input type="text" id="keyword" placeholder="搜索..." onkeyup="if(event.key==='Enter')search()">
<button class="btn btn-primary" id="btn-add" onclick="showForm(null)">+ 新增</button>
<button class="btn btn-outline" onclick="loadStudents()">刷新</button>
</div>
<div class="error-bar" id="error-bar" style="display:none"></div>
<div class="table-wrap">
<table>
<thead>
<tr>
<th>ID</th><th>姓名</th><th>年龄</th><th>邮箱</th><th>成绩</th><th>操作</th>
</tr>
</thead>
<tbody id="table-body"></tbody>
</table>
</div>
<div class="stats" id="stats-bar">
<div class="stat-card"><span class="stat-value" id="stat-total">-</span><span class="stat-label">总数</span></div>
<div class="stat-card"><span class="stat-value" id="stat-excellent">-</span><span class="stat-label">优秀(≥85)</span></div>
<div class="stat-card"><span class="stat-value" id="stat-orm">-</span><span class="stat-label">ORM 引擎</span></div>
</div>
</div>
<!-- 弹窗 -->
<div class="modal-overlay" id="modal-overlay">
<div class="modal">
<h2 id="modal-title">新增学生</h2>
<form id="student-form" onsubmit="submitForm(event)">
<input type="hidden" id="form-id">
<div class="form-group"><label>姓名 *</label><input type="text" id="form-name" required maxlength="20"></div>
<div class="form-row">
<div class="form-group"><label>年龄 *</label><input type="number" id="form-age" required min="1" max="150"></div>
<div class="form-group"><label>成绩 *</label><input type="number" id="form-score" required min="0" max="100"></div>
</div>
<div class="form-group"><label>邮箱 *</label><input type="email" id="form-email" required></div>
<div class="modal-actions">
<button type="button" class="btn btn-outline" onclick="closeModal()">取消</button>
<button type="submit" class="btn btn-primary">保存</button>
</div>
</form>
</div>
</div>
<script src="js/app.js"></script>
</body>
</html>