权限组全自定义、月度分独立、绑定邮箱免密与样式统一
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
@@ -307,8 +307,7 @@ class AdminService:
|
||||
password: Optional[str],
|
||||
group_id: int,
|
||||
operator_id: int,
|
||||
email: Optional[str] = None,
|
||||
allow_locked: bool = False
|
||||
email: Optional[str] = None
|
||||
) -> Dict[str, Any]:
|
||||
"""添加管理员(支持重新激活已删除的管理员)"""
|
||||
try:
|
||||
@@ -318,8 +317,6 @@ class AdminService:
|
||||
return {"success": False, "message": "数据库待升级,请先完成系统升级"}
|
||||
if not group:
|
||||
return {"success": False, "message": "权限组不存在"}
|
||||
if group.get("is_locked") and not allow_locked:
|
||||
return {"success": False, "message": "该权限组不可分配"}
|
||||
role_type = group["group_name"]
|
||||
|
||||
# 邮箱校验(留空表示不绑定)
|
||||
@@ -413,8 +410,6 @@ class AdminService:
|
||||
return {"success": False, "message": "数据库待升级,请先完成系统升级"}
|
||||
if not group:
|
||||
return {"success": False, "message": "权限组不存在"}
|
||||
if group.get("is_locked"):
|
||||
return {"success": False, "message": "该权限组不可分配"}
|
||||
|
||||
# 邮箱校验(留空表示解除绑定)
|
||||
normalized_email = None
|
||||
@@ -504,8 +499,6 @@ class AdminService:
|
||||
return {"success": False, "message": "数据库待升级,请先完成系统升级"}
|
||||
if not group:
|
||||
return {"success": False, "message": "权限组不存在"}
|
||||
if group.get("is_locked"):
|
||||
return {"success": False, "message": "该权限组已锁定,不可编辑"}
|
||||
|
||||
normalized = _normalize_group_payload(
|
||||
group_name, description, permissions,
|
||||
@@ -555,8 +548,6 @@ class AdminService:
|
||||
return {"success": False, "message": "数据库待升级,请先完成系统升级"}
|
||||
if not group:
|
||||
return {"success": False, "message": "权限组不存在"}
|
||||
if group.get("is_system") or group.get("is_locked"):
|
||||
return {"success": False, "message": "系统预置权限组不可删除"}
|
||||
|
||||
try:
|
||||
member_count = await PermissionGroupModel.count_members(group_id)
|
||||
|
||||
@@ -344,14 +344,14 @@ class AuthService:
|
||||
return user, None
|
||||
|
||||
@staticmethod
|
||||
async def send_bind_email_code(user_id: int, password: str, email: str) -> Dict[str, Any]:
|
||||
"""向待绑定邮箱发送验证码(验证码绑定邮箱第一步)"""
|
||||
async def send_bind_email_code(user_id: int, email: str) -> Dict[str, Any]:
|
||||
"""向待绑定邮箱发送验证码(验证码绑定邮箱第一步,无需密码)"""
|
||||
if not EmailSender.is_configured():
|
||||
return {"success": False, "message": "系统未配置邮件服务,请联系班主任或系统管理员"}
|
||||
|
||||
_, error = await AuthService._get_admin_by_password(user_id, password)
|
||||
if error:
|
||||
return {"success": False, "message": error}
|
||||
user = await UserModel.get_by_user_id(user_id)
|
||||
if not user or user.get("user_type") != "admin":
|
||||
return {"success": False, "message": "仅管理员可绑定邮箱"}
|
||||
|
||||
normalized_email = (email or "").strip()
|
||||
if not is_valid_email(normalized_email):
|
||||
|
||||
@@ -451,13 +451,11 @@ class ConductService:
|
||||
record_count += cnt
|
||||
|
||||
months = []
|
||||
running_score = base_points
|
||||
for month in sorted(months_map.keys()):
|
||||
entry = months_map[month]
|
||||
entry["start_score"] = running_score
|
||||
entry["net"] = entry["bonus"] + entry["deduction"]
|
||||
running_score += entry["net"]
|
||||
entry["end_score"] = running_score
|
||||
# 月度分独立计算,与基础分无关;总分才使用基础分
|
||||
entry["month_score"] = entry["bonus"] + entry["deduction"]
|
||||
entry["net"] = entry["month_score"]
|
||||
months.append(entry)
|
||||
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user