Files
ClassManager/frontend/admin/students.php
T
canglan 768ea281e0 v4.4 数据报表/操作日志/系统设置与月度分排行
1. 月度分排行:管理端首页支持总分/月度分切换与月份选择,新增排行榜导出CSV
2. 数据报表:新增考勤/作业统计页(日期范围、汇总与每人明细、CSV导出)
3. 操作日志:新增查看页(操作类型/操作人/日期筛选,分页)
4. 系统设置:密码策略可配置(长度/字符种类),全站改密与重置统一校验、前端提示同步;策略通过公开配置下发
5. 学期归档对比:查看归档时展示与上一学期的分数变化与名次升降
6. 历史记录导出支持按学生分表(每人一段,便于发家长)
7. 移动端适配:导航横向滚动、表格触控滚动、字号与弹窗优化
8. 版本升级至4.4(无数据库结构变更)
2026-10-09 15:00:32 +08:00

239 lines
10 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* 班级操行分管理系统 - 管理端学生管理
*
* 开发者: Canglan
* 联系方式: admin@sea-studio.top
* 版权归属: Sea Network Technology Studio
* 许可证: MIT License
*
* 版权所有 © Sea Network Technology Studio
*/
require_once __DIR__ . '/../config.php';
if (!isset($_SESSION['user_id']) || $_SESSION['user_type'] !== 'admin') {
header('Location: /index.php');
exit();
}
$page_title = '学生管理';
$role = current_group_name();
include __DIR__ . '/../includes/header.php';
?>
<?php include __DIR__ . '/../includes/nav.php'; ?>
<div class="container">
<div class="card">
<div class="action-bar">
<div class="action-buttons">
<?php if (has_perm('manage_students')): ?>
<button class="btn btn-primary" onclick="showImportModal()">导入学生</button>
<button class="btn btn-primary" onclick="showAddStudentModal()">新增学生</button>
<?php endif; ?>
<?php if (has_perm('export_students')): ?>
<button class="btn btn-secondary" onclick="showExportStudentsModal()">导出学生名单</button>
<?php endif; ?>
</div>
<div class="search-bar">
<input type="text" id="searchInput" placeholder="搜索姓名/学号">
<button class="btn btn-primary" onclick="loadStudents(1)">搜索</button>
</div>
</div>
<div class="table-wrapper">
<table class="table">
<thead>
<tr>
<th><input type="checkbox" id="selectAll" onclick="toggleSelectAll()"></th>
<th>学号</th>
<th>姓名</th>
<th>宿舍号</th>
<th>操行分</th>
<?php if (has_perm('manage_students')): ?><th>家长手机号</th><?php endif; ?>
<th>操作</th>
</tr>
</thead>
<tbody id="studentList"></tbody>
</table>
</div>
<div class="pagination" id="pagination"></div>
</div>
</div>
<!-- 导入学生模态框 -->
<div id="importModal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h3>导入学生</h3>
<button class="modal-close" onclick="closeModal('importModal')">&times;</button>
</div>
<div class="import-area" onclick="document.getElementById('importFile').click()">
<p>点击选择JSON文件</p>
<p class="import-label">或点击此处上传</p>
<input type="file" id="importFile" accept=".json">
<p style="margin-top: 10px; font-size: 12px; color: var(--color-text-muted);">
<a href="/assets/uploads/sample_import.json" download class="link">下载示例文件</a>
</p>
</div>
<div id="importPreview" class="preview-table" style="display: none;"></div>
<div class="modal-footer">
<button class="btn btn-primary" onclick="doImport()" id="importBtn" style="display: none;">确认导入</button>
</div>
</div>
</div>
<!-- 新增学生模态框 -->
<div id="addStudentModal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h3>新增学生</h3>
<button class="modal-close" onclick="closeModal('addStudentModal')">&times;</button>
</div>
<form onsubmit="event.preventDefault(); submitAddStudent()">
<div class="form-group">
<label>学号 <span style="color:red;">*</span></label>
<input type="text" id="studentNo" required placeholder="4-20位字母数字组合">
<small>学号将作为学生登录账号</small>
</div>
<div class="form-group">
<label>姓名 <span style="color:red;">*</span></label>
<input type="text" id="studentName" required>
</div>
<div class="form-group">
<label>家长手机号</label>
<input type="tel" id="parentPhone" placeholder="11位手机号">
<small>填写后将自动创建家长账号(密码同学生初始密码123456)</small>
</div>
<div class="form-group">
<label>宿舍号</label>
<input type="text" id="addDormitoryNumber" placeholder="选填">
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">确认添加</button>
<button type="button" class="btn" onclick="closeModal('addStudentModal')">取消</button>
</div>
</form>
</div>
</div>
<!-- 编辑学生模态框 -->
<div id="editStudentModal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h3>编辑学生信息</h3>
<button class="modal-close" onclick="closeModal('editStudentModal')">&times;</button>
</div>
<form onsubmit="event.preventDefault(); submitEditStudent()">
<input type="hidden" id="editStudentId">
<div class="form-group">
<label>学号</label>
<input type="text" id="editStudentNo" disabled>
</div>
<div class="form-group">
<label>姓名</label>
<input type="text" id="editStudentName" required maxlength="50">
</div>
<div class="form-group">
<label>家长手机号</label>
<input type="text" id="editStudentPhone" maxlength="20">
</div>
<div class="form-group">
<label>宿舍号</label>
<input type="text" id="editDormitoryNumber" placeholder="选填">
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">保存修改</button>
<button type="button" class="btn" onclick="closeModal('editStudentModal')">取消</button>
</div>
</form>
</div>
</div>
<!-- 重置学生密码模态框 -->
<div id="resetStudentPasswordModal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h3>重置学生密码</h3>
<button class="modal-close" onclick="closeModal('resetStudentPasswordModal')">&times;</button>
</div>
<form onsubmit="event.preventDefault(); submitResetStudentPassword()">
<input type="hidden" id="resetStudentId">
<p id="resetStudentInfo" style="margin: 10px 0;"></p>
<div class="form-group">
<label>新密码</label>
<input type="password" id="newStudentPassword" required>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-warning">确认重置</button>
<button type="button" class="btn" onclick="closeModal('resetStudentPasswordModal')">取消</button>
</div>
</form>
</div>
</div>
<script>window.PAGE_CONFIG = { role: '<?php echo htmlspecialchars($role, ENT_QUOTES, 'UTF-8'); ?>' };</script>
<script src="/assets/js/modules/modal-utils.js"></script>
<script src="/assets/js/modules/student-mgmt.js"></script>
<script src="/assets/js/modules/points-mgmt.js"></script>
<script src="/assets/js/students-manage.js"></script>
<!-- 导出学生名单模态框 -->
<div id="exportStudentsModal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h3>导出学生名单</h3>
<button class="modal-close" onclick="closeModal('exportStudentsModal')">&times;</button>
</div>
<div class="form-group">
<label>导出字段</label>
<div class="check-grid">
<label class="check-item"><input type="checkbox" class="export-student-col" value="student_no" checked disabled> 学号</label>
<label class="check-item"><input type="checkbox" class="export-student-col" value="name" checked disabled> 姓名</label>
<label class="check-item"><input type="checkbox" class="export-student-col" value="dormitory_number" checked> 宿舍号</label>
<label class="check-item"><input type="checkbox" class="export-student-col" value="total_points" checked> 当前操行分</label>
<?php if (has_perm('manage_students')): ?>
<label class="check-item"><input type="checkbox" class="export-student-col" value="parent_phone"> 家长手机号</label>
<?php endif; ?>
<label class="check-item"><input type="checkbox" class="export-student-col" value="status" checked> 状态</label>
</div>
<small>导出全班学生名单(CSV,可用Excel打开)</small>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="exportStudents()">开始导出</button>
<button type="button" class="btn" onclick="closeModal('exportStudentsModal')">取消</button>
</div>
</div>
</div>
<!-- 批量加减分模态框(共用) -->
<div id="batchPointsModal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h3>批量加减分</h3>
<button class="modal-close" onclick="closeModal('batchPointsModal')">&times;</button>
</div>
<form onsubmit="event.preventDefault(); submitBatchPoints()">
<div class="form-group">
<label>选中学生</label>
<div id="selectedStudentsCount">0 人</div>
</div>
<div class="form-group">
<label>分数变动</label>
<input type="number" id="pointsChange" required placeholder="正数为加分,负数为扣分">
<small id="pointsLimitHint"></small>
</div>
<div class="form-group">
<label>原因</label>
<textarea id="pointsReason" required rows="3" placeholder="请填写加减分原因"></textarea>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">确认提交</button>
<button type="button" class="btn" onclick="closeModal('batchPointsModal')">取消</button>
</div>
</form>
</div>
</div>
<?php include __DIR__ . '/../includes/footer.php'; ?>