v0.5测试

This commit is contained in:
2026-04-14 11:35:56 +08:00
parent 2f271b1dc4
commit bf5b2516e2
17 changed files with 646 additions and 439 deletions

View File

@@ -22,25 +22,7 @@ $role = $_SESSION['role'] ?? '';
include __DIR__ . '/../includes/header.php';
?>
<div class="nav">
<a href="/admin/dashboard.php" class="nav-item">首页</a>
<a href="/admin/students.php" class="nav-item active">学生管理</a>
<?php if ($role === '班主任' || $role === '班长'): ?>
<a href="/admin/conduct.php" class="nav-item">操行分管理</a>
<?php endif; ?>
<?php if ($role === '班主任' || $role === '科代表'): ?>
<a href="/admin/homework.php" class="nav-item">作业管理</a>
<?php endif; ?>
<?php if ($role === '班主任' || $role === '考勤委员'): ?>
<a href="/admin/attendance.php" class="nav-item">考勤管理</a>
<?php endif; ?>
<?php if ($role === '班主任'): ?>
<a href="/admin/subjects.php" class="nav-item">科目管理</a>
<a href="/admin/admins.php" class="nav-item">管理员管理</a>
<?php endif; ?>
<a href="/admin/history.php" class="nav-item">历史记录</a>
<a href="/admin/password.php" class="nav-item">修改密码</a>
</div>
<?php include __DIR__ . '/../includes/nav.php'; ?>
<div class="container">
<div class="card">
@@ -65,7 +47,7 @@ include __DIR__ . '/../includes/header.php';
<th>学号</th>
<th>姓名</th>
<th>操行分</th>
<th>家长手机号</th>
<?php if ($role === '班主任'): ?><th>家长手机号</th><?php endif; ?>
<th>操作</th>
</tr>
</thead>
@@ -129,6 +111,7 @@ include __DIR__ . '/../includes/header.php';
</div>
<script>
const userRole = '<?php echo $role; ?>';
let currentPage = 1;
let totalPages = 1;
@@ -145,7 +128,7 @@ async function loadStudents(page = 1) {
<td>${escapeHtml(student.student_no)}</td>
<td>${escapeHtml(student.name)}</td>
<td>${student.total_points}</td>
<td>${student.parent_phone || '-'}</td>
${userRole === '班主任' ? `<td>${student.parent_phone || '-'}</td>` : ''}
<td>
<button class="btn btn-sm btn-primary" onclick="showSinglePointsModal(${student.student_id}, '${escapeHtml(student.name)}')">加减分</button>
</td>
@@ -153,7 +136,7 @@ async function loadStudents(page = 1) {
});
if (res.data.students.length === 0) {
html = '<tr><td colspan="6" style="text-align:center;">暂无学生数据</td></tr>';
html = `<tr><td colspan="${userRole === '班主任' ? '6' : '5'}" style="text-align:center;">暂无学生数据</td></tr>`;
}
document.getElementById('studentList').innerHTML = html;