feat(menu): 重构菜单模块,添加路由显示、标题和参数字段

refactor(auth): 简化注册和忘记密码表单,移除手机号等冗余字段

fix(layout): 移除冗余的div包裹层,优化路由视图渲染

chore(deps): 更新后端依赖,添加click并调整typer版本

style(config): 清理注释并优化环境变量类型定义

docs(main): 修正注释拼写错误并移除无用注释

perf(menu): 更新菜单模型和类型定义,添加新字段支持

test(menu): 更新菜单初始化数据,补充新增字段值
This commit is contained in:
zhangtao
2025-06-29 22:17:06 +08:00
parent ec4338deca
commit 4150a39713
16 changed files with 1040 additions and 653 deletions
@@ -35,8 +35,11 @@ class MenuModel(ModelBase):
component_path = Column(String(200), nullable=True, comment="组件路径")
redirect = Column(String(200), nullable=True, comment="重定向地址")
hidden = Column(Boolean, default=False, nullable=False, comment="是否隐藏(True:隐藏 False:显示)")
cache = Column(Boolean, default=True, nullable=False, comment="是否缓存(True:是 False:否)")
keep_alive = Column(Boolean, default=True, nullable=False, comment="是否缓存(True:是 False:否)")
always_show = Column(Boolean, default=False, nullable=False, comment="是否始终显示(True:是 False:否)")
title = Column(String(50), nullable=True, comment="菜单标题")
parmas = Column(String(200), nullable=True, comment="路由参数")
# 层级关系
parent_id = Column(
Integer,
@@ -19,8 +19,11 @@ class MenuCreateSchema(BaseModel):
component_path: Optional[str] = Field(default=None, max_length=255, description="组件路径")
redirect: Optional[str] = Field(default=None, max_length=200, description="重定向地址")
available: bool = Field(default=True, description="是否启用(True:启用 False:禁用)")
cache: bool = Field(default=True, description="是否缓存(True:是 False:否)")
keep_alive: bool = Field(default=True, description="是否缓存(True:是 False:否)")
hidden: bool = Field(default=False, description="是否隐藏(True:是 False:否)")
always_show: bool = Field(default=False, description="是否始终显示(True:是 False:否)")
title: Optional[str] = Field(default=None, max_length=50, description="菜单标题")
parmas: Optional[str] = Field(default=None, max_length=200, description="路由参数")
parent_id: Optional[int] = Field(default=None, ge=0, description="父菜单ID")
description: Optional[str] = Field(default=None, max_length=500, description="备注说明")
@@ -247,8 +247,7 @@ class UserService:
"""用户注册"""
# 检查用户名是否存在
username_ok = await UserCRUD(auth).get_by_username_crud(username=data.username)
mobile_ok = await UserCRUD(auth).get_by_mobile_crud(mobile=data.mobile)
if username_ok or mobile_ok:
if username_ok:
raise CustomException(msg='账号已存在')
data.password = PwdUtil.set_password_hash(password=data.password)
@@ -271,8 +270,6 @@ class UserService:
raise CustomException(msg="用户不存在")
if not user.available:
raise CustomException(msg="用户已停用")
if user.mobile != data.mobile:
raise CustomException(msg="手机号不匹配")
new_password_hash = PwdUtil.set_password_hash(password=data.new_password)
new_user = await UserCRUD(auth).forget_password_crud(id=user.id, password_hash=new_password_hash)
return UserOutSchema.model_validate(new_user).model_dump()