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

83 lines
2.6 KiB
JavaScript

/**
* 班级操行分管理系统 - 系统设置页JS
*
* 开发者: Canglan
* 版权归属: Sea Network Technology Studio
*
* 版权所有 © Sea Network Technology Studio
*/
(function() {
'use strict';
async function loadPasswordPolicy() {
const res = await apiGet('/api/admin/settings/password-policy');
if (!res || !res.success) {
showToast((res && res.message) || '获取密码策略失败', 'error');
return;
}
document.getElementById('pwdMinLength').value = res.data.min_length;
document.getElementById('pwdMaxLength').value = res.data.max_length;
document.getElementById('pwdMinTypes').value = res.data.min_types;
applyPolicyGlobals(res.data);
}
function applyPolicyGlobals(policy) {
window.PASSWORD_MIN_LENGTH = policy.min_length;
window.PASSWORD_MAX_LENGTH = policy.max_length;
window.PASSWORD_MIN_TYPES = policy.min_types;
document.querySelectorAll('.pwd-policy').forEach(function(el) {
el.textContent = describePasswordPolicy();
});
}
async function savePasswordPolicy() {
const minLength = parseInt(document.getElementById('pwdMinLength').value);
const maxLength = parseInt(document.getElementById('pwdMaxLength').value);
const minTypes = parseInt(document.getElementById('pwdMinTypes').value);
if (isNaN(minLength) || isNaN(maxLength) || isNaN(minTypes)) {
showToast('请填写完整的密码策略', 'warning');
return;
}
if (minLength < 4 || minLength > 64) {
showToast('最小长度需在4-64之间', 'warning');
return;
}
if (maxLength < 8 || maxLength > 100) {
showToast('最大长度需在8-100之间', 'warning');
return;
}
if (minLength > maxLength) {
showToast('最小长度不能大于最大长度', 'warning');
return;
}
if (minTypes < 1 || minTypes > 4) {
showToast('字符种类数需在1-4之间', 'warning');
return;
}
const res = await apiPut('/api/admin/settings/password-policy', {
min_length: minLength,
max_length: maxLength,
min_types: minTypes
});
if (res && res.success) {
applyPolicyGlobals({ min_length: minLength, max_length: maxLength, min_types: minTypes });
showToast(res.message || '密码策略已保存');
} else {
showToast((res && res.message) || '保存失败', 'error');
}
}
document.getElementById('passwordPolicyForm').addEventListener('submit', function(e) {
e.preventDefault();
savePasswordPolicy();
});
loadPasswordPolicy();
window.savePasswordPolicy = savePasswordPolicy;
})();