- 后端从 Python FastAPI 重写为 Go Gin(端口 56789) - 多班级完全隔离 - 超级管理员独立登录 - 课代表作业管理、排行榜分项排行 - 角色加减分上下限可配置 - 家长改密功能(可开关) - 周度/月度重置功能 - MySQL 5.7 兼容 - 43轮代码审查+全部修复 - Apache 2.0 许可证
83 lines
3.0 KiB
PHP
83 lines
3.0 KiB
PHP
<?php
|
|
/**
|
|
* 多班级版班级管理系统 - 学生端考勤记录
|
|
*
|
|
* 开发者: Canglan
|
|
* 联系方式: admin@sea-studio.top
|
|
* 版权归属: Sea Network Technology Studio
|
|
* 许可证: Apache License 2.0
|
|
*
|
|
* 版权所有 © Sea Network Technology Studio
|
|
*/
|
|
|
|
require_once __DIR__ . '/../config.php';
|
|
|
|
if (!isset($_SESSION['user_id']) || $_SESSION['user_type'] !== 'student') {
|
|
header('Location: /index.php');
|
|
exit();
|
|
}
|
|
|
|
$page_title = '考勤记录';
|
|
$student_id = $_SESSION['student_id'];
|
|
include __DIR__ . '/../includes/header.php';
|
|
?>
|
|
|
|
<div class="nav">
|
|
<a href="/student/dashboard.php" class="nav-item">首页</a>
|
|
<a href="/student/conduct_history.php" class="nav-item">操行分</a>
|
|
<a href="/student/homework.php" class="nav-item">作业</a>
|
|
<a href="/student/attendance.php" class="nav-item active">考勤</a>
|
|
<a href="/student/password.php" class="nav-item">修改密码</a>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<div class="stats-grid">
|
|
<div class="stat-card"><div class="stat-label">出勤</div><div class="stat-value" id="attPresent">0</div></div>
|
|
<div class="stat-card"><div class="stat-label">缺勤</div><div class="stat-value" id="attAbsent">0</div></div>
|
|
<div class="stat-card"><div class="stat-label">迟到</div><div class="stat-value" id="attLate">0</div></div>
|
|
<div class="stat-card"><div class="stat-label">请假</div><div class="stat-value" id="attLeave">0</div></div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-title">考勤记录明细</div>
|
|
<div class="table-wrapper">
|
|
<table class="table">
|
|
<thead><tr><th>日期</th><th>状态</th><th>原因</th></tr></thead>
|
|
<tbody id="attendanceList"></tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
const STUDENT_ID = <?php echo $student_id; ?>;
|
|
|
|
async function loadAttendance() {
|
|
const res = await apiGet(`/api/student/attendance/${STUDENT_ID}`);
|
|
if (res && res.success) {
|
|
const stats = res.data.statistics;
|
|
document.getElementById('attPresent').textContent = stats.present || 0;
|
|
document.getElementById('attAbsent').textContent = stats.absent || 0;
|
|
document.getElementById('attLate').textContent = stats.late || 0;
|
|
document.getElementById('attLeave').textContent = stats.leave || 0;
|
|
|
|
let html = '';
|
|
res.data.records.forEach(record => {
|
|
html += `<tr>
|
|
<td>${record.date}</td>
|
|
<td>${getStatusBadge(record.status, 'attendance')}</td>
|
|
<td>${escapeHtml(record.reason || '-')}</td>
|
|
</tr>`;
|
|
});
|
|
if (res.data.records.length === 0) {
|
|
html = '<tr><td colspan="3" style="text-align:center;">暂无记录</td></tr>';
|
|
}
|
|
document.getElementById('attendanceList').innerHTML = html;
|
|
}
|
|
}
|
|
|
|
loadAttendance();
|
|
</script>
|
|
<script src="/assets/js/student.js"></script>
|
|
|
|
<?php include __DIR__ . '/../includes/footer.php'; ?>
|