权限组全自定义、月度分独立、绑定邮箱免密与样式统一
1. 权限组:去掉锁定/预置限制,所有组可编辑/删除/分配;管理员新增/编辑可选任意组;管理员列表不再显示锁定徽标 2. 个人查询:月度分独立计算(当月净得分,与基础分无关),总分=基础分+加分-减分 3. 绑定邮箱:发送验证码与确认绑定不再需要密码(解绑仍需密码) 4. 权限组编辑UI:权限项按 学生/操行分/教务/系统管理 分区,支持全选/清空,上限两行布局,弹窗加宽 5. 样式统一:颜色变量化(硬编码色值清零)、check-grid/check-item 统一复选框网格、cell-wrap、subject-status 全局化、success-msg 6. 旧库升级期兼容保留(登录/权限降级、待升级提示) 7. 文档同步更新
This commit is contained in:
1 parent
8cd2c83412
commit
ed3189096d
25 files changed
+237
-159
No files matched your search
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* 班级操行分管理系统 - 管理端样式
|
||||
*
|
||||
* 开发者: Canglan
|
||||
@@ -263,3 +263,78 @@
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
/* ========== 权限组编辑 ========== */
|
||||
.perm-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.perm-section {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.perm-section-title {
|
||||
font-size: 12px;
|
||||
color: var(--color-text-secondary);
|
||||
border-left: 3px solid var(--color-primary);
|
||||
padding-left: 6px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.check-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 6px 12px;
|
||||
}
|
||||
.form-group .check-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-bottom: 0;
|
||||
font-weight: normal;
|
||||
font-size: 13px;
|
||||
}
|
||||
.perm-cap-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 20px;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
@media (max-width: 640px) {
|
||||
.check-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
/* ========== 状态徽标(管理员/科目通用) ========== */
|
||||
.subject-status {
|
||||
font-size: 11px;
|
||||
padding: 2px 8px;
|
||||
border-radius: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.subject-status-active {
|
||||
background: #c6f6d5;
|
||||
color: #22543d;
|
||||
}
|
||||
.subject-status-inactive {
|
||||
background: #fed7d7;
|
||||
color: #742a2a;
|
||||
}
|
||||
|
||||
/* 已选学生信息条 */
|
||||
.selected-info {
|
||||
padding: 8px 12px;
|
||||
background: var(--color-hover);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* 表格长文本单元格 */
|
||||
.cell-wrap {
|
||||
max-width: 340px;
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
}
|
||||
@@ -1001,3 +1001,24 @@ td.history-reason {
|
||||
border-color: var(--color-danger-dark);
|
||||
}
|
||||
|
||||
|
||||
/* 成功提示(登录/找回密码页) */
|
||||
.success-msg {
|
||||
background: var(--color-success-light);
|
||||
color: var(--color-success);
|
||||
padding: 10px;
|
||||
border-radius: 8px;
|
||||
margin-top: 15px;
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/* 复选框/单选框不受 .form-group input 宽度影响 */
|
||||
.form-group input[type="checkbox"],
|
||||
.form-group input[type="radio"] {
|
||||
width: auto;
|
||||
height: auto;
|
||||
padding: 0;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* 班级操行分管理系统 - 管理员管理页JS
|
||||
*
|
||||
* 开发者: Canglan
|
||||
@@ -27,6 +27,13 @@ const PERMISSION_LABELS = {
|
||||
manage_upgrade: '系统升级'
|
||||
};
|
||||
|
||||
const PERMISSION_SECTIONS = [
|
||||
{ title: '学生', keys: ['manage_students', 'export_students'] },
|
||||
{ title: '操行分', keys: ['manage_conduct', 'revoke_any', 'revoke_own', 'restore_records', 'view_all_records', 'export_data'] },
|
||||
{ title: '教务', keys: ['manage_homework', 'manage_attendance', 'manage_subjects'] },
|
||||
{ title: '系统管理', keys: ['manage_admins', 'manage_semesters', 'manage_upgrade'] }
|
||||
];
|
||||
|
||||
let currentEditUserId = null;
|
||||
let currentResetUserId = null;
|
||||
let groupsCache = [];
|
||||
@@ -58,7 +65,7 @@ async function loadGroups() {
|
||||
groupsCache = res.data.groups || [];
|
||||
|
||||
const options = groupsCache
|
||||
.filter(group => !group.is_locked)
|
||||
.filter(group => group.group_id)
|
||||
.map(group => `<option value="${group.group_id}">${escapeHtml(group.group_name)}</option>`)
|
||||
.join('');
|
||||
const placeholder = '<option value="">请选择权限组</option>';
|
||||
@@ -72,28 +79,19 @@ function renderGroupTable() {
|
||||
let html = '';
|
||||
groupsCache.forEach(group => {
|
||||
const caps = groupCapsText(group);
|
||||
const badges = [];
|
||||
if (group.is_locked) {
|
||||
badges.push('<span class="subject-status subject-status-active">锁定</span>');
|
||||
} else if (group.is_system) {
|
||||
badges.push('<span class="subject-status">预置</span>');
|
||||
}
|
||||
let actions = '<span class="text-muted">-</span>';
|
||||
if (!group.is_locked) {
|
||||
const deleteItem = group.is_system
|
||||
? ''
|
||||
: `<a class="danger" onclick="deleteGroup(${group.group_id}, '${escapeHtml(group.group_name)}')">删除</a>`;
|
||||
if (!group.readonly && group.group_id) {
|
||||
actions = `<div class="action-dropdown">
|
||||
<button class="btn btn-sm action-dropdown-toggle" onclick="toggleActionDropdown(this)">操作 ▼</button>
|
||||
<div class="action-dropdown-menu">
|
||||
<a onclick="showEditGroupModal(${group.group_id})">编辑</a>
|
||||
${deleteItem}
|
||||
<a class="danger" onclick="deleteGroup(${group.group_id}, '${escapeHtml(group.group_name)}')">删除</a>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
html += `<tr>
|
||||
<td>${escapeHtml(group.group_name)} ${badges.join(' ')}</td>
|
||||
<td style="max-width: 340px; white-space: normal;">${escapeHtml(permissionSummary(group))}</td>
|
||||
<td>${escapeHtml(group.group_name)}</td>
|
||||
<td class="cell-wrap">${escapeHtml(permissionSummary(group))}</td>
|
||||
<td>${caps.add}</td>
|
||||
<td>${caps.subtract}</td>
|
||||
<td>${group.member_count || 0}</td>
|
||||
@@ -116,7 +114,7 @@ async function loadAdmins() {
|
||||
add: admin.can_add_points ? (admin.max_add_points ? ('+' + admin.max_add_points + '以内') : '不限') : '禁止',
|
||||
subtract: admin.can_subtract_points ? (admin.max_subtract_points ? ('-' + admin.max_subtract_points + '以内') : '不限') : '禁止'
|
||||
};
|
||||
const canEdit = !admin.is_locked && admin.group_id;
|
||||
const canEdit = !!admin.group_id;
|
||||
const editItem = canEdit
|
||||
? `<a onclick="showEditAdminModal(${admin.user_id}, '${escapeHtml(admin.username)}', '${escapeHtml(admin.real_name)}', ${admin.group_id}, '${escapeHtml(admin.email || '')}')">编辑</a>`
|
||||
: '';
|
||||
@@ -124,7 +122,7 @@ async function loadAdmins() {
|
||||
<td>${escapeHtml(admin.username)}</td>
|
||||
<td>${escapeHtml(admin.real_name)}</td>
|
||||
<td>${admin.email ? escapeHtml(admin.email) : '<span class="text-muted">未绑定</span>'}</td>
|
||||
<td>${escapeHtml(admin.group_name || admin.role_type || '-')}${admin.is_locked ? ' <span class="subject-status subject-status-active">锁定</span>' : ''}</td>
|
||||
<td>${escapeHtml(admin.group_name || admin.role_type || '-')}</td>
|
||||
<td>加${caps.add} / 扣${caps.subtract}</td>
|
||||
<td><span class="subject-status ${statusClass}">${statusText}</span></td>
|
||||
<td>
|
||||
@@ -248,11 +246,21 @@ async function submitResetPassword() {
|
||||
|
||||
function renderPermissionCheckboxes(permissions) {
|
||||
const container = document.getElementById('groupPermissionList');
|
||||
container.innerHTML = Object.keys(PERMISSION_LABELS).map(key =>
|
||||
`<label style="display:flex; align-items:center; gap:6px;">
|
||||
<input type="checkbox" class="group-perm" value="${key}"${permissions[key] ? ' checked' : ''}> ${PERMISSION_LABELS[key]}
|
||||
</label>`
|
||||
).join('');
|
||||
container.innerHTML = PERMISSION_SECTIONS.map(section => {
|
||||
const items = section.keys.map(key =>
|
||||
`<label class="check-item">
|
||||
<input type="checkbox" class="group-perm" value="${key}"${permissions[key] ? ' checked' : ''}> ${PERMISSION_LABELS[key]}
|
||||
</label>`
|
||||
).join('');
|
||||
return `<div class="perm-section">
|
||||
<div class="perm-section-title">${section.title}</div>
|
||||
<div class="check-grid">${items}</div>
|
||||
</div>`;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
function selectAllPermissions(checked) {
|
||||
document.querySelectorAll('.group-perm').forEach(el => { el.checked = !!checked; });
|
||||
}
|
||||
|
||||
function onGroupCapChange() {
|
||||
@@ -281,10 +289,6 @@ function showAddGroupModal() {
|
||||
function showEditGroupModal(groupId) {
|
||||
const group = groupsCache.find(item => item.group_id === groupId);
|
||||
if (!group) return;
|
||||
if (group.is_locked) {
|
||||
showToast('该权限组已锁定,不可编辑', 'warning');
|
||||
return;
|
||||
}
|
||||
document.getElementById('groupModalTitle').textContent = '编辑权限组 - ' + group.group_name;
|
||||
document.getElementById('editGroupId').value = group.group_id;
|
||||
document.getElementById('groupName').value = group.group_name;
|
||||
@@ -372,5 +376,6 @@ window.showEditGroupModal = showEditGroupModal;
|
||||
window.submitGroupForm = submitGroupForm;
|
||||
window.deleteGroup = deleteGroup;
|
||||
window.onGroupCapChange = onGroupCapChange;
|
||||
window.selectAllPermissions = selectAllPermissions;
|
||||
|
||||
})();
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* 班级操行分管理系统 - 操行分管理页JS
|
||||
*
|
||||
* 开发者: Canglan
|
||||
@@ -191,21 +191,21 @@ async function onDormitorySelected() {
|
||||
if (res && res.success && res.data.students) {
|
||||
const students = res.data.students;
|
||||
if (students.length === 0) {
|
||||
studentsList.innerHTML = '<p style="color: var(--text-secondary);">该宿舍暂无学生</p>';
|
||||
studentsList.innerHTML = '<p style="color: var(--color-text-secondary);">该宿舍暂无学生</p>';
|
||||
studentsCount.textContent = '';
|
||||
} else {
|
||||
students.forEach(s => {
|
||||
dormitoryStudentIds.push(s.student_id);
|
||||
const div = document.createElement('div');
|
||||
div.style.cssText = 'display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--border-color);';
|
||||
div.innerHTML = `<span>${escapeHtml(s.name)}</span><span style="color: var(--text-secondary);">${escapeHtml(s.student_no)}</span>`;
|
||||
div.style.cssText = 'display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--color-border);';
|
||||
div.innerHTML = `<span>${escapeHtml(s.name)}</span><span style="color: var(--color-text-secondary);">${escapeHtml(s.student_no)}</span>`;
|
||||
studentsList.appendChild(div);
|
||||
});
|
||||
studentsCount.textContent = `共 ${students.length} 人`;
|
||||
}
|
||||
studentsGroup.style.display = 'block';
|
||||
} else {
|
||||
studentsList.innerHTML = '<p style="color: var(--text-secondary);">加载失败</p>';
|
||||
studentsList.innerHTML = '<p style="color: var(--color-text-secondary);">加载失败</p>';
|
||||
studentsGroup.style.display = 'block';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ async function loadSummary(studentId, semesterId) {
|
||||
|
||||
document.getElementById('querySummaryHint').textContent =
|
||||
'共 ' + s.record_count + ' 条有效记录(不含已撤销)。' +
|
||||
(data.semester ? '学期得分按“基础分 + 学期内加分 - 学期内减分”计算。' : '全部学期得分按“基础分 + 全部加分 - 全部减分”计算,仅供参考。');
|
||||
'月度分为当月加分与减分的净得分,与基础分无关;总分 = 基础分 + 全部加分 - 全部减分。';
|
||||
|
||||
renderMonthly(data.months);
|
||||
renderReasonSummary(data.months);
|
||||
@@ -107,15 +107,15 @@ async function loadSummary(studentId, semesterId) {
|
||||
function renderMonthly(months) {
|
||||
let html = '';
|
||||
if (!months || months.length === 0) {
|
||||
html = '<tr><td colspan="6" style="text-align:center;">暂无记录</td></tr>';
|
||||
html = '<tr><td colspan="5" style="text-align:center;">暂无记录</td></tr>';
|
||||
} else {
|
||||
months.forEach(m => {
|
||||
const monthScore = (typeof m.month_score === 'number') ? m.month_score : ((m.bonus || 0) + (m.deduction || 0));
|
||||
html += '<tr>' +
|
||||
'<td>' + escapeHtml(monthLabel(m.month)) + '</td>' +
|
||||
'<td>' + m.start_score + '</td>' +
|
||||
'<td class="plus">+' + m.bonus + '</td>' +
|
||||
'<td class="minus">' + m.deduction + '</td>' +
|
||||
'<td><strong>' + m.end_score + '</strong></td>' +
|
||||
'<td><strong>' + (monthScore > 0 ? '+' : '') + monthScore + '</strong></td>' +
|
||||
'<td>' + m.record_count + '</td>' +
|
||||
'</tr>';
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user