历史记录/操作日志与作业按次登记改进
1. 历史记录:批次合并视图新增"批量反撤销"(需反撤销权限);单条/批量撤销与反撤销提示更明确(说明记录去向,不会删除);操作列权限门控补充 restore_records 2. 操作日志:批量撤销/反撤销写入日志;单条撤销/反撤销/加减分日志详情补充学生姓名(学号)、分值变动、原因;新增"详情关键词"筛选(学生姓名/原因等) 3. 节假日接口:证书校验失败自动回退重试,提高服务器兼容性 4. 作业按次登记:默认列出全部学生、缺交次数默认0(0=已交),支持全员已交登记;后端允许空缺交名单
This commit is contained in:
1 parent
dbf70f602e
commit
d0cdb5b928
13 files changed
+192
-52
No files matched your search
@@ -13,6 +13,8 @@
|
||||
const hwNotSubmit = window.DEDUCTION_HOMEWORK_NOT_SUBMIT || 2;
|
||||
const hwLate = window.DEDUCTION_HOMEWORK_LATE || 1;
|
||||
|
||||
let studentsData = [];
|
||||
|
||||
// 更新页面中的配置值显示(加减分上限来自权限组动态配置)
|
||||
document.querySelectorAll('.hw-not-submit').forEach(el => el.textContent = hwNotSubmit);
|
||||
document.querySelectorAll('.hw-late').forEach(el => el.textContent = hwLate);
|
||||
@@ -43,6 +45,7 @@ async function loadSubjectsForHomework() {
|
||||
async function loadStudents() {
|
||||
const res = await apiGet('/api/admin/students', {page_size: 1000});
|
||||
if (res && res.success) {
|
||||
studentsData = res.data.students || [];
|
||||
let html = '';
|
||||
res.data.students.forEach(student => {
|
||||
html += `<tr>
|
||||
@@ -266,9 +269,8 @@ async function submitEditSubject() {
|
||||
// ========== 作业按次登记 ==========
|
||||
|
||||
async function showHomeworkRegisterModal() {
|
||||
const checked = Array.from(document.querySelectorAll('.student-checkbox:checked'));
|
||||
if (checked.length === 0) {
|
||||
showToast('请先在学生列表中勾选缺交学生', 'warning');
|
||||
if (!studentsData || studentsData.length === 0) {
|
||||
showToast('学生列表尚未加载,请稍后重试', 'warning');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -283,16 +285,13 @@ async function showHomeworkRegisterModal() {
|
||||
}
|
||||
subjectSelect.innerHTML = options;
|
||||
|
||||
// 缺交学生列表(每人可填缺交次数)
|
||||
// 默认列出全部学生,缺交次数默认 0(0 = 已交)
|
||||
let html = '';
|
||||
checked.forEach(cb => {
|
||||
const row = cb.closest('tr');
|
||||
const no = row ? row.children[1].textContent.trim() : '';
|
||||
const name = row ? row.children[2].textContent.trim() : '';
|
||||
studentsData.forEach(student => {
|
||||
html += `<div class="hw-reg-item">
|
||||
<span class="hw-reg-name">${escapeHtml(name)} <small>${escapeHtml(no)}</small></span>
|
||||
<span class="hw-reg-name">${escapeHtml(student.name)} <small>${escapeHtml(student.student_no)}</small></span>
|
||||
<span class="hw-reg-miss-label" style="margin-left:auto;">缺交</span>
|
||||
<input type="number" class="hw-reg-miss" data-id="${cb.dataset.id}" min="1" value="1" style="width:64px;">
|
||||
<input type="number" class="hw-reg-miss" data-id="${student.student_id}" min="0" value="0" style="width:64px;">
|
||||
<span class="hw-reg-miss-label">次</span>
|
||||
</div>`;
|
||||
});
|
||||
@@ -325,19 +324,16 @@ async function submitHomeworkRegister() {
|
||||
}
|
||||
|
||||
const inputs = Array.from(document.querySelectorAll('.hw-reg-miss'));
|
||||
if (inputs.length === 0) {
|
||||
showToast('请先在学生列表中勾选缺交学生', 'warning');
|
||||
return;
|
||||
}
|
||||
|
||||
const records = [];
|
||||
for (const input of inputs) {
|
||||
const miss = parseInt(input.value);
|
||||
if (!miss || miss < 1 || miss > totalTimes) {
|
||||
showToast('缺交次数需在1~总提交次数之间', 'warning');
|
||||
const miss = parseInt(input.value) || 0;
|
||||
if (miss < 0 || miss > totalTimes) {
|
||||
showToast('缺交次数需在0~总提交次数之间', 'warning');
|
||||
return;
|
||||
}
|
||||
records.push({ student_id: parseInt(input.dataset.id), miss_count: miss });
|
||||
if (miss > 0) {
|
||||
records.push({ student_id: parseInt(input.dataset.id), miss_count: miss });
|
||||
}
|
||||
}
|
||||
|
||||
const payload = {
|
||||
|
||||
Reference in new issue
Block a user