feat: 多班级版 v2.0 - Go后端重写 + 43轮代码审查
- 后端从 Python FastAPI 重写为 Go Gin(端口 56789) - 多班级完全隔离 - 超级管理员独立登录 - 课代表作业管理、排行榜分项排行 - 角色加减分上下限可配置 - 家长改密功能(可开关) - 周度/月度重置功能 - MySQL 5.7 兼容 - 43轮代码审查+全部修复 - Apache 2.0 许可证
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* 班级操行分管理系统 - 学期管理页JS
|
||||
* 多班级版班级管理系统 - 学期管理页JS
|
||||
*
|
||||
* 开发者: Canglan
|
||||
* 版权归属: Sea Network Technology Studio
|
||||
@@ -41,7 +41,7 @@ async function loadSemesters() {
|
||||
const res = await apiGet('/api/semester/list');
|
||||
if (res && res.success) {
|
||||
let html = '';
|
||||
const semesters = res.data || [];
|
||||
const semesters = res.data.semesters || [];
|
||||
semesters.forEach(sem => {
|
||||
let statusText = '';
|
||||
let statusClass = '';
|
||||
@@ -252,7 +252,7 @@ async function viewArchiveData(semesterId, semesterName, page) {
|
||||
|
||||
if (res && res.success) {
|
||||
const data = res.data || {};
|
||||
const archives = data.archives || [];
|
||||
const archives = data.items || [];
|
||||
let html = '';
|
||||
archives.forEach(a => {
|
||||
html += `<tr>
|
||||
@@ -288,6 +288,80 @@ function renderArchivePagination(semesterId, semesterName) {
|
||||
});
|
||||
}
|
||||
|
||||
// ========== 周期重置功能 ==========
|
||||
|
||||
let pendingPeriodType = null;
|
||||
let periodArchivesType = null;
|
||||
let periodArchivesPage = 1;
|
||||
let periodArchivesTotalPages = 1;
|
||||
|
||||
function confirmPeriodReset(periodType) {
|
||||
pendingPeriodType = periodType;
|
||||
const label = periodType === 'weekly' ? '本周' : '本月';
|
||||
document.getElementById('periodResetText').innerHTML =
|
||||
`确定要执行 <strong>${label}重置</strong> 吗?<br>将保存当前所有学生的操行分快照,然后将所有学生操行分重置为初始值。`;
|
||||
document.getElementById('periodResetModal').style.display = 'flex';
|
||||
}
|
||||
|
||||
async function executePeriodReset() {
|
||||
if (!pendingPeriodType) return;
|
||||
|
||||
const res = await apiPost('/api/semester/period-reset', { period: pendingPeriodType });
|
||||
if (res && res.success) {
|
||||
showToast(res.message || '重置成功');
|
||||
closeModal('periodResetModal');
|
||||
pendingPeriodType = null;
|
||||
} else {
|
||||
showToast(res?.message || '重置失败', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
async function showPeriodArchives(type, page) {
|
||||
var periodType = type || periodArchivesType;
|
||||
page = page || 1;
|
||||
periodArchivesType = periodType;
|
||||
periodArchivesPage = page;
|
||||
|
||||
const label = periodType === 'weekly' ? '周' : '月';
|
||||
document.getElementById('periodArchivesTitle').textContent = label + '归档数据';
|
||||
|
||||
const res = await apiGet('/api/semester/period-archives', {
|
||||
period: periodType,
|
||||
page: page,
|
||||
page_size: 50
|
||||
});
|
||||
|
||||
if (res && res.success) {
|
||||
const data = res.data || {};
|
||||
const archives = data.items || [];
|
||||
let html = '';
|
||||
archives.forEach(function(a) {
|
||||
const resetByLabel = a.reset_by === 'auto' ? '自动' : '手动';
|
||||
html += '<tr>' +
|
||||
'<td>' + escapeHtml(a.period_label) + '</td>' +
|
||||
'<td>' + (a.rank_position || '-') + '</td>' +
|
||||
'<td>' + escapeHtml(a.student_no) + '</td>' +
|
||||
'<td>' + escapeHtml(a.student_name) + '</td>' +
|
||||
'<td>' + a.final_points + '</td>' +
|
||||
'<td>' + resetByLabel + '</td>' +
|
||||
'<td>' + formatDateTime(a.archived_at) + '</td>' +
|
||||
'</tr>';
|
||||
});
|
||||
if (archives.length === 0) {
|
||||
html = '<tr><td colspan="7" style="text-align:center;">暂无归档数据</td></tr>';
|
||||
}
|
||||
document.getElementById('periodArchivesList').innerHTML = html;
|
||||
|
||||
periodArchivesTotalPages = data.total_pages || 1;
|
||||
renderSmartPagination('periodArchivePagination', periodArchivesPage, periodArchivesTotalPages, function(p) {
|
||||
showPeriodArchives(periodArchivesType, p);
|
||||
});
|
||||
document.getElementById('periodArchivesModal').style.display = 'flex';
|
||||
} else {
|
||||
showToast(res?.message || '获取归档数据失败', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
loadSemesters();
|
||||
|
||||
window.fillSemesterDates = fillSemesterDates;
|
||||
@@ -302,5 +376,8 @@ window.confirmAssociate = confirmAssociate;
|
||||
window.showArchiveConfirm = showArchiveConfirm;
|
||||
window.confirmArchive = confirmArchive;
|
||||
window.viewArchiveData = viewArchiveData;
|
||||
window.confirmPeriodReset = confirmPeriodReset;
|
||||
window.executePeriodReset = executePeriodReset;
|
||||
window.showPeriodArchives = showPeriodArchives;
|
||||
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user