refactor(frontend): 重构前端目录结构并优化认证流程
将前端文件从html目录迁移到views目录,按功能模块组织 重构认证中间件和路由处理,简化页面权限控制 更新静态资源引用路径,统一使用/public前缀 添加学生仪表板页面,优化移动端显示 移除旧版html和js文件,更新样式和脚本
This commit is contained in:
@@ -0,0 +1,342 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>摮衣��鞟貍蝞∠�蝟餌� - 蝞∠��䀝貌銵冽踎</title>
|
||||
<link rel="stylesheet" href="/public/css/style.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
||||
</head>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 憿園�撖潸⏛�?-->
|
||||
<nav class="navbar">
|
||||
<div class="navbar-brand">
|
||||
<i class="fas fa-graduation-cap"></i>
|
||||
<span>XX摮行嵗�鞟貍蝞∠�蝟餌�</span>
|
||||
</div>
|
||||
<div class="navbar-menu">
|
||||
<a href="/" class="btn btn-secondary">
|
||||
<i class="fas fa-home"></i> 銝駁△
|
||||
</a>
|
||||
<div class="navbar-user">
|
||||
<span class="user-name" id="userName">蝞∠��?/span>
|
||||
<button id="logoutBtn" class="btn btn-primary">
|
||||
<i class="fas fa-sign-out-alt"></i> ���? </button>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- 隞芾”�踹捆�?-->
|
||||
<div class="dashboard-container">
|
||||
<!-- 撌虫儒靘扯器�?-->
|
||||
<aside class="sidebar">
|
||||
<div class="sidebar-header">
|
||||
<div class="user-info">
|
||||
<div class="user-avatar">
|
||||
<i class="fas fa-user-shield"></i>
|
||||
</div>
|
||||
<div class="user-details">
|
||||
<h3 id="adminName">蝞∠��?/h3>
|
||||
<p>蝟餌�蝞∠��?| ���嚗?span id="adminRole">頞�漣蝞∠��?/span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="sidebar-menu">
|
||||
<li>
|
||||
<a href="#" class="active">
|
||||
<i class="fas fa-tachometer-alt"></i>
|
||||
<span>隞芾”�?/span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/admin/user_management">
|
||||
<i class="fas fa-users"></i>
|
||||
<span>�冽�蝞∠�</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/admin/student_management">
|
||||
<i class="fas fa-user-graduate"></i>
|
||||
<span>摮衣�蝞∠�</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="teacher_management.html">
|
||||
<i class="fas fa-chalkboard-teacher"></i>
|
||||
<span>�坔�蝞∠�</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="grade_statistics.html">
|
||||
<i class="fas fa-chart-bar"></i>
|
||||
<span>�鞟貍蝏蠘恣</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="system_settings.html">
|
||||
<i class="fas fa-cog"></i>
|
||||
<span>蝟餌�霈曄蔭</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="data_export.html">
|
||||
<i class="fas fa-download"></i>
|
||||
<span>�唳旿撖澆枂</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="audit_log.html">
|
||||
<i class="fas fa-history"></i>
|
||||
<span>�滢��亙�</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</aside>
|
||||
|
||||
<!-- 銝餃�摰孵躹 -->
|
||||
<main class="main-content">
|
||||
<div class="content-header">
|
||||
<div>
|
||||
<h1 class="page-title">蝞∠��䀝貌銵冽踎</h1>
|
||||
<div class="breadcrumb">
|
||||
<a href="/">銝駁△</a>
|
||||
<i class="fas fa-chevron-right"></i>
|
||||
<span>蝞∠��䀝貌銵冽踎</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="current-time" id="currentTime"></div>
|
||||
</div>
|
||||
|
||||
<!-- 蝏蠘恣�∠� -->
|
||||
<div class="stats-grid">
|
||||
<div class="stat-card">
|
||||
<div class="stat-icon users">
|
||||
<i class="fas fa-users"></i>
|
||||
</div>
|
||||
<div class="stat-content">
|
||||
<div class="stat-value" id="totalUsers">1,248</div>
|
||||
<div class="stat-label">�餌鍂�瑟㺭</div>
|
||||
<div class="stat-change positive">
|
||||
<i class="fas fa-arrow-up"></i> 12 �砍𪂹�啣�
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="stat-card">
|
||||
<div class="stat-icon students">
|
||||
<i class="fas fa-user-graduate"></i>
|
||||
</div>
|
||||
<div class="stat-content">
|
||||
<div class="stat-value" id="totalStudents">3,567</div>
|
||||
<div class="stat-label">摮衣��餅㺭</div>
|
||||
<div class="stat-change positive">
|
||||
<i class="fas fa-arrow-up"></i> 45 �砍𪂹�啣�
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="stat-card">
|
||||
<div class="stat-icon teachers">
|
||||
<i class="fas fa-chalkboard-teacher"></i>
|
||||
</div>
|
||||
<div class="stat-content">
|
||||
<div class="stat-value" id="totalTeachers">128</div>
|
||||
<div class="stat-label">�坔��餅㺭</div>
|
||||
<div class="stat-change">
|
||||
<i class="fas fa-minus"></i> �惩��? </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="stat-card">
|
||||
<div class="stat-icon courses">
|
||||
<i class="fas fa-book"></i>
|
||||
</div>
|
||||
<div class="stat-content">
|
||||
<div class="stat-value" id="totalCourses">89</div>
|
||||
<div class="stat-label">霂曄��餅㺭</div>
|
||||
<div class="stat-change positive">
|
||||
<i class="fas fa-arrow-up"></i> 3 �砍𪂹�啣�
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- �蠘��∠� -->
|
||||
<div class="function-grid">
|
||||
<div class="function-card" onclick="window.location.href='user_management.html'">
|
||||
<div class="function-icon">
|
||||
<i class="fas fa-users"></i>
|
||||
</div>
|
||||
<h3 class="function-title">�冽�蝞∠�</h3>
|
||||
<p class="function-description">
|
||||
蝞∠����厩鍂�瑁揭�瘀���𡠺瘛餃����颲㻫����斤鍂�瘀�霈曄蔭�冽�閫坿𠧧�峕��僐�? </p>
|
||||
<button class="btn btn-primary">餈𥕦�蝞∠�</button>
|
||||
</div>
|
||||
|
||||
<div class="function-card" onclick="window.location.href='student_management.html'">
|
||||
<div class="function-icon">
|
||||
<i class="fas fa-user-graduate"></i>
|
||||
</div>
|
||||
<h3 class="function-title">摮衣�蝞∠�</h3>
|
||||
<p class="function-description">
|
||||
蝞∠�摮衣�靽⊥�嚗���砍郎蝐滨恣����号蝥批��溻��縑�舐輕�文��寥�撖澆�撖澆枂�? </p>
|
||||
<button class="btn btn-primary">餈𥕦�蝞∠�</button>
|
||||
</div>
|
||||
|
||||
<div class="function-card" onclick="window.location.href='teacher_management.html'">
|
||||
<div class="function-icon">
|
||||
<i class="fas fa-chalkboard-teacher"></i>
|
||||
</div>
|
||||
<h3 class="function-title">�坔�蝞∠�</h3>
|
||||
<p class="function-description">
|
||||
蝞∠��坔�靽⊥�嚗���祆�撣���溻��紋蝔见��鉝����鞱挽蝵桀�蝏拇���瓲�? </p>
|
||||
<button class="btn btn-primary">餈𥕦�蝞∠�</button>
|
||||
</div>
|
||||
|
||||
<div class="function-card" onclick="window.location.href='grade_statistics.html'">
|
||||
<div class="function-icon">
|
||||
<i class="fas fa-chart-bar"></i>
|
||||
</div>
|
||||
<h3 class="function-title">�鞟貍蝏蠘恣</h3>
|
||||
<p class="function-description">
|
||||
�亦��冽嵗�鞟貍蝏蠘恣嚗𣬚��𣂼��鞉𥁒�𠺪��舀��曇”撅閧內�峕㺭�桀紡�箝�? </p>
|
||||
<button class="btn btn-primary">�亦�蝏蠘恣</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 蝟餌��嗆�?-->
|
||||
<div class="system-status">
|
||||
<h2 class="section-title">
|
||||
<i class="fas fa-server"></i>
|
||||
蝟餌��嗆�? </h2>
|
||||
<div class="status-list">
|
||||
<div class="status-item">
|
||||
<div class="status-indicator online"></div>
|
||||
<div>
|
||||
<div class="status-label">�唳旿摨𤘪��?/div>
|
||||
<div class="status-value">餈鞱�甇�虜 | �滚��園𡢿: 12ms</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<div class="status-indicator online"></div>
|
||||
<div>
|
||||
<div class="status-label">Web�滚𦛚�?/div>
|
||||
<div class="status-value">餈鞱�甇�虜 | �函瑪�冽�: 156</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<div class="status-indicator online"></div>
|
||||
<div>
|
||||
<div class="status-label">��辣摮睃�</div>
|
||||
<div class="status-value">雿輻鍂�? 65% | �拐�: 35GB</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<div class="status-indicator warning"></div>
|
||||
<div>
|
||||
<div class="status-label">憭�遢�滚𦛚</div>
|
||||
<div class="status-value">銝𦠜活憭�遢: 2憭拙� | 撱箄悅蝡见朖憭�遢</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ��餈烐暑�?-->
|
||||
<div class="recent-activities">
|
||||
<h2 class="section-title">
|
||||
<i class="fas fa-history"></i>
|
||||
��餈烐暑�? </h2>
|
||||
<ul class="activity-list">
|
||||
<li class="activity-item">
|
||||
<div class="activity-icon">
|
||||
<i class="fas fa-user-plus"></i>
|
||||
</div>
|
||||
<div class="activity-content">
|
||||
<div class="activity-title">�啣�摮衣��冽�</div>
|
||||
<div class="activity-time">10����?| �滢�鈭? 蝞∠��?/div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="activity-item">
|
||||
<div class="activity-icon">
|
||||
<i class="fas fa-edit"></i>
|
||||
</div>
|
||||
<div class="activity-content">
|
||||
<div class="activity-title">靽格㺿�坔�靽⊥�</div>
|
||||
<div class="activity-time">1撠𤩺𧒄�?| �滢�鈭? 蝞∠��?/div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="activity-item">
|
||||
<div class="activity-icon">
|
||||
<i class="fas fa-chart-bar"></i>
|
||||
</div>
|
||||
<div class="activity-content">
|
||||
<div class="activity-title">����鞟貍蝏蠘恣�亙�</div>
|
||||
<div class="activity-time">3撠𤩺𧒄�?| �滢�鈭? 蝟餌�</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="activity-item">
|
||||
<div class="activity-icon">
|
||||
<i class="fas fa-download"></i>
|
||||
</div>
|
||||
<div class="activity-content">
|
||||
<div class="activity-title">撖澆枂�冽��唳旿</div>
|
||||
<div class="activity-time">5撠𤩺𧒄�?| �滢�鈭? 蝞∠��?/div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="activity-item">
|
||||
<div class="activity-icon">
|
||||
<i class="fas fa-cog"></i>
|
||||
</div>
|
||||
<div class="activity-content">
|
||||
<div class="activity-title">蝟餌�霈曄蔭�湔鰵</div>
|
||||
<div class="activity-time">1憭拙� | �滢�鈭? 蝞∠��?/div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// �湔鰵敶枏��園𡢿
|
||||
function updateCurrentTime() {
|
||||
const now = new Date();
|
||||
const options = {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
weekday: 'long',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
second: '2-digit'
|
||||
};
|
||||
document.getElementById('currentTime').textContent = now.toLocaleDateString('zh-CN', options);
|
||||
}
|
||||
|
||||
// 憿菟𢒰�㰘蝸�嗅�憪见�
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
updateCurrentTime();
|
||||
setInterval(updateCurrentTime, 1000);
|
||||
|
||||
// ���箇蒈敶? document.getElementById('logoutBtn').addEventListener('click', function() {
|
||||
if (confirm('蝖桀�閬����箇蒈敶訫�嚗?)) {
|
||||
// 皜�膄�餃��嗆�? localStorage.removeItem('token');
|
||||
localStorage.removeItem('userRole');
|
||||
localStorage.removeItem('userInfo');
|
||||
|
||||
// 頝唾蓮�啁蒈敶閖△�? window.location.href = 'login.html';
|
||||
}
|
||||
});
|
||||
|
||||
// �㰘蝸�冽�靽⊥�
|
||||
const userInfo = JSON.parse(localStorage.getItem('userInfo') || '{}');
|
||||
if (userInfo.name) {
|
||||
document.getElementById('adminName').textContent = userInfo.name;
|
||||
document.getElementById('userName').textContent = userInfo.name;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,441 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>摮衣�蝞∠� - XX摮行嵗�鞟貍蝞∠�蝟餌�</title>
|
||||
<link rel="stylesheet" href="/public/css/style.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<!-- 撖潸⏛�?-->
|
||||
<nav class="navbar">
|
||||
<div class="container">
|
||||
<div class="navbar-brand">
|
||||
<a href="/">
|
||||
<i class="fas fa-graduation-cap"></i>
|
||||
<span>XX摮行嵗�鞟貍蝞∠�蝟餌�</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="navbar-menu">
|
||||
<a href="/" class="navbar-item">
|
||||
<i class="fas fa-home"></i>
|
||||
<span>銝駁△</span>
|
||||
</a>
|
||||
<a href="/admin/dashboard" class="navbar-item">
|
||||
<i class="fas fa-tachometer-alt"></i>
|
||||
<span>�批��X踎</span>
|
||||
</a>
|
||||
<a href="/admin/student_management" class="navbar-item active">
|
||||
<i class="fas fa-users"></i>
|
||||
<span>摮衣�蝞∠�</span>
|
||||
</a>
|
||||
<a href="/teacher/grade_management" class="navbar-item">
|
||||
<i class="fas fa-chart-bar"></i>
|
||||
<span>�鞟貍蝞∠�</span>
|
||||
</a>
|
||||
<a href="/admin/user_management" class="navbar-item">
|
||||
<i class="fas fa-user-cog"></i>
|
||||
<span>�冽�蝞∠�</span>
|
||||
</a>
|
||||
<div class="navbar-user">
|
||||
<i class="fas fa-user-circle"></i>
|
||||
<span>蝞∠��?/span>
|
||||
<div class="user-dropdown">
|
||||
<a href="#"><i class="fas fa-user"></i> 銝芯犖韏��</a>
|
||||
<a href="#"><i class="fas fa-cog"></i> 霈曄蔭</a>
|
||||
<a href="/login"><i class="fas fa-sign-out-alt"></i> ���箇蒈敶?/a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- 銝餉���捆�?-->
|
||||
<main class="main-content">
|
||||
<div class="container">
|
||||
<div class="student-management">
|
||||
<!-- 憿菟𢒰��� -->
|
||||
<div class="page-header">
|
||||
<h1><i class="fas fa-users"></i> 摮衣�蝞∠�</h1>
|
||||
<p>蝞∠�摮衣��箸𧋦靽⊥�嚗峕𣈲��溶�𨬭���颲㻫����文��亥砭摮衣�靽⊥�</p>
|
||||
</div>
|
||||
|
||||
<!-- 蝑偦�匧躹�?-->
|
||||
<div class="filter-section">
|
||||
<div class="filter-row">
|
||||
<div class="filter-group">
|
||||
<label for="student-id"><i class="fas fa-id-card"></i> 摮血噡</label>
|
||||
<input type="text" id="student-id" placeholder="霂瑁��亙郎�?>
|
||||
</div>
|
||||
<div class="filter-group">
|
||||
<label for="student-name"><i class="fas fa-user"></i> 憪枏�</label>
|
||||
<input type="text" id="student-name" placeholder="霂瑁��亙��?>
|
||||
</div>
|
||||
<div class="filter-group">
|
||||
<label for="class-select"><i class="fas fa-school"></i> �剔漣</label>
|
||||
<select id="class-select">
|
||||
<option value="">�券��剔漣</option>
|
||||
<option value="霈∠��箇�摮虫����?�?>霈∠��箇�摮虫����?�?/option>
|
||||
<option value="霈∠��箇�摮虫����?�?>霈∠��箇�摮虫����?�?/option>
|
||||
<option value="頧臭辣撌亦�1�?>頧臭辣撌亦�1�?/option>
|
||||
<option value="頧臭辣撌亦�2�?>頧臭辣撌亦�2�?/option>
|
||||
<option value="蝵𤑳�撌亦�1�?>蝵𤑳�撌亦�1�?/option>
|
||||
<option value="蝵𤑳�撌亦�2�?>蝵𤑳�撌亦�2�?/option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="filter-group">
|
||||
<label for="gender-select"><i class="fas fa-venus-mars"></i> �批�</label>
|
||||
<select id="gender-select">
|
||||
<option value="">�券��批�</option>
|
||||
<option value="�?>�?/option>
|
||||
<option value="憟?>憟?/option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="action-buttons">
|
||||
<button id="add-btn" class="btn-add">
|
||||
<i class="fas fa-plus"></i>
|
||||
瘛餃�摮衣�
|
||||
</button>
|
||||
<button id="search-btn" class="btn-search">
|
||||
<i class="fas fa-search"></i>
|
||||
�亥砭摮衣�
|
||||
</button>
|
||||
<button id="reset-btn" class="btn-reset">
|
||||
<i class="fas fa-redo"></i>
|
||||
�滨蔭�∩辣
|
||||
</button>
|
||||
<button id="export-btn" class="btn-export">
|
||||
<i class="fas fa-file-export"></i>
|
||||
撖澆枂�唳旿
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 摮衣�銵冽聢 -->
|
||||
<div class="table-responsive">
|
||||
<table class="student-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>摮血噡</th>
|
||||
<th>憪枏�</th>
|
||||
<th>�批�</th>
|
||||
<th>�剔漣</th>
|
||||
<th>�𠉛頂�菔�</th>
|
||||
<th>�桃拳</th>
|
||||
<th>�亙郎�園𡢿</th>
|
||||
<th>�滢�</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="student-table-body">
|
||||
<!-- �唳旿撠��朞�JavaScript�冽���頧?-->
|
||||
<tr>
|
||||
<td colspan="8" class="loading">
|
||||
<i class="fas fa-spinner fa-spin"></i>
|
||||
<p>甇�銁�㰘蝸摮衣��唳旿...</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- ��△�找辣 -->
|
||||
<div class="pagination" id="pagination">
|
||||
<button id="prev-btn" disabled>
|
||||
<i class="fas fa-chevron-left"></i>
|
||||
銝𠹺�憿? </button>
|
||||
<button class="active">1</button>
|
||||
<button>2</button>
|
||||
<button>3</button>
|
||||
<button id="next-btn">
|
||||
銝衤�憿? <i class="fas fa-chevron-right"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- 憿菔� -->
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p>穢 2023 XX摮行嵗�鞟貍蝞∠�蝟餌�. ������?</p>
|
||||
<p>���舀𣈲�? 霈∠��箇�摮虫����臬郎�?/p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
// 璅⊥�摮衣��唳旿
|
||||
const mockStudents = [
|
||||
{
|
||||
id: '20230001',
|
||||
name: '撘牐�',
|
||||
gender: '�?,
|
||||
class: '霈∠��箇�摮虫����?�?,
|
||||
phone: '13800138001',
|
||||
email: 'zhangsan@example.com',
|
||||
enrollmentDate: '2023-09-01'
|
||||
},
|
||||
{
|
||||
id: '20230002',
|
||||
name: '�𤾸�',
|
||||
gender: '憟?,
|
||||
class: '霈∠��箇�摮虫����?�?,
|
||||
phone: '13800138002',
|
||||
email: 'lisi@example.com',
|
||||
enrollmentDate: '2023-09-01'
|
||||
},
|
||||
{
|
||||
id: '20230003',
|
||||
name: '�衤�',
|
||||
gender: '�?,
|
||||
class: '霈∠��箇�摮虫����?�?,
|
||||
phone: '13800138003',
|
||||
email: 'wangwu@example.com',
|
||||
enrollmentDate: '2023-09-01'
|
||||
},
|
||||
{
|
||||
id: '20230004',
|
||||
name: '韏萄�',
|
||||
gender: '憟?,
|
||||
class: '頧臭辣撌亦�1�?,
|
||||
phone: '13800138004',
|
||||
email: 'zhaoliu@example.com',
|
||||
enrollmentDate: '2023-09-01'
|
||||
},
|
||||
{
|
||||
id: '20230005',
|
||||
name: '�曹�',
|
||||
gender: '�?,
|
||||
class: '頧臭辣撌亦�2�?,
|
||||
phone: '13800138005',
|
||||
email: 'qianqi@example.com',
|
||||
enrollmentDate: '2023-09-01'
|
||||
},
|
||||
{
|
||||
id: '20230006',
|
||||
name: '摮坔�',
|
||||
gender: '�?,
|
||||
class: '蝵𤑳�撌亦�1�?,
|
||||
phone: '13800138006',
|
||||
email: 'sunba@example.com',
|
||||
enrollmentDate: '2023-09-01'
|
||||
},
|
||||
{
|
||||
id: '20230007',
|
||||
name: '�其�',
|
||||
gender: '憟?,
|
||||
class: '蝵𤑳�撌亦�2�?,
|
||||
phone: '13800138007',
|
||||
email: 'zhoujiu@example.com',
|
||||
enrollmentDate: '2023-09-01'
|
||||
},
|
||||
{
|
||||
id: '20230008',
|
||||
name: '�游�',
|
||||
gender: '�?,
|
||||
class: '霈∠��箇�摮虫����?�?,
|
||||
phone: '13800138008',
|
||||
email: 'wushi@example.com',
|
||||
enrollmentDate: '2023-09-01'
|
||||
}
|
||||
];
|
||||
|
||||
// 敶枏�憿菜㺭�? let currentPage = 1;
|
||||
const pageSize = 5;
|
||||
let filteredStudents = [...mockStudents];
|
||||
|
||||
// DOM���
|
||||
const studentTableBody = document.getElementById('student-table-body');
|
||||
const pagination = document.getElementById('pagination');
|
||||
const prevBtn = document.getElementById('prev-btn');
|
||||
const nextBtn = document.getElementById('next-btn');
|
||||
const searchBtn = document.getElementById('search-btn');
|
||||
const resetBtn = document.getElementById('reset-btn');
|
||||
const addBtn = document.getElementById('add-btn');
|
||||
const exportBtn = document.getElementById('export-btn');
|
||||
|
||||
// 皜脫�摮衣�銵冽聢
|
||||
function renderStudentTable() {
|
||||
const startIndex = (currentPage - 1) * pageSize;
|
||||
const endIndex = startIndex + pageSize;
|
||||
const pageStudents = filteredStudents.slice(startIndex, endIndex);
|
||||
|
||||
if (pageStudents.length === 0) {
|
||||
studentTableBody.innerHTML = `
|
||||
<tr>
|
||||
<td colspan="8" class="no-results">
|
||||
<i class="fas fa-user-slash"></i>
|
||||
<h3>瘝⊥��曉�摮衣�靽⊥�</h3>
|
||||
<p>霂瑕�霂閗��渡��㗇辺隞嗆�瘛餃��啣郎�?/p>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
return;
|
||||
}
|
||||
|
||||
let tableHTML = '';
|
||||
pageStudents.forEach(student => {
|
||||
tableHTML += `
|
||||
<tr>
|
||||
<td>${student.id}</td>
|
||||
<td>${student.name}</td>
|
||||
<td>${student.gender}</td>
|
||||
<td>${student.class}</td>
|
||||
<td>${student.phone}</td>
|
||||
<td>${student.email}</td>
|
||||
<td>${student.enrollmentDate}</td>
|
||||
<td>
|
||||
<div class="action-buttons-cell">
|
||||
<button class="btn-edit" onclick="editStudent('${student.id}')">
|
||||
<i class="fas fa-edit"></i>
|
||||
蝻𤥁�
|
||||
</button>
|
||||
<button class="btn-delete" onclick="deleteStudent('${student.id}')">
|
||||
<i class="fas fa-trash"></i>
|
||||
�𣳇膄
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
|
||||
studentTableBody.innerHTML = tableHTML;
|
||||
}
|
||||
|
||||
// �湔鰵��△�找辣
|
||||
function updatePagination() {
|
||||
const totalPages = Math.ceil(filteredStudents.length / pageSize);
|
||||
const paginationButtons = pagination.querySelectorAll('button:not(#prev-btn):not(#next-btn)');
|
||||
|
||||
// �湔鰵憿萇��厰僼
|
||||
paginationButtons.forEach((btn, index) => {
|
||||
if (index < totalPages) {
|
||||
btn.textContent = index + 1;
|
||||
btn.style.display = 'inline-block';
|
||||
btn.classList.toggle('active', index + 1 === currentPage);
|
||||
} else {
|
||||
btn.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
// �湔鰵銝𠹺�憿?銝衤�憿菜��桃𠶖�? prevBtn.disabled = currentPage === 1;
|
||||
nextBtn.disabled = currentPage === totalPages || totalPages === 0;
|
||||
}
|
||||
|
||||
// 蝑偦�匧郎�? function filterStudents() {
|
||||
const studentId = document.getElementById('student-id').value.trim();
|
||||
const studentName = document.getElementById('student-name').value.trim();
|
||||
const selectedClass = document.getElementById('class-select').value;
|
||||
const selectedGender = document.getElementById('gender-select').value;
|
||||
|
||||
filteredStudents = mockStudents.filter(student => {
|
||||
const matchesId = !studentId || student.id.includes(studentId);
|
||||
const matchesName = !studentName || student.name.includes(studentName);
|
||||
const matchesClass = !selectedClass || student.class === selectedClass;
|
||||
const matchesGender = !selectedGender || student.gender === selectedGender;
|
||||
|
||||
return matchesId && matchesName && matchesClass && matchesGender;
|
||||
});
|
||||
|
||||
currentPage = 1;
|
||||
renderStudentTable();
|
||||
updatePagination();
|
||||
}
|
||||
|
||||
// �滨蔭蝑偦�㗇辺隞? function resetFilters() {
|
||||
document.getElementById('student-id').value = '';
|
||||
document.getElementById('student-name').value = '';
|
||||
document.getElementById('class-select').value = '';
|
||||
document.getElementById('gender-select').value = '';
|
||||
|
||||
filteredStudents = [...mockStudents];
|
||||
currentPage = 1;
|
||||
renderStudentTable();
|
||||
updatePagination();
|
||||
}
|
||||
|
||||
// 瘛餃�摮衣�
|
||||
function addStudent() {
|
||||
alert('瘛餃�摮衣��蠘�撠�銁�𡒊垢API摰峕��𤾸��?);
|
||||
// 餈䠷��臭誑�枏�銝�銝芣芋����交溶�惩郎�煺縑�? }
|
||||
|
||||
// 蝻𤥁�摮衣�
|
||||
function editStudent(studentId) {
|
||||
alert(`蝻𤥁�摮衣� ${studentId} �蠘�撠�銁�𡒊垢API摰峕��𤾸��躬);
|
||||
// 餈䠷��臭誑�枏�銝�銝芣芋����亦�颲穃郎�煺縑�? }
|
||||
|
||||
// �𣳇膄摮衣�
|
||||
function deleteStudent(studentId) {
|
||||
if (confirm(`蝖桀�閬���文郎�瑚蛹 ${studentId} ��郎�笔�嚗鬮)) {
|
||||
alert(`�𣳇膄摮衣� ${studentId} �蠘�撠�銁�𡒊垢API摰峕��𤾸��躬);
|
||||
// 餈䠷��臭誑靚�鍂API�𣳇膄摮衣�
|
||||
}
|
||||
}
|
||||
|
||||
// 撖澆枂�唳旿
|
||||
function exportData() {
|
||||
alert('撖澆枂�唳旿�蠘�撠�銁�𡒊垢API摰峕��𤾸��?);
|
||||
// 餈䠷��臭誑靚�鍂API撖澆枂Excel�𥟟SV��辣
|
||||
}
|
||||
|
||||
// 憿菟𢒰��揢
|
||||
function goToPage(page) {
|
||||
currentPage = page;
|
||||
renderStudentTable();
|
||||
updatePagination();
|
||||
}
|
||||
|
||||
// �嘥��碶�隞嗥��? function initEventListeners() {
|
||||
searchBtn.addEventListener('click', filterStudents);
|
||||
resetBtn.addEventListener('click', resetFilters);
|
||||
addBtn.addEventListener('click', addStudent);
|
||||
exportBtn.addEventListener('click', exportData);
|
||||
|
||||
prevBtn.addEventListener('click', () => {
|
||||
if (currentPage > 1) {
|
||||
goToPage(currentPage - 1);
|
||||
}
|
||||
});
|
||||
|
||||
nextBtn.addEventListener('click', () => {
|
||||
const totalPages = Math.ceil(filteredStudents.length / pageSize);
|
||||
if (currentPage < totalPages) {
|
||||
goToPage(currentPage + 1);
|
||||
}
|
||||
});
|
||||
|
||||
// 憿萇��厰僼�孵稬鈭衤辣
|
||||
pagination.addEventListener('click', (e) => {
|
||||
if (e.target.tagName === 'BUTTON' &&
|
||||
!e.target.id &&
|
||||
!e.target.classList.contains('active')) {
|
||||
const page = parseInt(e.target.textContent);
|
||||
goToPage(page);
|
||||
}
|
||||
});
|
||||
|
||||
// 颲枏�獢��頧行�蝝? document.getElementById('student-id').addEventListener('keypress', (e) => {
|
||||
if (e.key === 'Enter') filterStudents();
|
||||
});
|
||||
|
||||
document.getElementById('student-name').addEventListener('keypress', (e) => {
|
||||
if (e.key === 'Enter') filterStudents();
|
||||
});
|
||||
}
|
||||
|
||||
// 憿菟𢒰�㰘蝸摰峕��𤾸�憪见�
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// 璅⊥�API撱嗉��㰘蝸
|
||||
setTimeout(() => {
|
||||
renderStudentTable();
|
||||
updatePagination();
|
||||
initEventListeners();
|
||||
}, 500);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,494 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>�冽�蝞∠� - XX摮行嵗�鞟貍蝞∠�蝟餌�</title>
|
||||
<link rel="stylesheet" href="/public/css/style.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<!-- 撖潸⏛�?-->
|
||||
<nav class="navbar">
|
||||
<div class="container">
|
||||
<div class="navbar-brand">
|
||||
<a href="/">
|
||||
<i class="fas fa-graduation-cap"></i>
|
||||
<span>XX摮行嵗�鞟貍蝞∠�蝟餌�</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="navbar-menu">
|
||||
<div class="navbar-start">
|
||||
<a href="/admin/dashboard" class="navbar-item">
|
||||
<i class="fas fa-tachometer-alt"></i>
|
||||
<span>隞芾”�?/span>
|
||||
</a>
|
||||
<a href="/admin/user_management" class="navbar-item active">
|
||||
<i class="fas fa-users"></i>
|
||||
<span>�冽�蝞∠�</span>
|
||||
</a>
|
||||
<a href="/admin/student_management" class="navbar-item">
|
||||
<i class="fas fa-user-graduate"></i>
|
||||
<span>摮衣�蝞∠�</span>
|
||||
</a>
|
||||
<a href="/teacher/grade_management" class="navbar-item">
|
||||
<i class="fas fa-chart-bar"></i>
|
||||
<span>�鞟貍蝏蠘恣</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="navbar-end">
|
||||
<div class="navbar-item user-info">
|
||||
<i class="fas fa-user-circle"></i>
|
||||
<span>蝞∠��?/span>
|
||||
<div class="dropdown">
|
||||
<a href="#" class="dropdown-toggle">
|
||||
<i class="fas fa-caret-down"></i>
|
||||
</a>
|
||||
<div class="dropdown-menu">
|
||||
<a href="/admin/dashboard" class="dropdown-item">
|
||||
<i class="fas fa-tachometer-alt"></i>
|
||||
隞芾”�? </a>
|
||||
<a href="#" class="dropdown-item">
|
||||
<i class="fas fa-cog"></i>
|
||||
蝟餌�霈曄蔭
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a href="/" class="dropdown-item">
|
||||
<i class="fas fa-sign-out-alt"></i>
|
||||
���箇蒈敶? </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- 銝餃�摰孵躹 -->
|
||||
<main class="main-content">
|
||||
<div class="container">
|
||||
<div class="user-management">
|
||||
<!-- 憿菟𢒰����屸𢒰���撖潸⏛ -->
|
||||
<div class="page-header">
|
||||
<h1>�冽�蝞∠�</h1>
|
||||
<div class="breadcrumb">
|
||||
<a href="/">銝駁△</a> >
|
||||
<a href="/admin/dashboard">蝞∠��䀝貌銵冽踎</a> >
|
||||
<span>�冽�蝞∠�</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 蝑偦�匧躹�?-->
|
||||
<div class="filter-section">
|
||||
<form class="filter-form" id="filter-form">
|
||||
<div class="filter-group">
|
||||
<label for="user-id">�冽�ID</label>
|
||||
<input type="text" id="user-id" placeholder="霂瑁��亦鍂�弒D">
|
||||
</div>
|
||||
<div class="filter-group">
|
||||
<label for="user-name">憪枏�</label>
|
||||
<input type="text" id="user-name" placeholder="霂瑁��亙��?>
|
||||
</div>
|
||||
<div class="filter-group">
|
||||
<label for="role-select">閫坿𠧧</label>
|
||||
<select id="role-select">
|
||||
<option value="">�券�閫坿𠧧</option>
|
||||
<option value="admin">蝞∠��?/option>
|
||||
<option value="teacher">�坔�</option>
|
||||
<option value="student">摮衣�</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="filter-group">
|
||||
<label for="class-select">�剔漣</label>
|
||||
<select id="class-select">
|
||||
<option value="">�券��剔漣</option>
|
||||
<option value="霈∠��箇�摮虫����?�?>霈∠��箇�摮虫����?�?/option>
|
||||
<option value="霈∠��箇�摮虫����?�?>霈∠��箇�摮虫����?�?/option>
|
||||
<option value="頧臭辣撌亦�1�?>頧臭辣撌亦�1�?/option>
|
||||
<option value="頧臭辣撌亦�2�?>頧臭辣撌亦�2�?/option>
|
||||
<option value="蝵𤑳�撌亦�1�?>蝵𤑳�撌亦�1�?/option>
|
||||
<option value="蝵𤑳�撌亦�2�?>蝵𤑳�撌亦�2�?/option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="filter-actions">
|
||||
<button type="button" class="btn-add" id="add-btn">
|
||||
<i class="fas fa-plus"></i>
|
||||
瘛餃��冽�
|
||||
</button>
|
||||
<button type="button" class="btn-search" id="search-btn">
|
||||
<i class="fas fa-search"></i>
|
||||
�亥砭
|
||||
</button>
|
||||
<button type="button" class="btn-reset" id="reset-btn">
|
||||
<i class="fas fa-redo"></i>
|
||||
�滨蔭
|
||||
</button>
|
||||
<button type="button" class="btn-export" id="export-btn">
|
||||
<i class="fas fa-file-export"></i>
|
||||
撖澆枂
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- 蝏𤘪��箏� -->
|
||||
<div class="table-container">
|
||||
<table class="user-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>�冽�ID</th>
|
||||
<th>憪枏�</th>
|
||||
<th>閫坿𠧧</th>
|
||||
<th>�剔漣</th>
|
||||
<th>�𠉛頂�菔�</th>
|
||||
<th>�桃拳</th>
|
||||
<th>瘜典��園𡢿</th>
|
||||
<th>�滢�</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="user-table-body">
|
||||
<!-- �唳旿撠��朞�JavaScript�冽���頧?-->
|
||||
<tr>
|
||||
<td colspan="8" class="loading">
|
||||
<i class="fas fa-spinner fa-spin"></i>
|
||||
<p>甇�銁�㰘蝸�冽��唳旿...</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- ��△�找辣 -->
|
||||
<div class="pagination" id="pagination">
|
||||
<button id="prev-btn" disabled>
|
||||
<i class="fas fa-chevron-left"></i>
|
||||
銝𠹺�憿? </button>
|
||||
<div id="page-numbers">
|
||||
<button class="active">1</button>
|
||||
<button>2</button>
|
||||
<button>3</button>
|
||||
</div>
|
||||
<button id="next-btn">
|
||||
銝衤�憿? <i class="fas fa-chevron-right"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- 憿菔� -->
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p>© 2023 XX摮行嵗�鞟貍蝞∠�蝟餌�. ������?</p>
|
||||
<p>���舀𣈲�? 靽⊥����臭葉敹?| �𠉛頂�菔�: 010-12345678</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!-- JavaScript -->
|
||||
<script>
|
||||
// 璅⊥��冽��唳旿
|
||||
const mockUsers = [
|
||||
{
|
||||
id: 'admin001',
|
||||
name: '撘删恣���',
|
||||
role: 'admin',
|
||||
className: '',
|
||||
phone: '13800138001',
|
||||
email: 'admin@xxschool.edu.cn',
|
||||
registerTime: '2023-01-15'
|
||||
},
|
||||
{
|
||||
id: 'teacher001',
|
||||
name: '�舘���',
|
||||
role: 'teacher',
|
||||
className: '霈∠��箇�摮虫����?�?,
|
||||
phone: '13800138002',
|
||||
email: 'li.teacher@xxschool.edu.cn',
|
||||
registerTime: '2023-02-10'
|
||||
},
|
||||
{
|
||||
id: 'teacher002',
|
||||
name: '�贝���',
|
||||
role: 'teacher',
|
||||
className: '頧臭辣撌亦�1�?,
|
||||
phone: '13800138003',
|
||||
email: 'wang.teacher@xxschool.edu.cn',
|
||||
registerTime: '2023-02-12'
|
||||
},
|
||||
{
|
||||
id: 'student001',
|
||||
name: '撘牐�',
|
||||
role: 'student',
|
||||
className: '霈∠��箇�摮虫����?�?,
|
||||
phone: '13800138004',
|
||||
email: 'zhangsan@xxschool.edu.cn',
|
||||
registerTime: '2023-03-01'
|
||||
},
|
||||
{
|
||||
id: 'student002',
|
||||
name: '�𤾸�',
|
||||
role: 'student',
|
||||
className: '霈∠��箇�摮虫����?�?,
|
||||
phone: '13800138005',
|
||||
email: 'lisi@xxschool.edu.cn',
|
||||
registerTime: '2023-03-01'
|
||||
},
|
||||
{
|
||||
id: 'student003',
|
||||
name: '�衤�',
|
||||
role: 'student',
|
||||
className: '頧臭辣撌亦�1�?,
|
||||
phone: '13800138006',
|
||||
email: 'wangwu@xxschool.edu.cn',
|
||||
registerTime: '2023-03-02'
|
||||
},
|
||||
{
|
||||
id: 'student004',
|
||||
name: '韏萄�',
|
||||
role: 'student',
|
||||
className: '頧臭辣撌亦�1�?,
|
||||
phone: '13800138007',
|
||||
email: 'zhaoliu@xxschool.edu.cn',
|
||||
registerTime: '2023-03-02'
|
||||
},
|
||||
{
|
||||
id: 'student005',
|
||||
name: '�曹�',
|
||||
role: 'student',
|
||||
className: '蝵𤑳�撌亦�1�?,
|
||||
phone: '13800138008',
|
||||
email: 'qianqi@xxschool.edu.cn',
|
||||
registerTime: '2023-03-03'
|
||||
},
|
||||
{
|
||||
id: 'student006',
|
||||
name: '摮坔�',
|
||||
role: 'student',
|
||||
className: '蝵𤑳�撌亦�2�?,
|
||||
phone: '13800138009',
|
||||
email: 'sunba@xxschool.edu.cn',
|
||||
registerTime: '2023-03-03'
|
||||
},
|
||||
{
|
||||
id: 'student007',
|
||||
name: '�其�',
|
||||
role: 'student',
|
||||
className: '霈∠��箇�摮虫����?�?,
|
||||
phone: '13800138010',
|
||||
email: 'zhoujiu@xxschool.edu.cn',
|
||||
registerTime: '2023-03-04'
|
||||
}
|
||||
];
|
||||
|
||||
// 敶枏��曄內��鍂�瑟㺭�? let currentUsers = [...mockUsers];
|
||||
let currentPage = 1;
|
||||
const usersPerPage = 5;
|
||||
|
||||
// DOM���
|
||||
const userTableBody = document.getElementById('user-table-body');
|
||||
const pagination = document.getElementById('pagination');
|
||||
const prevBtn = document.getElementById('prev-btn');
|
||||
const nextBtn = document.getElementById('next-btn');
|
||||
const pageNumbers = document.getElementById('page-numbers');
|
||||
const searchBtn = document.getElementById('search-btn');
|
||||
const resetBtn = document.getElementById('reset-btn');
|
||||
const addBtn = document.getElementById('add-btn');
|
||||
const exportBtn = document.getElementById('export-btn');
|
||||
const userIdInput = document.getElementById('user-id');
|
||||
const userNameInput = document.getElementById('user-name');
|
||||
const roleSelect = document.getElementById('role-select');
|
||||
const classSelect = document.getElementById('class-select');
|
||||
|
||||
// �嘥��? document.addEventListener('DOMContentLoaded', function() {
|
||||
renderUserTable();
|
||||
setupEventListeners();
|
||||
updatePagination();
|
||||
});
|
||||
|
||||
// 霈曄蔭鈭衤辣�穃𨯬�? function setupEventListeners() {
|
||||
searchBtn.addEventListener('click', handleSearch);
|
||||
resetBtn.addEventListener('click', handleReset);
|
||||
addBtn.addEventListener('click', handleAddUser);
|
||||
exportBtn.addEventListener('click', handleExport);
|
||||
prevBtn.addEventListener('click', goToPrevPage);
|
||||
nextBtn.addEventListener('click', goToNextPage);
|
||||
}
|
||||
|
||||
// 皜脫��冽�銵冽聢
|
||||
function renderUserTable() {
|
||||
if (currentUsers.length === 0) {
|
||||
userTableBody.innerHTML = `
|
||||
<tr>
|
||||
<td colspan="8" class="no-results">
|
||||
<i class="fas fa-user-slash"></i>
|
||||
<h3>瘝⊥��曉��冽�</h3>
|
||||
<p>霂瑕�霂訫�隞𣇉��㗇辺隞嗆�瘛餃��啁鍂�?/p>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
return;
|
||||
}
|
||||
|
||||
// 霈∠�敶枏�憿萇��冽�
|
||||
const startIndex = (currentPage - 1) * usersPerPage;
|
||||
const endIndex = startIndex + usersPerPage;
|
||||
const pageUsers = currentUsers.slice(startIndex, endIndex);
|
||||
|
||||
let tableHTML = '';
|
||||
pageUsers.forEach(user => {
|
||||
// 閫坿𠧧敺賜�
|
||||
let roleBadge = '';
|
||||
if (user.role === 'admin') {
|
||||
roleBadge = '<span class="role-badge role-admin">蝞∠��?/span>';
|
||||
} else if (user.role === 'teacher') {
|
||||
roleBadge = '<span class="role-badge role-teacher">�坔�</span>';
|
||||
} else {
|
||||
roleBadge = '<span class="role-badge role-student">摮衣�</span>';
|
||||
}
|
||||
|
||||
tableHTML += `
|
||||
<tr>
|
||||
<td>${user.id}</td>
|
||||
<td>${user.name}</td>
|
||||
<td>${roleBadge}</td>
|
||||
<td>${user.className || '�?}</td>
|
||||
<td>${user.phone}</td>
|
||||
<td>${user.email}</td>
|
||||
<td>${user.registerTime}</td>
|
||||
<td>
|
||||
<div class="action-buttons-cell">
|
||||
<button class="btn-edit" onclick="editUser('${user.id}')">
|
||||
<i class="fas fa-edit"></i>
|
||||
蝻𤥁�
|
||||
</button>
|
||||
<button class="btn-delete" onclick="deleteUser('${user.id}')">
|
||||
<i class="fas fa-trash"></i>
|
||||
�𣳇膄
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
|
||||
userTableBody.innerHTML = tableHTML;
|
||||
}
|
||||
|
||||
// �湔鰵��△
|
||||
function updatePagination() {
|
||||
const totalPages = Math.ceil(currentUsers.length / usersPerPage);
|
||||
|
||||
// �湔鰵�厰僼�嗆�? prevBtn.disabled = currentPage === 1;
|
||||
nextBtn.disabled = currentPage === totalPages || totalPages === 0;
|
||||
|
||||
// �湔鰵憿萇��厰僼
|
||||
let pageButtonsHTML = '';
|
||||
for (let i = 1; i <= totalPages; i++) {
|
||||
if (i <= 5) { // ��憭𡁏遬蝷?銝芷△�? pageButtonsHTML += `<button class="${i === currentPage ? 'active' : ''}" onclick="goToPage(${i})">${i}</button>`;
|
||||
}
|
||||
}
|
||||
pageNumbers.innerHTML = pageButtonsHTML;
|
||||
}
|
||||
|
||||
// 憭���𦦵揣
|
||||
function handleSearch() {
|
||||
const userId = userIdInput.value.trim();
|
||||
const userName = userNameInput.value.trim();
|
||||
const role = roleSelect.value;
|
||||
const className = classSelect.value;
|
||||
|
||||
currentUsers = mockUsers.filter(user => {
|
||||
// �冽�ID蝑偦�? if (userId && !user.id.toLowerCase().includes(userId.toLowerCase())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 憪枏�蝑偦�? if (userName && !user.name.toLowerCase().includes(userName.toLowerCase())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 閫坿𠧧蝑偦�? if (role && user.role !== role) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// �剔漣蝑偦�? if (className && user.className !== className) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
currentPage = 1;
|
||||
renderUserTable();
|
||||
updatePagination();
|
||||
}
|
||||
|
||||
// 憭���滨蔭
|
||||
function handleReset() {
|
||||
userIdInput.value = '';
|
||||
userNameInput.value = '';
|
||||
roleSelect.value = '';
|
||||
classSelect.value = '';
|
||||
|
||||
currentUsers = [...mockUsers];
|
||||
currentPage = 1;
|
||||
renderUserTable();
|
||||
updatePagination();
|
||||
}
|
||||
|
||||
// 憭��瘛餃��冽�
|
||||
function handleAddUser() {
|
||||
alert('瘛餃��冽��蠘�撠�銁�𡒊垢API摰峕��𤾸��?);
|
||||
// 餈䠷��臭誑�枏�銝�銝芣芋����交溶�䭾鰵�冽�
|
||||
}
|
||||
|
||||
// 憭��撖澆枂
|
||||
function handleExport() {
|
||||
alert('撖澆枂�蠘�撠�銁�𡒊垢API摰峕��𤾸��?);
|
||||
// 餈䠷��臭誑撖澆枂銝慟xcel�𥟟SV�澆�
|
||||
}
|
||||
|
||||
// 蝻𤥁��冽�
|
||||
function editUser(userId) {
|
||||
alert(`蝻𤥁��冽� ${userId} - �蠘�撠�銁�𡒊垢API摰峕��𤾸��躬);
|
||||
// 餈䠷��臭誑�枏�銝�銝芣芋����亦�颲𤑳鍂�瑚縑�? }
|
||||
|
||||
// �𣳇膄�冽�
|
||||
function deleteUser(userId) {
|
||||
if (confirm(`蝖桀�閬���斤鍂�?${userId} �梹�甇斗�雿靝��舀伃����)) {
|
||||
// 隞擧芋��㺭�桐葉�𣳇膄
|
||||
const index = mockUsers.findIndex(user => user.id === userId);
|
||||
if (index !== -1) {
|
||||
mockUsers.splice(index, 1);
|
||||
// �湔鰵敶枏��曄內��㺭�? handleSearch();
|
||||
alert('�冽��𣳇膄�𣂼�');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ��△�賣㺭
|
||||
function goToPage(page) {
|
||||
currentPage = page;
|
||||
renderUserTable();
|
||||
updatePagination();
|
||||
}
|
||||
|
||||
function goToPrevPage() {
|
||||
if (currentPage > 1) {
|
||||
currentPage--;
|
||||
renderUserTable();
|
||||
updatePagination();
|
||||
}
|
||||
}
|
||||
|
||||
function goToNextPage() {
|
||||
const totalPages = Math.ceil(currentUsers.length / usersPerPage);
|
||||
if (currentPage < totalPages) {
|
||||
currentPage++;
|
||||
renderUserTable();
|
||||
updatePagination();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,130 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>摮衣��鞟貍蝞∠�蝟餌�</title>
|
||||
<link rel="stylesheet" href="/public/css/style.css">
|
||||
<link rel="stylesheet" href="/public/css/main.css">
|
||||
</head>
|
||||
<body>
|
||||
<!-- 撖潸⏛�?-->
|
||||
<nav class="navbar">
|
||||
<div class="navbar-brand">
|
||||
<i class="fas fa-graduation-cap"></i>
|
||||
<span>XX摮行嵗�鞟貍蝞∠�蝟餌�</span>
|
||||
</div>
|
||||
<div class="navbar-menu">
|
||||
<a href="/" class="btn btn-secondary">
|
||||
<i class="fas fa-home"></i> 銝駁△
|
||||
</a>
|
||||
<div class="navbar-user">
|
||||
<a href="/login" class="btn btn-primary" id="loginBtn">
|
||||
<i class="fas fa-sign-in-alt"></i> �餃�
|
||||
</a>
|
||||
<a href="/register" class="btn btn-secondary" id="registerBtn">
|
||||
<i class="fas fa-user-plus"></i> 瘜典�
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- 銝颱���捆�?-->
|
||||
<main>
|
||||
<!-- �梢��箏� -->
|
||||
<section class="hero-section">
|
||||
<div class="hero-content">
|
||||
<h1 class="hero-title">XX摮行嵗摮衣��鞟貍蝞∠�蝟餌�</h1>
|
||||
<p class="hero-subtitle">
|
||||
擃䀹�����具��惣�賜��鞟貍蝞∠�撟喳蝱嚗䔶蛹摮行嵗撣���𣂷��冽䲮雿滨��鞟貍蝞∠��滚𦛚嚗? 摰䂿緵�鞟貍敶訫���䰻霂U���霈∪�������雿枏�閫���寞��? </p>
|
||||
<div class="cta-buttons">
|
||||
<a href="/login" class="btn btn-primary" id="heroLoginBtn">
|
||||
<i class="fas fa-sign-in-alt"></i> 蝡见朖�餃�
|
||||
</a>
|
||||
<a href="#features" class="btn btn-secondary">
|
||||
<i class="fas fa-info-circle"></i> 鈭�圾�蠘�
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- �蠘��寡𠧧 -->
|
||||
<section id="features" class="features-section">
|
||||
<h2 class="section-title">蝟餌��蠘��寡𠧧</h2>
|
||||
<div class="features-grid">
|
||||
<div class="feature-card">
|
||||
<div class="feature-icon">
|
||||
<i class="fas fa-user-graduate"></i>
|
||||
</div>
|
||||
<h3 class="feature-title">摮衣��鞟貍�亥砭</h3>
|
||||
<p class="feature-description">
|
||||
摮衣��舫��嗆䰻�衤葵鈭箸�蝏抬���𡠺����鞟貍��像�������滨�靽⊥�嚗? �舀��鞟貍頞见飵�������脰扇敶閙䰻�卝�? </p>
|
||||
</div>
|
||||
|
||||
<div class="feature-card">
|
||||
<div class="feature-icon">
|
||||
<i class="fas fa-chalkboard-teacher"></i>
|
||||
</div>
|
||||
<h3 class="feature-title">�坔��鞟貍蝞∠�</h3>
|
||||
<p class="feature-description">
|
||||
�坔��臭噶�瑕��乓��耨�嫘��䰻霂W郎���蝏抬��舀��寥��滢��峕�蝏拍�霈∪��琜�
|
||||
�𣂷�憭𡁶��唳旿撖澆枂�澆��? </p>
|
||||
</div>
|
||||
|
||||
<div class="feature-card">
|
||||
<div class="feature-icon">
|
||||
<i class="fas fa-user-shield"></i>
|
||||
</div>
|
||||
<h3 class="feature-title">蝞∠��䀹��鞉綉�?/h3>
|
||||
<p class="feature-description">
|
||||
蝞∠��睃虾蝞∠��冽�韐行���郎�煺縑�荔��亦�蝟餌�蝏蠘恣�亥”嚗? 霈曄蔭����𣬚頂蝏笔��堆�蝖桐��唳旿摰匧��? </p>
|
||||
</div>
|
||||
|
||||
<div class="feature-card">
|
||||
<div class="feature-icon">
|
||||
<i class="fas fa-chart-line"></i>
|
||||
</div>
|
||||
<h3 class="feature-title">�箄�蝏蠘恣���</h3>
|
||||
<p class="feature-description">
|
||||
�𣂷�銝啣���㦛銵函�霈∪��踝���𡠺�鞟貍�������踹��僐��笆瘥𥪜㦛銵函�嚗? 撣桀𨭌摮行嵗餈𥡝��坔郎霂�摯���蝑𡝗𣈲���? </p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 銵�𢆡�瑕𡢢 -->
|
||||
<section class="cta-section">
|
||||
<h2 class="cta-title">蝡见朖雿㯄��箄��鞟貍蝞∠�</h2>
|
||||
<p style="font-size: 1.2rem; color: #666; margin-bottom: 40px; max-width: 600px; margin-left: auto; margin-right: auto;">
|
||||
�惩�XX摮行嵗�鞟貍蝞∠�蝟餌�嚗䔶�撉屸�����噶�瑞��鞟貍蝞∠��滚𦛚�? </p>
|
||||
<div class="cta-buttons">
|
||||
<a href="/login" class="btn btn-primary">
|
||||
<i class="fas fa-sign-in-alt"></i> 撘�憪衤蝙�? </a>
|
||||
<a href="#" class="btn btn-secondary">
|
||||
<i class="fas fa-book"></i> �亦���﹝
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<!-- 憿菔� -->
|
||||
<footer class="footer">
|
||||
<div class="footer-content">
|
||||
<h3 style="margin-bottom: 20px;">XX摮行嵗摮衣��鞟貍蝞∠�蝟餌�</h3>
|
||||
<p style="color: #ccc; margin-bottom: 20px; max-width: 600px; margin-left: auto; margin-right: auto;">
|
||||
�游�鈭𦒘蛹摮行嵗�𣂷�銝㮖�����具�������啣��𡝗�蝏拍恣��圾�單䲮獢��? </p>
|
||||
<div class="footer-links">
|
||||
<a href="#"><i class="fas fa-info-circle"></i> �喃��睲賑</a>
|
||||
<a href="#"><i class="fas fa-envelope"></i> �𠉛頂�睲賑</a>
|
||||
<a href="#"><i class="fas fa-shield-alt"></i> �鞟��輻�</a>
|
||||
<a href="#"><i class="fas fa-file-contract"></i> �滚𦛚�⊥狡</a>
|
||||
</div>
|
||||
<div class="copyright">
|
||||
<p>穢 2023 XX摮行嵗摮衣��鞟貍蝞∠�蝟餌� ������?/p>
|
||||
<p>�𠉛頂�菔�嚗?10-12345678 | �桃拳嚗䬙ontact@school.edu.cn</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script src="/public/js/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,62 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>学生成绩管理系统 - 登录</title>
|
||||
<link rel="stylesheet" href="/public/css/style.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="auth-container">
|
||||
<div class="auth-header">
|
||||
<h1><i class="fas fa-graduation-cap"></i> 学生成绩管理系统</h1>
|
||||
<p>请登录您的账户</p>
|
||||
</div>
|
||||
|
||||
<div class="auth-card">
|
||||
<form id="loginForm">
|
||||
<div class="form-group">
|
||||
<label for="id">
|
||||
<i class="fas fa-user"></i> 学号/工号
|
||||
</label>
|
||||
<input type="text" id="id" name="id" required
|
||||
placeholder="请输入学号/工号" autocomplete="username">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="password">
|
||||
<i class="fas fa-lock"></i> 密码
|
||||
</label>
|
||||
<input type="password" id="password" name="password" required
|
||||
placeholder="请输入密码" autocomplete="current-password">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="role">
|
||||
<i class="fas fa-user-tag"></i> 角色
|
||||
</label>
|
||||
<select id="role" name="role" required>
|
||||
<option value="">请选择角色</option>
|
||||
<option value="student">学生</option>
|
||||
<option value="teacher">教师</option>
|
||||
<option value="admin">管理员</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-block">
|
||||
<i class="fas fa-sign-in-alt"></i> 登录
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="auth-footer">
|
||||
<p>没有账户? <a href="/register">立即注册</a></p>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/public/js/auth.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,86 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>学生成绩管理系统 - 注册</title>
|
||||
<link rel="stylesheet" href="/public/css/style.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="auth-container">
|
||||
<div class="auth-header">
|
||||
<h1><i class="fas fa-graduation-cap"></i> 学生成绩管理系统</h1>
|
||||
<p>创建新账户</p>
|
||||
</div>
|
||||
|
||||
<div class="auth-card">
|
||||
<form id="registerForm">
|
||||
<div class="form-group">
|
||||
<label for="id">
|
||||
<i class="fas fa-id-card"></i> 学号/工号
|
||||
</label>
|
||||
<input type="text" id="id" name="id" required
|
||||
placeholder="请输入学号或工号" autocomplete="username">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="name">
|
||||
<i class="fas fa-user"></i> 姓名
|
||||
</label>
|
||||
<input type="text" id="name" name="name" required
|
||||
placeholder="请输入姓名">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="password">
|
||||
<i class="fas fa-lock"></i> 密码
|
||||
</label>
|
||||
<input type="password" id="password" name="password" required
|
||||
placeholder="请输入密码" autocomplete="new-password">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="confirmPassword">
|
||||
<i class="fas fa-lock"></i> 确认密码
|
||||
</label>
|
||||
<input type="password" id="confirmPassword" name="confirmPassword" required
|
||||
placeholder="请再次输入密码" autocomplete="new-password">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="role">
|
||||
<i class="fas fa-user-tag"></i> 角色
|
||||
</label>
|
||||
<select id="role" name="role" required>
|
||||
<option value="">请选择角色</option>
|
||||
<option value="student">学生</option>
|
||||
<option value="teacher">教师</option>
|
||||
<option value="admin">管理员</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="classField" style="display: none;">
|
||||
<label for="class">
|
||||
<i class="fas fa-users"></i> 班级
|
||||
</label>
|
||||
<input type="text" id="class" name="class"
|
||||
placeholder="请输入班级(学生/教师必填)">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-block">
|
||||
<i class="fas fa-user-plus"></i> 注册
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="auth-footer">
|
||||
<p>已有账户? <a href="/login">立即登录</a></p>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/public/js/auth.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,193 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>摮衣��鞟貍蝞∠�蝟餌� - 摮衣�隞芾”�?/title>
|
||||
<link rel="stylesheet" href="/public/css/style.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
||||
</head>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 憿園�撖潸⏛�?-->
|
||||
<nav class="navbar">
|
||||
<div class="navbar-brand">
|
||||
<i class="fas fa-graduation-cap"></i>
|
||||
<span>XX摮行嵗�鞟貍蝞∠�蝟餌�</span>
|
||||
</div>
|
||||
<div class="navbar-menu">
|
||||
<a href="/" class="btn btn-secondary">
|
||||
<i class="fas fa-home"></i> 銝駁△
|
||||
</a>
|
||||
<div class="navbar-user">
|
||||
<span class="user-name" id="userName">�㰘蝸銝?..</span>
|
||||
<button id="logoutBtn" class="btn btn-primary">
|
||||
<i class="fas fa-sign-out-alt"></i> ���? </button>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- 隞芾”�踹捆�?-->
|
||||
<div class="dashboard-container">
|
||||
<!-- 撌虫儒靘扯器�?-->
|
||||
<aside class="sidebar">
|
||||
<div class="sidebar-header">
|
||||
<div class="user-info">
|
||||
<div class="user-avatar">
|
||||
<i class="fas fa-user-graduate"></i>
|
||||
</div>
|
||||
<div class="user-details">
|
||||
<h3 id="studentName">�㰘蝸銝?..</h3>
|
||||
<p>摮衣� | �剔漣嚗?span id="studentClass">�㰘蝸銝?..</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="sidebar-menu">
|
||||
<li>
|
||||
<a href="#" class="active">
|
||||
<i class="fas fa-tachometer-alt"></i>
|
||||
<span>隞芾”�?/span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<i class="fas fa-chart-bar"></i>
|
||||
<span>�鞟貍�亥砭</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<i class="fas fa-book"></i>
|
||||
<span>霂曄�霂行�</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<i class="fas fa-user"></i>
|
||||
<span>銝芯犖靽⊥�</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<i class="fas fa-chart-line"></i>
|
||||
<span>�鞟貍���</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<i class="fas fa-download"></i>
|
||||
<span>�鞟貍撖澆枂</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</aside>
|
||||
|
||||
<!-- 銝餃�摰孵躹 -->
|
||||
<main class="main-content">
|
||||
<div class="content-header">
|
||||
<div>
|
||||
<h1 class="page-title">摮衣�隞芾”�?/h1>
|
||||
<div class="breadcrumb">
|
||||
<a href="/">銝駁△</a>
|
||||
<i class="fas fa-chevron-right"></i>
|
||||
<span>摮衣�隞芾”�?/span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="current-time" id="currentTime"></div>
|
||||
</div>
|
||||
|
||||
<!-- 蝏蠘恣�∠� -->
|
||||
<div class="stats-grid">
|
||||
<div class="stat-card">
|
||||
<div class="stat-icon gpa">
|
||||
<i class="fas fa-star"></i>
|
||||
</div>
|
||||
<div class="stat-value" id="gpaValue">3.75</div>
|
||||
<div class="stat-label">撟喳�蝏拍�</div>
|
||||
</div>
|
||||
|
||||
<div class="stat-card">
|
||||
<div class="stat-icon courses">
|
||||
<i class="fas fa-book"></i>
|
||||
</div>
|
||||
<div class="stat-value" id="courseCount">8</div>
|
||||
<div class="stat-label">撌脖耨霂曄�</div>
|
||||
</div>
|
||||
|
||||
<div class="stat-card">
|
||||
<div class="stat-icon credits">
|
||||
<i class="fas fa-certificate"></i>
|
||||
</div>
|
||||
<div class="stat-value" id="creditTotal">24</div>
|
||||
<div class="stat-label">�餃郎�?/div>
|
||||
</div>
|
||||
|
||||
<div class="stat-card">
|
||||
<div class="stat-icon ranking">
|
||||
<i class="fas fa-trophy"></i>
|
||||
</div>
|
||||
<div class="stat-value" id="classRank">5</div>
|
||||
<div class="stat-label">�剔漣�鍦�</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- �鞟貍銵冽聢 -->
|
||||
<div class="grades-table">
|
||||
<div class="table-header">
|
||||
<h2 class="table-title">�砍郎���蝏?/h2>
|
||||
<div class="table-actions">
|
||||
<select class="form-select" style="width: 150px;">
|
||||
<option value="all">���匧郎�?/option>
|
||||
<option value="2023-2" selected>2023-2024摮血僑蝚砌�摮行�</option>
|
||||
<option value="2023-1">2023-2024摮血僑蝚砌�摮行�</option>
|
||||
</select>
|
||||
<button class="btn btn-primary">
|
||||
<i class="fas fa-download"></i> 撖澆枂�鞟貍�? </button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-container">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>霂曄��滨妍</th>
|
||||
<th>霂曄�隞��</th>
|
||||
<th>摮血�</th>
|
||||
<th>撟單𧒄�鞟貍</th>
|
||||
<th>��錰�鞟貍</th>
|
||||
<th>�餅�蝏?/th>
|
||||
<th>蝏拍�</th>
|
||||
<th>�滢�</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="gradesTableBody">
|
||||
<!-- �鞟貍�唳旿撠��朞�JavaScript�冽���頧?-->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<script src="/public/js/student.js"></script>
|
||||
<script src="/public/js/auth.js"></script>
|
||||
<script>
|
||||
// �湔鰵敶枏��園𡢿
|
||||
function updateCurrentTime() {
|
||||
const now = new Date();
|
||||
const options = {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
second: '2-digit'
|
||||
};
|
||||
document.getElementById('currentTime').textContent = now.toLocaleString('zh-CN', options);
|
||||
}
|
||||
setInterval(updateCurrentTime, 1000);
|
||||
updateCurrentTime();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,507 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>摮衣��鞟貍蝞∠�蝟餌� - �坔�隞芾”�?/title>
|
||||
<link rel="stylesheet" href="/public/css/style.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
||||
</head>
|
||||
/* 隞芾”�踹�撅� */
|
||||
.dashboard-container {
|
||||
display: flex;
|
||||
min-height: calc(100vh - 80px);
|
||||
}
|
||||
|
||||
/* 靘扯器�?*/
|
||||
.sidebar {
|
||||
width: 250px;
|
||||
background: linear-gradient(180deg, #43e97b 0%, #38f9d7 100%);
|
||||
color: white;
|
||||
padding: 30px 0;
|
||||
position: sticky;
|
||||
top: 80px;
|
||||
height: calc(100vh - 80px);
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.sidebar-header {
|
||||
padding: 0 25px 30px;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.user-avatar {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
background: white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #43e97b;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.user-details h3 {
|
||||
margin: 0 0 5px;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.user-details p {
|
||||
margin: 0;
|
||||
font-size: 0.9rem;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.sidebar-menu {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.sidebar-menu li {
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.sidebar-menu a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 15px;
|
||||
padding: 15px 25px;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
transition: all 0.3s ease;
|
||||
border-left: 3px solid transparent;
|
||||
}
|
||||
|
||||
.sidebar-menu a:hover {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-left-color: white;
|
||||
}
|
||||
|
||||
.sidebar-menu a.active {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-left-color: white;
|
||||
}
|
||||
|
||||
.sidebar-menu i {
|
||||
width: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* 銝餃�摰孵躹 */
|
||||
.main-content {
|
||||
flex: 1;
|
||||
padding: 30px;
|
||||
background: #f8f9ff;
|
||||
}
|
||||
|
||||
.content-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-size: 1.8rem;
|
||||
color: #333;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.breadcrumb {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
color: #666;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.breadcrumb a {
|
||||
color: #43e97b;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.breadcrumb i {
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
/* �蠘��∠� */
|
||||
.function-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||
gap: 25px;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.function-card {
|
||||
background: white;
|
||||
border-radius: 15px;
|
||||
padding: 30px;
|
||||
text-align: center;
|
||||
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
|
||||
transition: all 0.3s ease;
|
||||
cursor: pointer;
|
||||
border: 2px solid transparent;
|
||||
}
|
||||
|
||||
.function-card:hover {
|
||||
transform: translateY(-5px);
|
||||
box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
|
||||
border-color: #43e97b;
|
||||
}
|
||||
|
||||
.function-icon {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
border-radius: 50%;
|
||||
background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 0 auto 20px;
|
||||
font-size: 32px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.function-title {
|
||||
font-size: 1.3rem;
|
||||
color: #333;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.function-description {
|
||||
color: #666;
|
||||
line-height: 1.5;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/* 敹恍���雿?*/
|
||||
.quick-actions {
|
||||
background: white;
|
||||
border-radius: 15px;
|
||||
padding: 25px;
|
||||
margin-bottom: 30px;
|
||||
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 1.4rem;
|
||||
color: #333;
|
||||
margin-bottom: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.section-title i {
|
||||
color: #43e97b;
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
padding: 12px 25px;
|
||||
background: #f8f9ff;
|
||||
border: 1px solid #e0e0e0;
|
||||
border-radius: 10px;
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.action-btn:hover {
|
||||
background: #43e97b;
|
||||
color: white;
|
||||
border-color: #43e97b;
|
||||
}
|
||||
|
||||
/* ��餈烐暑�?*/
|
||||
.recent-activities {
|
||||
background: white;
|
||||
border-radius: 15px;
|
||||
padding: 25px;
|
||||
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.activity-list {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.activity-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 15px;
|
||||
padding: 15px 0;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.activity-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.activity-icon {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
background: #f8f9ff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #43e97b;
|
||||
}
|
||||
|
||||
.activity-content {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.activity-title {
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.activity-time {
|
||||
font-size: 0.9rem;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* �滚�撘讛挽霈?*/
|
||||
@media (max-width: 992px) {
|
||||
.dashboard-container {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
position: static;
|
||||
padding: 20px 0;
|
||||
}
|
||||
|
||||
.sidebar-menu {
|
||||
display: flex;
|
||||
overflow-x: auto;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.sidebar-menu li {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.sidebar-menu a {
|
||||
padding: 10px 15px;
|
||||
border-left: none;
|
||||
border-bottom: 3px solid transparent;
|
||||
}
|
||||
|
||||
.sidebar-menu a:hover,
|
||||
.sidebar-menu a.active {
|
||||
border-left-color: transparent;
|
||||
border-bottom-color: white;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.main-content {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.content-header {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.function-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 憿園�撖潸⏛�?-->
|
||||
<nav class="navbar">
|
||||
<div class="navbar-brand">
|
||||
<i class="fas fa-graduation-cap"></i>
|
||||
<span>XX摮行嵗�鞟貍蝞∠�蝟餌�</span>
|
||||
</div>
|
||||
<div class="navbar-menu">
|
||||
<a href="/" class="btn btn-secondary">
|
||||
<i class="fas fa-home"></i> 銝駁△
|
||||
</a>
|
||||
<div class="navbar-user">
|
||||
<span class="user-name" id="userName">�舘���</span>
|
||||
<button id="logoutBtn" class="btn btn-primary">
|
||||
<i class="fas fa-sign-out-alt"></i> ���? </button>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- 隞芾”�踹捆�?-->
|
||||
<div class="dashboard-container">
|
||||
<!-- 撌虫儒靘扯器�?-->
|
||||
<aside class="sidebar">
|
||||
<div class="sidebar-header">
|
||||
<div class="user-info">
|
||||
<div class="user-avatar">
|
||||
<i class="fas fa-chalkboard-teacher"></i>
|
||||
</div>
|
||||
<div class="user-details">
|
||||
<h3 id="teacherName">�舘���</h3>
|
||||
<p>�坔� | �券秄嚗?span id="teacherDept">霈∠��箏郎�?/span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="sidebar-menu">
|
||||
<li>
|
||||
<a href="#" class="active">
|
||||
<i class="fas fa-tachometer-alt"></i>
|
||||
<span>隞芾”�?/span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/teacher/grade_entry">
|
||||
<i class="fas fa-edit"></i>
|
||||
<span>�鞟貍敶訫�</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="grade_query.html">
|
||||
<i class="fas fa-search"></i>
|
||||
<span>�鞟貍�亥砭</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="grade_manage.html">
|
||||
<i class="fas fa-cog"></i>
|
||||
<span>�鞟貍蝞∠�</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<i class="fas fa-chart-bar"></i>
|
||||
<span>蝏蠘恣���</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<i class="fas fa-download"></i>
|
||||
<span>�唳旿撖澆枂</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<i class="fas fa-user"></i>
|
||||
<span>銝芯犖靽⊥�</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</aside>
|
||||
|
||||
<!-- 銝餃�摰孵躹 -->
|
||||
<main class="main-content">
|
||||
<div class="content-header">
|
||||
<div>
|
||||
<h1 class="page-title">�坔�隞芾”�?/h1>
|
||||
<div class="breadcrumb">
|
||||
<a href="/">銝駁△</a>
|
||||
<i class="fas fa-chevron-right"></i>
|
||||
<span>�坔�隞芾”�?/span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="current-time" id="currentTime"></div>
|
||||
</div>
|
||||
|
||||
<!-- �蠘��∠� -->
|
||||
<div class="function-grid">
|
||||
<div class="function-card" onclick="window.location.href='grade_entry.html'">
|
||||
<div class="function-icon">
|
||||
<i class="fas fa-edit"></i>
|
||||
</div>
|
||||
<h3 class="function-title">�鞟貍敶訫�</h3>
|
||||
<p class="function-description">
|
||||
銝箏郎�笔��交鰵��紋蝔𧢲�蝏抬��舀��寥�撖澆����銝芸��乓�? </p>
|
||||
<button class="btn btn-primary">撘�憪见��?/button>
|
||||
</div>
|
||||
|
||||
<div class="function-card" onclick="window.location.href='grade_query.html'">
|
||||
<div class="function-icon">
|
||||
<i class="fas fa-search"></i>
|
||||
</div>
|
||||
<h3 class="function-title">�鞟貍�亥砭</h3>
|
||||
<p class="function-description">
|
||||
�亥砭摮衣��鞟貍嚗峕𣈲����剔漣��紋蝔卝��郎�毺�憭𡁶輕摨衣��剹�? </p>
|
||||
<button class="btn btn-primary">撘�憪𧢲䰻霂?/button>
|
||||
</div>
|
||||
|
||||
<div class="function-card" onclick="window.location.href='grade_manage.html'">
|
||||
<div class="function-icon">
|
||||
<i class="fas fa-cog"></i>
|
||||
</div>
|
||||
<h3 class="function-title">�鞟貍蝞∠�</h3>
|
||||
<p class="function-description">
|
||||
靽格㺿�硋��文歇敶訫����蝏抬�蝞∠��鞟貍霈啣��𣬚𠶖���? </p>
|
||||
<button class="btn btn-primary">撘�憪讠恣�?/button>
|
||||
</div>
|
||||
|
||||
<div class="function-card" onclick="window.location.href='#'">
|
||||
<div class="function-icon">
|
||||
<i class="fas fa-chart-bar"></i>
|
||||
</div>
|
||||
<h3 class="function-title">蝏蠘恣���</h3>
|
||||
<p class="function-description">
|
||||
�亦��鞟貍蝏蠘恣�曇”嚗���鞉�摮行��𨅯�摮衣�銵函緵�? </p>
|
||||
<button class="btn btn-primary">�亦�蝏蠘恣</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 敹恍���雿?-->
|
||||
<div class="quick-actions">
|
||||
<h2 class="section-title">
|
||||
<i class="fas fa-bolt"></i>
|
||||
敹恍���雿? </h2>
|
||||
<div class="action-buttons">
|
||||
<a href="/teacher/grade_entry" class="action-btn">
|
||||
<i class="fas fa-plus"></i>
|
||||
敶訫��唳�蝏? </a>
|
||||
<a href="grade_query.html" class="action-btn">
|
||||
<i class="fas fa-search"></i>
|
||||
�亥砭�鞟貍
|
||||
</a>
|
||||
<a href="#" class="action-btn">
|
||||
<i class="fas fa-download"></i>
|
||||
撖澆枂�鞟貍�? </a>
|
||||
<a href="#" class="action-btn">
|
||||
<i class="fas fa-chart-pie"></i>
|
||||
���蝏蠘恣�亙�
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ��餈烐暑�
|
||||
@@ -0,0 +1,447 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>�鞟貍敶訫� - XX摮行嵗�鞟貍蝞∠�蝟餌�</title>
|
||||
<link rel="stylesheet" href="/public/css/style.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<!-- 撖潸⏛�?-->
|
||||
<nav class="navbar">
|
||||
<div class="navbar-brand">
|
||||
<a href="/"><i class="fas fa-graduation-cap"></i> XX摮行嵗�鞟貍蝞∠�蝟餌�</a>
|
||||
</div>
|
||||
<div class="navbar-menu">
|
||||
<a href="/teacher/dashboard" class="navbar-item"><i class="fas fa-tachometer-alt"></i> �坔�隞芾”�?/a>
|
||||
<a href="/teacher/grade_entry" class="navbar-item active"><i class="fas fa-edit"></i> �鞟貍敶訫�</a>
|
||||
<a href="/teacher/grade_management" class="navbar-item"><i class="fas fa-list"></i> �鞟貍蝞∠�</a>
|
||||
<div class="user-info">
|
||||
<span class="user-name">�舘���</span>
|
||||
<span class="user-role">�坔�</span>
|
||||
<a href="/login" class="btn btn-outline btn-small"><i class="fas fa-sign-out-alt"></i> ���?/a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- �W�撅穃紡�?-->
|
||||
<div class="container">
|
||||
<div class="breadcrumb">
|
||||
<a href="/">銝駁△</a>
|
||||
<i class="fas fa-chevron-right"></i>
|
||||
<a href="/teacher/dashboard">�坔�隞芾”�?/a>
|
||||
<i class="fas fa-chevron-right"></i>
|
||||
<span>�鞟貍敶訫�</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 銝餃�摰孵躹 -->
|
||||
<div class="grade-entry-container">
|
||||
<div class="entry-header">
|
||||
<h1><i class="fas fa-edit"></i> �鞟貍敶訫�</h1>
|
||||
<p>霂琿�㗇𥋘�剔漣�諹紋蝔页��嗅�銝箸�銝芸郎�笔��交�蝏?/p>
|
||||
</div>
|
||||
|
||||
<div class="entry-form">
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label for="class-select"><i class="fas fa-users"></i> �㗇𥋘�剔漣</label>
|
||||
<select id="class-select" class="form-control">
|
||||
<option value="">霂琿�㗇𥋘�剔漣</option>
|
||||
<option value="class1">霈∠��箇�摮虫����?021蝥?�?/option>
|
||||
<option value="class2">霈∠��箇�摮虫����?021蝥?�?/option>
|
||||
<option value="class3">頧臭辣撌亦�2021蝥?�?/option>
|
||||
<option value="class4">頧臭辣撌亦�2021蝥?�?/option>
|
||||
<option value="class5">蝵𤑳�撌亦�2021蝥?�?/option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="course-name"><i class="fas fa-book"></i> 霂曄��滨妍</label>
|
||||
<input type="text" id="course-name" placeholder="霂瑁��亥紋蝔见�蝘堆�憒���唳旿蝏𤘪����雿𦦵頂蝏毺�">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="exam-date"><i class="fas fa-calendar-alt"></i> ����交�</label>
|
||||
<input type="date" id="exam-date">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label><i class="fas fa-info-circle"></i> 憭�釣霂湔�嚗�虾�㚁�</label>
|
||||
<textarea id="remarks" rows="3" placeholder="�航��交𧋦甈∟�����秩�𦒘縑�荔�憒���煺葉�������怨���蝑?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="students-table-container">
|
||||
<h3><i class="fas fa-user-graduate"></i> 摮衣��鞟貍敶訫�</h3>
|
||||
<p class="text-muted">�㗇𥋘�剔漣�𠬍�蝟餌�撠�䌊�典�頧質砲�剔漣��郎�笔�銵?/p>
|
||||
|
||||
<div id="students-loading" class="loading" style="display: none;">
|
||||
<i class="fas fa-spinner"></i>
|
||||
<p>甇�銁�㰘蝸摮衣��𡑒”...</p>
|
||||
</div>
|
||||
|
||||
<div id="no-students" class="no-students" style="display: none;">
|
||||
<i class="fas fa-user-slash"></i>
|
||||
<p>霂亦号蝥扳��惩郎��㺭�殷�霂瑕�瘛餃�摮衣�靽⊥�</p>
|
||||
</div>
|
||||
|
||||
<table id="students-table" class="students-table" style="display: none;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>摮血噡</th>
|
||||
<th>憪枏�</th>
|
||||
<th>撟單𧒄�鞟貍</th>
|
||||
<th>�煺葉�鞟貍</th>
|
||||
<th>��錰�鞟貍</th>
|
||||
<th>�餉��鞟貍</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="students-tbody">
|
||||
<!-- 摮衣��唳旿撠��朞�JavaScript�冽���頧?-->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<button id="cancel-btn" class="btn btn-secondary btn-large">
|
||||
<i class="fas fa-times"></i> �𡝗�
|
||||
</button>
|
||||
<button id="submit-btn" class="btn btn-primary btn-large" disabled>
|
||||
<i class="fas fa-check"></i> �𣂷漱�鞟貍
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h3><i class="fas fa-lightbulb"></i> 雿輻鍂霂湔�</h3>
|
||||
<ul class="text-muted">
|
||||
<li>擐硋��㗇𥋘閬���交�蝏拍��剔漣�諹紋蝔?/li>
|
||||
<li>蝟餌�隡朞䌊�典�頧質砲�剔漣��郎�笔�銵?/li>
|
||||
<li>銝箸�銝芸郎�蠘��亙像�嗆�蝏押���銝剜�蝏拙���錰�鞟貍</li>
|
||||
<li>�餉��鞟貍撠�覔�格��滩䌊�刻恣蝞梹�暺䁅恕���嚗𡁜像�?0%嚗峕�銝?0%嚗峕��?0%嚗?/li>
|
||||
<li>蝖株恕�㰘秤�𡒊��領�𨀣�鈭斗�蝏抽�脲��桐�摮䀹㺭�?/li>
|
||||
<li>�𣂷漱�𤾸虾隞亙銁�𨀣�蝏拍恣���嗪△�X䰻�见�靽格㺿撌脣��亦��鞟貍</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- JavaScript -->
|
||||
<script>
|
||||
// 璅⊥�摮衣��唳旿
|
||||
const mockStudents = [
|
||||
{ id: '2021001', name: '撘牐�', usual: '', midterm: '', final: '', total: '' },
|
||||
{ id: '2021002', name: '�𤾸�', usual: '', midterm: '', final: '', total: '' },
|
||||
{ id: '2021003', name: '�衤�', usual: '', midterm: '', final: '', total: '' },
|
||||
{ id: '2021004', name: '韏萄�', usual: '', midterm: '', final: '', total: '' },
|
||||
{ id: '2021005', name: '�曹�', usual: '', midterm: '', final: '', total: '' },
|
||||
{ id: '2021006', name: '摮坔�', usual: '', midterm: '', final: '', total: '' },
|
||||
{ id: '2021007', name: '�其�', usual: '', midterm: '', final: '', total: '' },
|
||||
{ id: '2021008', name: '�游�', usual: '', midterm: '', final: '', total: '' }
|
||||
];
|
||||
|
||||
// DOM���
|
||||
const classSelect = document.getElementById('class-select');
|
||||
const courseNameInput = document.getElementById('course-name');
|
||||
const examDateInput = document.getElementById('exam-date');
|
||||
const remarksInput = document.getElementById('remarks');
|
||||
const studentsLoading = document.getElementById('students-loading');
|
||||
const noStudents = document.getElementById('no-students');
|
||||
const studentsTable = document.getElementById('students-table');
|
||||
const studentsTbody = document.getElementById('students-tbody');
|
||||
const cancelBtn = document.getElementById('cancel-btn');
|
||||
const submitBtn = document.getElementById('submit-btn');
|
||||
|
||||
// 霈曄蔭暺䁅恕����交�銝箔�憭? const today = new Date().toISOString().split('T')[0];
|
||||
examDateInput.value = today;
|
||||
|
||||
// �剔漣�㗇𥋘�睃�鈭衤辣
|
||||
classSelect.addEventListener('change', function() {
|
||||
const selectedClass = this.value;
|
||||
|
||||
if (!selectedClass) {
|
||||
hideStudentsTable();
|
||||
submitBtn.disabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// �曄內�㰘蝸�嗆�? showLoading();
|
||||
|
||||
// 璅⊥�API靚�鍂撱嗉�
|
||||
setTimeout(() => {
|
||||
loadStudentsForClass(selectedClass);
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
// �㰘蝸摮衣��唳旿
|
||||
function loadStudentsForClass(className) {
|
||||
// 璅⊥�API�滚�
|
||||
if (mockStudents.length > 0) {
|
||||
renderStudentsTable(mockStudents);
|
||||
} else {
|
||||
showNoStudents();
|
||||
}
|
||||
}
|
||||
|
||||
// 皜脫�摮衣�銵冽聢
|
||||
function renderStudentsTable(students) {
|
||||
hideLoading();
|
||||
|
||||
// 皜�征銵冽聢
|
||||
studentsTbody.innerHTML = '';
|
||||
|
||||
// 瘛餃�摮衣�銵? students.forEach((student, index) => {
|
||||
const row = document.createElement('tr');
|
||||
row.innerHTML = `
|
||||
<td>${student.id}</td>
|
||||
<td>${student.name}</td>
|
||||
<td>
|
||||
<input type="number" class="grade-input usual-grade"
|
||||
data-index="${index}" min="0" max="100"
|
||||
placeholder="0-100" value="${student.usual}">
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" class="grade-input midterm-grade"
|
||||
data-index="${index}" min="0" max="100"
|
||||
placeholder="0-100" value="${student.midterm}">
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" class="grade-input final-grade"
|
||||
data-index="${index}" min="0" max="100"
|
||||
placeholder="0-100" value="${student.final}">
|
||||
</td>
|
||||
<td>
|
||||
<span class="total-grade" data-index="${index}">${student.total || ''}</span>
|
||||
</td>
|
||||
`;
|
||||
|
||||
studentsTbody.appendChild(row);
|
||||
});
|
||||
|
||||
// �曄內銵冽聢
|
||||
studentsTable.style.display = 'table';
|
||||
noStudents.style.display = 'none';
|
||||
|
||||
// �舐鍂�𣂷漱�厰僼
|
||||
submitBtn.disabled = false;
|
||||
|
||||
// 瘛餃��鞟貍颲枏�鈭衤辣�穃𨯬
|
||||
addGradeInputListeners();
|
||||
}
|
||||
|
||||
// �曄內�㰘蝸�嗆�? function showLoading() {
|
||||
studentsLoading.style.display = 'block';
|
||||
studentsTable.style.display = 'none';
|
||||
noStudents.style.display = 'none';
|
||||
}
|
||||
|
||||
// �鞱��㰘蝸�嗆�? function hideLoading() {
|
||||
studentsLoading.style.display = 'none';
|
||||
}
|
||||
|
||||
// �曄內�惩郎��㺭�? function showNoStudents() {
|
||||
hideLoading();
|
||||
studentsTable.style.display = 'none';
|
||||
noStudents.style.display = 'block';
|
||||
}
|
||||
|
||||
// �鞱�摮衣�銵冽聢
|
||||
function hideStudentsTable() {
|
||||
studentsTable.style.display = 'none';
|
||||
noStudents.style.display = 'none';
|
||||
}
|
||||
|
||||
// 瘛餃��鞟貍颲枏�鈭衤辣�穃𨯬
|
||||
function addGradeInputListeners() {
|
||||
const usualGrades = document.querySelectorAll('.usual-grade');
|
||||
const midtermGrades = document.querySelectorAll('.midterm-grade');
|
||||
const finalGrades = document.querySelectorAll('.final-grade');
|
||||
|
||||
usualGrades.forEach(input => {
|
||||
input.addEventListener('input', calculateTotalGrade);
|
||||
});
|
||||
|
||||
midtermGrades.forEach(input => {
|
||||
input.addEventListener('input', calculateTotalGrade);
|
||||
});
|
||||
|
||||
finalGrades.forEach(input => {
|
||||
input.addEventListener('input', calculateTotalGrade);
|
||||
});
|
||||
}
|
||||
|
||||
// 霈∠��餉��鞟貍
|
||||
function calculateTotalGrade(event) {
|
||||
const input = event.target;
|
||||
const index = input.getAttribute('data-index');
|
||||
|
||||
// �瑕�銝劐葵�鞟貍
|
||||
const usualInput = document.querySelector(`.usual-grade[data-index="${index}"]`);
|
||||
const midtermInput = document.querySelector(`.midterm-grade[data-index="${index}"]`);
|
||||
const finalInput = document.querySelector(`.final-grade[data-index="${index}"]`);
|
||||
const totalSpan = document.querySelector(`.total-grade[data-index="${index}"]`);
|
||||
|
||||
const usual = parseFloat(usualInput.value) || 0;
|
||||
const midterm = parseFloat(midtermInput.value) || 0;
|
||||
const final = parseFloat(finalInput.value) || 0;
|
||||
|
||||
// 霈∠��餉��鞟貍嚗���㵪�撟單𧒄20%嚗峕�銝?0%嚗峕��?0%嚗? const total = (usual * 0.2) + (midterm * 0.3) + (final * 0.5);
|
||||
|
||||
// �曄內�餉��鞟貍嚗���滢��亙��湔㺭嚗? totalSpan.textContent = Math.round(total);
|
||||
|
||||
// �寞旿�鞟貍��凒霈曄蔭憸𡏭𠧧
|
||||
if (total >= 90) {
|
||||
totalSpan.style.color = '#38a169';
|
||||
totalSpan.style.fontWeight = 'bold';
|
||||
} else if (total >= 60) {
|
||||
totalSpan.style.color = '#d69e2e';
|
||||
totalSpan.style.fontWeight = 'normal';
|
||||
} else {
|
||||
totalSpan.style.color = '#e53e3e';
|
||||
totalSpan.style.fontWeight = 'bold';
|
||||
}
|
||||
}
|
||||
|
||||
// 銵典�撉諹�
|
||||
function validateForm() {
|
||||
const className = classSelect.value;
|
||||
const courseName = courseNameInput.value.trim();
|
||||
|
||||
if (!className) {
|
||||
alert('霂琿�㗇𥋘�剔漣');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!courseName) {
|
||||
alert('霂瑁��亥紋蝔见�蝘?);
|
||||
courseNameInput.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
// 璉��交糓�行�摮衣��鞟貍�芸‵�? const usualGrades = document.querySelectorAll('.usual-grade');
|
||||
const midtermGrades = document.querySelectorAll('.midterm-grade');
|
||||
const finalGrades = document.querySelectorAll('.final-grade');
|
||||
|
||||
for (let i = 0; i < usualGrades.length; i++) {
|
||||
const usual = usualGrades[i].value.trim();
|
||||
const midterm = midtermGrades[i].value.trim();
|
||||
const final = finalGrades[i].value.trim();
|
||||
|
||||
if (!usual || !midterm || !final) {
|
||||
alert(`霂瑕‵�嗵洵${i + 1}銵�郎�毺����㗇�蝏奈);
|
||||
return false;
|
||||
}
|
||||
|
||||
const usualNum = parseFloat(usual);
|
||||
const midtermNum = parseFloat(midterm);
|
||||
const finalNum = parseFloat(final);
|
||||
|
||||
if (usualNum < 0 || usualNum > 100 ||
|
||||
midtermNum < 0 || midtermNum > 100 ||
|
||||
finalNum < 0 || finalNum > 100) {
|
||||
alert(`蝚?{i + 1}銵�郎�毺��鞟貍敹�◆�?-100銋钅𡢿`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// �園�銵典��唳旿
|
||||
function collectFormData() {
|
||||
const className = classSelect.options[classSelect.selectedIndex].text;
|
||||
const courseName = courseNameInput.value.trim();
|
||||
const examDate = examDateInput.value;
|
||||
const remarks = remarksInput.value.trim();
|
||||
|
||||
const grades = [];
|
||||
const rows = studentsTbody.querySelectorAll('tr');
|
||||
|
||||
rows.forEach((row, index) => {
|
||||
const studentId = row.cells[0].textContent;
|
||||
const studentName = row.cells[1].textContent;
|
||||
const usual = row.cells[2].querySelector('input').value;
|
||||
const midterm = row.cells[3].querySelector('input').value;
|
||||
const final = row.cells[4].querySelector('input').value;
|
||||
const total = row.cells[5].querySelector('span').textContent;
|
||||
|
||||
grades.push({
|
||||
studentId,
|
||||
studentName,
|
||||
usual: parseFloat(usual),
|
||||
midterm: parseFloat(midterm),
|
||||
final: parseFloat(final),
|
||||
total: parseFloat(total)
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
className,
|
||||
courseName,
|
||||
examDate,
|
||||
remarks,
|
||||
grades
|
||||
};
|
||||
}
|
||||
|
||||
// �𣂷漱銵典�
|
||||
function submitForm() {
|
||||
if (!validateForm()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const formData = collectFormData();
|
||||
|
||||
// �曄內�𣂷漱銝剔𠶖�? submitBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> �𣂷漱銝?..';
|
||||
submitBtn.disabled = true;
|
||||
|
||||
// 璅⊥�API靚�鍂
|
||||
setTimeout(() => {
|
||||
// 璅⊥��𣂼��滚�
|
||||
alert(`�鞟貍�𣂷漱�𣂼�嚗�n�剔漣嚗?{formData.className}\n霂曄�嚗?{formData.courseName}\n�勗��?{formData.grades.length}�滚郎���蝏奈);
|
||||
|
||||
// �滨蔭�厰僼�嗆�? submitBtn.innerHTML = '<i class="fas fa-check"></i> �𣂷漱�鞟貍';
|
||||
submitBtn.disabled = false;
|
||||
|
||||
// �滨蔭銵典�
|
||||
resetForm();
|
||||
}, 1500);
|
||||
}
|
||||
|
||||
// �滨蔭銵典�
|
||||
function resetForm() {
|
||||
classSelect.value = '';
|
||||
courseNameInput.value = '';
|
||||
examDateInput.value = today;
|
||||
remarksInput.value = '';
|
||||
|
||||
// 皜�征摮衣�銵冽聢
|
||||
studentsTbody.innerHTML = '';
|
||||
studentsTable.style.display = 'none';
|
||||
noStudents.style.display = 'none';
|
||||
|
||||
// 蝳�鍂�𣂷漱�厰僼
|
||||
submitBtn.disabled = true;
|
||||
}
|
||||
|
||||
// �𡝗��厰僼鈭衤辣
|
||||
cancelBtn.addEventListener('click', function() {
|
||||
if (confirm('蝖桀�閬��瘨��嚗���㗇𧊋靽嘥���凒�孵�隡帋腺憭晞�?)) {
|
||||
resetForm();
|
||||
}
|
||||
});
|
||||
|
||||
// �𣂷漱�厰僼鈭衤辣
|
||||
submitBtn.addEventListener('click', submitForm);
|
||||
|
||||
// 憿菟𢒰�㰘蝸�嗅�憪见�
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// 璉��交糓�行�敹����㺭�? if (!classSelect.value) {
|
||||
submitBtn.disabled = true;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,574 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>�鞟貍�亥砭/蝞∠� - 摮衣��鞟貍蝞∠�蝟餌�</title>
|
||||
<link rel="stylesheet" href="/public/css/style.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<!-- 撖潸⏛�?-->
|
||||
<nav class="navbar">
|
||||
<div class="nav-container">
|
||||
<div class="nav-brand">
|
||||
<a href="/">
|
||||
<i class="fas fa-graduation-cap"></i>
|
||||
<span>XX摮行嵗�鞟貍蝞∠�蝟餌�</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="nav-menu">
|
||||
<a href="/teacher/dashboard" class="nav-link">
|
||||
<i class="fas fa-tachometer-alt"></i>
|
||||
<span>�坔�隞芾”�?/span>
|
||||
</a>
|
||||
<a href="/teacher/grade_entry" class="nav-link">
|
||||
<i class="fas fa-edit"></i>
|
||||
<span>�鞟貍敶訫�</span>
|
||||
</a>
|
||||
<a href="/teacher/grade_management" class="nav-link active">
|
||||
<i class="fas fa-search"></i>
|
||||
<span>�鞟貍蝞∠�</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="nav-user">
|
||||
<div class="user-info">
|
||||
<i class="fas fa-user-circle"></i>
|
||||
<span>撘㰘���</span>
|
||||
</div>
|
||||
<a href="/login" class="btn-logout">
|
||||
<i class="fas fa-sign-out-alt"></i>
|
||||
<span>���?/span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- 銝餃�摰孵躹 -->
|
||||
<main class="main-content">
|
||||
<div class="container">
|
||||
<!-- �W�撅穃紡�?-->
|
||||
<div class="breadcrumb">
|
||||
<a href="/">銝駁△</a>
|
||||
<i class="fas fa-chevron-right"></i>
|
||||
<a href="/teacher/dashboard">�坔�隞芾”�?/a>
|
||||
<i class="fas fa-chevron-right"></i>
|
||||
<span>�鞟貍�亥砭/蝞∠�</span>
|
||||
</div>
|
||||
|
||||
<!-- 憿菟𢒰��� -->
|
||||
<div class="page-header">
|
||||
<h1 class="page-title">�鞟貍�亥砭/蝞∠�</h1>
|
||||
<p class="page-description">�亥砭��耨�孵��𣳇膄摮衣��鞟貍霈啣�</p>
|
||||
</div>
|
||||
|
||||
<!-- 蝑偦�匧躹�?-->
|
||||
<div class="filter-section">
|
||||
<h2 class="filter-title">
|
||||
<i class="fas fa-filter"></i>
|
||||
蝑偦�㗇辺隞? </h2>
|
||||
<div class="filter-form">
|
||||
<div class="form-group">
|
||||
<label for="class-select">�剔漣</label>
|
||||
<select id="class-select" class="form-control">
|
||||
<option value="">�券��剔漣</option>
|
||||
<option value="class1">霈∠��箇�摮虫����?�?/option>
|
||||
<option value="class2">霈∠��箇�摮虫����?�?/option>
|
||||
<option value="class3">頧臭辣撌亦�1�?/option>
|
||||
<option value="class4">頧臭辣撌亦�2�?/option>
|
||||
<option value="class5">蝵𤑳�撌亦�1�?/option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="course-select">霂曄�</label>
|
||||
<select id="course-select" class="form-control">
|
||||
<option value="">�券�霂曄�</option>
|
||||
<option value="course1">�唳旿蝏𤘪�</option>
|
||||
<option value="course2">�滢�蝟餌�</option>
|
||||
<option value="course3">霈∠��箇�蝏?/option>
|
||||
<option value="course4">�唳旿摨梶頂蝏?/option>
|
||||
<option value="course5">頧臭辣撌亦�</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="student-id">摮衣�摮血噡</label>
|
||||
<input type="text" id="student-id" class="form-control" placeholder="颲枏�摮衣�摮血噡">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="student-name">摮衣�憪枏�</label>
|
||||
<input type="text" id="student-name" class="form-control" placeholder="颲枏�摮衣�憪枏�">
|
||||
</div>
|
||||
<div class="filter-actions">
|
||||
<button id="search-btn" class="btn-search">
|
||||
<i class="fas fa-search"></i>
|
||||
�亥砭
|
||||
</button>
|
||||
<button id="reset-btn" class="btn-reset">
|
||||
<i class="fas fa-redo"></i>
|
||||
�滨蔭
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 蝏𤘪��箏� -->
|
||||
<div class="results-section">
|
||||
<div class="results-header">
|
||||
<h2 class="results-title">�亥砭蝏𤘪�</h2>
|
||||
<div class="results-actions">
|
||||
<button id="export-btn" class="btn-export">
|
||||
<i class="fas fa-file-export"></i>
|
||||
撖澆枂�鞟貍
|
||||
</button>
|
||||
<button id="batch-delete-btn" class="btn-batch-delete">
|
||||
<i class="fas fa-trash-alt"></i>
|
||||
�寥��𣳇膄
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="grade-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><input type="checkbox" id="select-all"></th>
|
||||
<th>摮血噡</th>
|
||||
<th>憪枏�</th>
|
||||
<th>�剔漣</th>
|
||||
<th>霂曄�</th>
|
||||
<th>撟單𧒄�鞟貍</th>
|
||||
<th>�煺葉�鞟貍</th>
|
||||
<th>��錰�鞟貍</th>
|
||||
<th>�餉��鞟貍</th>
|
||||
<th>蝑厩漣</th>
|
||||
<th>�滢�</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="grade-table-body">
|
||||
<!-- �唳旿撠��朞�JavaScript�冽���頧?-->
|
||||
<tr>
|
||||
<td colspan="11" class="loading">
|
||||
<i class="fas fa-spinner fa-spin"></i>
|
||||
<p>甇�銁�㰘蝸�鞟貍�唳旿...</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- ��△ -->
|
||||
<div class="pagination">
|
||||
<button id="prev-page" disabled>銝𠹺�憿?/button>
|
||||
<button class="active">1</button>
|
||||
<button>2</button>
|
||||
<button>3</button>
|
||||
<button id="next-page">銝衤�憿?/button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- 憿菔� -->
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p>© 2023 XX摮行嵗�鞟貍蝞∠�蝟餌�. ������?</p>
|
||||
<p>���舀𣈲�? 霈∠��箇�摮虫����臬郎�?/p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
// 璅⊥��鞟貍�唳旿
|
||||
const mockGrades = [
|
||||
{
|
||||
id: 1,
|
||||
studentId: "20230001",
|
||||
studentName: "撘牐�",
|
||||
className: "霈∠��箇�摮虫����?�?,
|
||||
courseName: "�唳旿蝏𤘪�",
|
||||
regularScore: 85,
|
||||
midtermScore: 88,
|
||||
finalScore: 90,
|
||||
totalScore: 88.5,
|
||||
grade: "隡条�"
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
studentId: "20230002",
|
||||
studentName: "�𤾸�",
|
||||
className: "霈∠��箇�摮虫����?�?,
|
||||
courseName: "�唳旿蝏𤘪�",
|
||||
regularScore: 78,
|
||||
midtermScore: 82,
|
||||
finalScore: 85,
|
||||
totalScore: 82.3,
|
||||
grade: "�臬末"
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
studentId: "20230003",
|
||||
studentName: "�衤�",
|
||||
className: "霈∠��箇�摮虫����?�?,
|
||||
courseName: "�滢�蝟餌�",
|
||||
regularScore: 92,
|
||||
midtermScore: 88,
|
||||
finalScore: 95,
|
||||
totalScore: 91.8,
|
||||
grade: "隡条�"
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
studentId: "20230004",
|
||||
studentName: "韏萄�",
|
||||
className: "霈∠��箇�摮虫����?�?,
|
||||
courseName: "�滢�蝟餌�",
|
||||
regularScore: 65,
|
||||
midtermScore: 70,
|
||||
finalScore: 68,
|
||||
totalScore: 67.9,
|
||||
grade: "�𦠜聢"
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
studentId: "20230005",
|
||||
studentName: "�曹�",
|
||||
className: "頧臭辣撌亦�1�?,
|
||||
courseName: "�唳旿摨梶頂蝏?,
|
||||
regularScore: 88,
|
||||
midtermScore: 85,
|
||||
finalScore: 90,
|
||||
totalScore: 87.9,
|
||||
grade: "�臬末"
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
studentId: "20230006",
|
||||
studentName: "摮坔�",
|
||||
className: "頧臭辣撌亦�1�?,
|
||||
courseName: "�唳旿摨梶頂蝏?,
|
||||
regularScore: 75,
|
||||
midtermScore: 78,
|
||||
finalScore: 80,
|
||||
totalScore: 78.1,
|
||||
grade: "銝剔�"
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
studentId: "20230007",
|
||||
studentName: "�其�",
|
||||
className: "頧臭辣撌亦�2�?,
|
||||
courseName: "頧臭辣撌亦�",
|
||||
regularScore: 90,
|
||||
midtermScore: 92,
|
||||
finalScore: 88,
|
||||
totalScore: 89.6,
|
||||
grade: "隡条�"
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
studentId: "20230008",
|
||||
studentName: "�游�",
|
||||
className: "頧臭辣撌亦�2�?,
|
||||
courseName: "頧臭辣撌亦�",
|
||||
regularScore: 82,
|
||||
midtermScore: 85,
|
||||
finalScore: 87,
|
||||
totalScore: 85.1,
|
||||
grade: "�臬末"
|
||||
}
|
||||
];
|
||||
|
||||
// DOM���
|
||||
const searchBtn = document.getElementById('search-btn');
|
||||
const resetBtn = document.getElementById('reset-btn');
|
||||
const exportBtn = document.getElementById('export-btn');
|
||||
const batchDeleteBtn = document.getElementById('batch-delete-btn');
|
||||
const selectAllCheckbox = document.getElementById('select-all');
|
||||
const gradeTableBody = document.getElementById('grade-table-body');
|
||||
const classSelect = document.getElementById('class-select');
|
||||
const courseSelect = document.getElementById('course-select');
|
||||
const studentIdInput = document.getElementById('student-id');
|
||||
const studentNameInput = document.getElementById('student-name');
|
||||
|
||||
// 敶枏��劐葉���蝏呼D
|
||||
let selectedGradeIds = new Set();
|
||||
|
||||
// �嘥��㚚△�? function initPage() {
|
||||
renderGradeTable(mockGrades);
|
||||
setupEventListeners();
|
||||
updateSelectedCount();
|
||||
}
|
||||
|
||||
// 皜脫��鞟貍銵冽聢
|
||||
function renderGradeTable(grades) {
|
||||
if (grades.length === 0) {
|
||||
gradeTableBody.innerHTML = `
|
||||
<tr>
|
||||
<td colspan="11" class="no-results">
|
||||
<i class="fas fa-search"></i>
|
||||
<h3>�芣𪄳�啁㮾�單�蝏抵扇敶?/h3>
|
||||
<p>霂瑕�霂閗��渡��㗇辺隞嗆�瘛餃��啁��鞟貍霈啣�</p>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
return;
|
||||
}
|
||||
|
||||
let tableHTML = '';
|
||||
|
||||
grades.forEach(grade => {
|
||||
// �寞旿�鞟貍蝖桀�CSS蝐? let gradeClass = 'grade-cell';
|
||||
if (grade.totalScore >= 90) {
|
||||
gradeClass += ' grade-excellent';
|
||||
} else if (grade.totalScore >= 80) {
|
||||
gradeClass += ' grade-good';
|
||||
} else if (grade.totalScore < 60) {
|
||||
gradeClass += ' grade-poor';
|
||||
}
|
||||
|
||||
// �寞旿�餉��鞟貍蝖桀�蝑厩漣
|
||||
let gradeLevel = grade.grade;
|
||||
|
||||
tableHTML += `
|
||||
<tr data-grade-id="${grade.id}">
|
||||
<td>
|
||||
<input type="checkbox" class="grade-checkbox" data-id="${grade.id}">
|
||||
</td>
|
||||
<td>${grade.studentId}</td>
|
||||
<td>${grade.studentName}</td>
|
||||
<td>${grade.className}</td>
|
||||
<td>${grade.courseName}</td>
|
||||
<td>${grade.regularScore}</td>
|
||||
<td>${grade.midtermScore}</td>
|
||||
<td>${grade.finalScore}</td>
|
||||
<td class="${gradeClass}">${grade.totalScore.toFixed(1)}</td>
|
||||
<td>${gradeLevel}</td>
|
||||
<td>
|
||||
<div class="action-buttons">
|
||||
<button class="btn-edit" onclick="editGrade(${grade.id})">
|
||||
<i class="fas fa-edit"></i> 靽格㺿
|
||||
</button>
|
||||
<button class="btn-delete" onclick="deleteGrade(${grade.id})">
|
||||
<i class="fas fa-trash"></i> �𣳇膄
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
|
||||
gradeTableBody.innerHTML = tableHTML;
|
||||
|
||||
// �齿鰵蝏穃�憭漤�㗇�鈭衤辣
|
||||
document.querySelectorAll('.grade-checkbox').forEach(checkbox => {
|
||||
checkbox.addEventListener('change', function() {
|
||||
const gradeId = parseInt(this.getAttribute('data-id'));
|
||||
if (this.checked) {
|
||||
selectedGradeIds.add(gradeId);
|
||||
} else {
|
||||
selectedGradeIds.delete(gradeId);
|
||||
selectAllCheckbox.checked = false;
|
||||
}
|
||||
updateSelectedCount();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 霈曄蔭鈭衤辣�穃𨯬�? function setupEventListeners() {
|
||||
// �亥砭�厰僼
|
||||
searchBtn.addEventListener('click', function() {
|
||||
performSearch();
|
||||
});
|
||||
|
||||
// �滨蔭�厰僼
|
||||
resetBtn.addEventListener('click', function() {
|
||||
classSelect.value = '';
|
||||
courseSelect.value = '';
|
||||
studentIdInput.value = '';
|
||||
studentNameInput.value = '';
|
||||
renderGradeTable(mockGrades);
|
||||
selectedGradeIds.clear();
|
||||
selectAllCheckbox.checked = false;
|
||||
updateSelectedCount();
|
||||
});
|
||||
|
||||
// 撖澆枂�厰僼
|
||||
exportBtn.addEventListener('click', function() {
|
||||
exportGrades();
|
||||
});
|
||||
|
||||
// �寥��𣳇膄�厰僼
|
||||
batchDeleteBtn.addEventListener('click', function() {
|
||||
if (selectedGradeIds.size === 0) {
|
||||
alert('霂瑕��㗇𥋘閬���斤��鞟貍霈啣�嚗?);
|
||||
return;
|
||||
}
|
||||
|
||||
if (confirm(`蝖桀�閬���日�劐葉�?${selectedGradeIds.size} �⊥�蝏抵扇敶訫�嚗�迨�滢�銝滚虾�日���)) {
|
||||
batchDeleteGrades();
|
||||
}
|
||||
});
|
||||
|
||||
// �券�匧��㗇�
|
||||
selectAllCheckbox.addEventListener('change', function() {
|
||||
const checkboxes = document.querySelectorAll('.grade-checkbox');
|
||||
checkboxes.forEach(checkbox => {
|
||||
checkbox.checked = this.checked;
|
||||
const gradeId = parseInt(checkbox.getAttribute('data-id'));
|
||||
if (this.checked) {
|
||||
selectedGradeIds.add(gradeId);
|
||||
} else {
|
||||
selectedGradeIds.delete(gradeId);
|
||||
}
|
||||
});
|
||||
updateSelectedCount();
|
||||
});
|
||||
|
||||
// 颲枏�獢��頧阡睸�𦦵揣
|
||||
[studentIdInput, studentNameInput].forEach(input => {
|
||||
input.addEventListener('keypress', function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
performSearch();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// �扯��𦦵揣
|
||||
function performSearch() {
|
||||
const selectedClass = classSelect.value;
|
||||
const selectedCourse = courseSelect.value;
|
||||
const studentId = studentIdInput.value.trim();
|
||||
const studentName = studentNameInput.value.trim();
|
||||
|
||||
// �曄內�㰘蝸�嗆�? gradeTableBody.innerHTML = `
|
||||
<tr>
|
||||
<td colspan="11" class="loading">
|
||||
<i class="fas fa-spinner fa-spin"></i>
|
||||
<p>甇�銁�𦦵揣�鞟貍�唳旿...</p>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
|
||||
// 璅⊥�API撱嗉�
|
||||
setTimeout(() => {
|
||||
let filteredGrades = mockGrades.filter(grade => {
|
||||
// �剔漣蝑偦�? if (selectedClass && grade.className !== selectedClass) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 霂曄�蝑偦�? if (selectedCourse && grade.courseName !== selectedCourse) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 摮血噡蝑偦�? if (studentId && !grade.studentId.includes(studentId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 憪枏�蝑偦�? if (studentName && !grade.studentName.includes(studentName)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
renderGradeTable(filteredGrades);
|
||||
selectedGradeIds.clear();
|
||||
selectAllCheckbox.checked = false;
|
||||
updateSelectedCount();
|
||||
}, 500);
|
||||
}
|
||||
|
||||
// 撖澆枂�鞟貍
|
||||
function exportGrades() {
|
||||
// 餈䠷�摨磰砲靚�鍂�𡒊垢API撖澆枂�鞟貍
|
||||
// ��𧒄雿輻鍂璅⊥�撖澆枂
|
||||
alert('�鞟貍撖澆枂�蠘�甇�銁撘��睲葉嚗���舀�Excel�龦SV�澆�撖澆枂�?);
|
||||
|
||||
// 璅⊥�撖澆枂餈��
|
||||
exportBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> 撖澆枂銝?..';
|
||||
exportBtn.disabled = true;
|
||||
|
||||
setTimeout(() => {
|
||||
exportBtn.innerHTML = '<i class="fas fa-file-export"></i> 撖澆枂�鞟貍';
|
||||
exportBtn.disabled = false;
|
||||
|
||||
// �典�����其葉嚗諹��䔶�閫血���辣銝贝蝸
|
||||
// ��𧒄�曄內�𣂼�瘨��
|
||||
showNotification('�鞟貍撖澆枂�𣂼�嚗��隞嗅歇撘�憪衤�頧賬�?, 'success');
|
||||
}, 1500);
|
||||
}
|
||||
|
||||
// �寥��𣳇膄�鞟貍
|
||||
function batchDeleteGrades() {
|
||||
// 餈䠷�摨磰砲靚�鍂�𡒊垢API�𣳇膄�鞟貍
|
||||
// ��𧒄雿輻鍂璅⊥��𣳇膄
|
||||
batchDeleteBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> �𣳇膄銝?..';
|
||||
batchDeleteBtn.disabled = true;
|
||||
|
||||
setTimeout(() => {
|
||||
// 隞擧芋��㺭�桐葉�𣳇膄�劐葉���蝏? selectedGradeIds.forEach(id => {
|
||||
const index = mockGrades.findIndex(grade => grade.id === id);
|
||||
if (index !== -1) {
|
||||
mockGrades.splice(index, 1);
|
||||
}
|
||||
});
|
||||
|
||||
// �齿鰵皜脫�銵冽聢
|
||||
renderGradeTable(mockGrades);
|
||||
selectedGradeIds.clear();
|
||||
selectAllCheckbox.checked = false;
|
||||
|
||||
batchDeleteBtn.innerHTML = '<i class="fas fa-trash-alt"></i> �寥��𣳇膄';
|
||||
batchDeleteBtn.disabled = false;
|
||||
|
||||
showNotification(`�𣂼��𣳇膄 ${selectedGradeIds.size} �⊥�蝏抵扇敶𤏪�`, 'success');
|
||||
updateSelectedCount();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
// 蝻𤥁��鞟貍
|
||||
function editGrade(gradeId) {
|
||||
// 餈䠷�摨磰砲頝唾蓮�啁�颲煾△�X��枏�蝻𤥁�璅⊥���
|
||||
// ��𧒄�曄內�鞟內
|
||||
alert(`蝻𤥁��鞟貍 ID: ${gradeId}\n�典�����其葉嚗諹��䔶��枏�蝻𤥁�銵典���);
|
||||
}
|
||||
|
||||
// �𣳇膄�蓥葵�鞟貍
|
||||
function deleteGrade(gradeId) {
|
||||
if (confirm('蝖桀�閬���方��⊥�蝏抵扇敶訫�嚗�迨�滢�銝滚虾�日��?)) {
|
||||
// 餈䠷�摨磰砲靚�鍂�𡒊垢API�𣳇膄�鞟貍
|
||||
// ��𧒄雿輻鍂璅⊥��𣳇膄
|
||||
const index = mockGrades.findIndex(grade => grade.id === gradeId);
|
||||
if (index !== -1) {
|
||||
mockGrades.splice(index, 1);
|
||||
renderGradeTable(mockGrades);
|
||||
selectedGradeIds.delete(gradeId);
|
||||
updateSelectedCount();
|
||||
showNotification('�鞟貍霈啣�撌脣��歹�', 'success');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// �湔鰵�劐葉霈⊥㺭
|
||||
function updateSelectedCount() {
|
||||
const count = selectedGradeIds.size;
|
||||
if (count > 0) {
|
||||
batchDeleteBtn.innerHTML = `<i class="fas fa-trash-alt"></i> �寥��𣳇膄 (${count})`;
|
||||
} else {
|
||||
batchDeleteBtn.innerHTML = '<i class="fas fa-trash-alt"></i> �寥��𣳇膄';
|
||||
}
|
||||
}
|
||||
|
||||
// �曄內�𡁶䰻
|
||||
function showNotification(message, type = 'info') {
|
||||
// �典�����其葉嚗諹��䔶��曄內銝�銝芰�閫���𡁶䰻蝏�辣
|
||||
// ��𧒄雿輻鍂alert
|
||||
alert(message);
|
||||
}
|
||||
|
||||
// 憿菟𢒰�㰘蝸摰峕��𤾸�憪见�
|
||||
document.addEventListener('DOMContentLoaded', initPage);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user