权限组全自定义、月度分独立、绑定邮箱免密与样式统一

1. 权限组:去掉锁定/预置限制,所有组可编辑/删除/分配;管理员新增/编辑可选任意组;管理员列表不再显示锁定徽标
2. 个人查询:月度分独立计算(当月净得分,与基础分无关),总分=基础分+加分-减分
3. 绑定邮箱:发送验证码与确认绑定不再需要密码(解绑仍需密码)
4. 权限组编辑UI:权限项按 学生/操行分/教务/系统管理 分区,支持全选/清空,上限两行布局,弹窗加宽
5. 样式统一:颜色变量化(硬编码色值清零)、check-grid/check-item 统一复选框网格、cell-wrap、subject-status 全局化、success-msg
6. 旧库升级期兼容保留(登录/权限降级、待升级提示)
7. 文档同步更新
This commit is contained in:
canglan committed 2026-09-18 09:56:39 +08:00
1 parent 8cd2c83412
commit ed3189096d
25 files changed
+237 -159

No files matched your search

+8 -16
View File
@@ -73,8 +73,8 @@ def build_legacy_group(role_type: Optional[str]) -> Optional[Dict[str, Any]]:
"max_add_points": max_add,
"can_subtract_points": can_subtract,
"max_subtract_points": max_subtract,
"is_system": 1 if role_type in DEFAULT_GROUP_PERMISSIONS else 0,
"is_locked": 1 if role_type == "班主任" else 0,
"is_system": 0,
"is_locked": 0,
}
@@ -114,17 +114,9 @@ class PermissionGroupModel:
except (ValueError, TypeError):
logger.warning(f"权限组[{row.get('group_id')}]权限配置解析失败")
parsed = {}
if row.get("is_locked"):
# 锁定组(班主任)始终为最高权限:全权限 + 无限制上限,防止误配置锁死
row["permissions_data"] = {key: True for key in PERMISSION_KEYS}
row["can_add_points"] = True
row["max_add_points"] = None
row["can_subtract_points"] = True
row["max_subtract_points"] = None
else:
row["permissions_data"] = {key: bool(parsed.get(key, False)) for key in PERMISSION_KEYS}
row["can_add_points"] = bool(row.get("can_add_points"))
row["can_subtract_points"] = bool(row.get("can_subtract_points"))
row["permissions_data"] = {key: bool(parsed.get(key, False)) for key in PERMISSION_KEYS}
row["can_add_points"] = bool(row.get("can_add_points"))
row["can_subtract_points"] = bool(row.get("can_subtract_points"))
return row
@staticmethod
@@ -156,7 +148,7 @@ class PermissionGroupModel:
fallback_groups = []
for group_name in DEFAULT_GROUP_PERMISSIONS:
group = build_legacy_group(group_name)
group["is_locked"] = 1 # 待升级期间只读,避免误操作
group["readonly"] = True # 待升级期间只读,避免误操作
group["member_count"] = 0
fallback_groups.append(group)
return fallback_groups
@@ -199,7 +191,7 @@ class PermissionGroupModel:
SET group_name = %s, description = %s, permissions = %s,
can_add_points = %s, max_add_points = %s,
can_subtract_points = %s, max_subtract_points = %s
WHERE group_id = %s AND is_locked = 0
WHERE group_id = %s
"""
result = await execute_update(sql, (
group_name, description or None, json.dumps(permissions, ensure_ascii=False),
@@ -212,7 +204,7 @@ class PermissionGroupModel:
@staticmethod
async def delete(group_id: int) -> bool:
result = await execute_update(
"DELETE FROM permission_groups WHERE group_id = %s AND is_system = 0 AND is_locked = 0",
"DELETE FROM permission_groups WHERE group_id = %s",
(group_id,)
)
return result > 0