feat: 多班级版班级管理系统 v2.0
技术栈:Go (Gin + GORM) + PHP + MySQL 5.7 + Redis 主要功能: - 多班级完全隔离(class_id 贯穿全系统) - 后端从 Python FastAPI 重写为 Go Gin(端口 56789) - 超级管理员独立登录(env 配置路径,默认账密 admin/Admin123) - 科任老师/课代表新角色 - 课代表作业管理页面 - 排行榜分项排行(操行分/考勤/作业) - 角色加减分上下限由班主任配置 - 家长改密功能(可开关) - 班级角色按需开关 - 宿舍号格式:南0-000 - 周度/月度重置功能 - MySQL 5.7 兼容 - Nginx 反向代理部署 开发者: Canglan 版权归属: Sea Network Technology Studio 许可证: Apache License 2.0
This commit is contained in:
117
frontend/parent/history.php
Normal file
117
frontend/parent/history.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?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'] !== 'parent') {
|
||||
header('Location: /index.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
$page_title = '历史记录';
|
||||
include __DIR__ . '/../includes/header.php';
|
||||
?>
|
||||
|
||||
<div class="nav">
|
||||
<a href="/parent/dashboard.php" class="nav-item">首页</a>
|
||||
<a href="/parent/history.php" class="nav-item active">历史记录</a>
|
||||
<a href="/parent/attendance.php" class="nav-item">考勤记录</a>
|
||||
<a href="/parent/password.php" class="nav-item">修改密码</a>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="card">
|
||||
<div class="card-title">操行分历史记录</div>
|
||||
<div class="table-wrapper">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>日期</th>
|
||||
<th>原因</th>
|
||||
<th>分值</th>
|
||||
<th>记录人</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="historyList">
|
||||
<tr><td colspan="4" style="text-align:center;">加载中...</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="pagination" id="pagination" style="display:none;">
|
||||
<button class="btn btn-sm" id="prevBtn" onclick="changePage(-1)">上一页</button>
|
||||
<span id="pageInfo">1 / 1</span>
|
||||
<button class="btn btn-sm" id="nextBtn" onclick="changePage(1)">下一页</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.pagination {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 15px;
|
||||
margin-top: 15px;
|
||||
padding: 10px 0;
|
||||
}
|
||||
.pagination .btn { padding: 6px 16px; font-size: 13px; }
|
||||
.pagination span { color: #666; font-size: 14px; }
|
||||
</style>
|
||||
|
||||
<script>
|
||||
let currentPage = 1;
|
||||
const pageSize = 20;
|
||||
|
||||
async function loadHistory(page) {
|
||||
const res = await apiGet('/api/parent/child/history', { page: page, page_size: pageSize });
|
||||
if (res && res.success) {
|
||||
let html = '';
|
||||
if (res.data.records.length === 0) {
|
||||
html = '<tr><td colspan="4" style="text-align:center;">暂无记录</td></tr>';
|
||||
} else {
|
||||
res.data.records.forEach(record => {
|
||||
const pointsClass = record.points_change > 0 ? 'plus' : 'minus';
|
||||
const pointsText = record.points_change > 0 ? `+${record.points_change}` : record.points_change;
|
||||
html += `<tr>
|
||||
<td>${formatDateTime(record.created_at)}</td>
|
||||
<td class="history-reason">${escapeHtml(record.reason || '-')}</td>
|
||||
<td><span class="record-points ${pointsClass}">${pointsText}</span></td>
|
||||
<td>班主任</td>
|
||||
</tr>`;
|
||||
});
|
||||
}
|
||||
document.getElementById('historyList').innerHTML = html;
|
||||
|
||||
// 分页
|
||||
const totalPages = Math.ceil(res.data.total / pageSize);
|
||||
if (totalPages > 1) {
|
||||
document.getElementById('pagination').style.display = 'flex';
|
||||
document.getElementById('pageInfo').textContent = `${res.data.page} / ${totalPages}`;
|
||||
document.getElementById('prevBtn').disabled = res.data.page <= 1;
|
||||
document.getElementById('nextBtn').disabled = res.data.page >= totalPages;
|
||||
} else {
|
||||
document.getElementById('pagination').style.display = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function changePage(delta) {
|
||||
currentPage += delta;
|
||||
if (currentPage < 1) currentPage = 1;
|
||||
loadHistory(currentPage);
|
||||
}
|
||||
|
||||
loadHistory(1);
|
||||
</script>
|
||||
<script src="/assets/js/parent.js"></script>
|
||||
|
||||
<?php include __DIR__ . '/../includes/footer.php'; ?>
|
||||
Reference in New Issue
Block a user