feat: 增加学生信息管理功能,优化操行分历史记录展示并更新使用文档

This commit is contained in:
2026-04-23 09:41:56 +08:00
parent 1c5da5dfaa
commit 684adbd718
15 changed files with 447 additions and 24 deletions

View File

@@ -65,6 +65,14 @@ include __DIR__ . '/../includes/header.php';
<label>已选学生</label>
<div id="selectedStudentsCount" class="selected-info">未选择学生</div>
</div>
<?php if ($role === '学习委员'): ?>
<div class="form-group">
<label>科目</label>
<select id="hwSubjectSelect">
<option value="">不选择科目</option>
</select>
</div>
<?php endif; ?>
<div class="form-group">
<label>扣分类型</label>
<div class="deduction-types">
@@ -92,6 +100,7 @@ include __DIR__ . '/../includes/header.php';
<script>
var selectedStudentIds = [];
const hwRole = '<?php echo $role; ?>';
// 初始化扣分配置
const hwMaxPoints = window.HOMEWORK_MAX_POINTS || 3;
@@ -107,6 +116,21 @@ document.querySelectorAll('.hw-max').forEach(el => el.textContent = hwMaxPoints)
document.getElementById('pointsChange').setAttribute('min', -hwMaxPoints);
document.getElementById('pointsChange').setAttribute('max', hwMaxPoints);
// 加载科目列表(学习委员)
async function loadSubjectsForHomework() {
if (hwRole !== '学习委员') return;
const subjectSelect = document.getElementById('hwSubjectSelect');
if (!subjectSelect) return;
const res = await apiGet('/api/subject/list');
if (res && res.success && res.data && res.data.subjects) {
let html = '<option value="">不选择科目</option>';
res.data.subjects.forEach(s => {
html += `<option value="${escapeHtml(s.subject_name)}">${escapeHtml(s.subject_name)}</option>`;
});
subjectSelect.innerHTML = html;
}
}
async function loadStudents() {
const res = await apiGet('/api/admin/students', {page_size: 1000});
if (res && res.success) {
@@ -169,10 +193,22 @@ function handleSubmitPoints() {
showToast(`每次加减分不超过${hwMaxPoints}分`, 'warning');
return;
}
// 学习委员附加科目前缀
if (hwRole === '学习委员') {
const subjectSelect = document.getElementById('hwSubjectSelect');
const subjectName = subjectSelect ? subjectSelect.value : '';
const reasonEl = document.getElementById('pointsReason');
if (subjectName && !reasonEl.value.startsWith('[')) {
reasonEl.value = `[${subjectName}] ${reasonEl.value}`;
}
}
submitBatchPoints();
}
loadStudents();
loadSubjectsForHomework();
</script>
<script src="/assets/js/admin.js"></script>