feat(public): 首页分类移至左侧侧栏 + 大屏自适应布局

- 分类导航由顶部横条改为左侧 sticky 侧栏(≥1025px),含快速导航/我常访问/热门/书签分类/站点页面
- 首页左右去留白:.container 与 .topbar-inner 改为 max-width:100%,布局铺满视口
- 卡片网格按屏宽自适应(minmax(var(--card-min),1fr)),1920 固定 6 列
- 移除顶部 .actions 菜单(与侧栏站点页面重复),主题切换改由侧栏按钮循环切换
- 新增 get_nav_categories() 统一锚点(侧栏/顶部/抽屉/section id 四者同源),修复空分类错位;后台分类增删改/启停后失效前台缓存
This commit is contained in:
2026-09-07 11:11:22 +08:00
parent 1a33648b9a
commit 4d6325c70e
5 changed files with 406 additions and 71 deletions
+12
View File
@@ -26,6 +26,15 @@ bp = Blueprint(
)
def _invalidate_nav_cache():
"""分类变更后立即失效前台侧栏分类缓存(延迟导入避免循环依赖)。"""
try:
from applications.view.public.nav import clear_nav_categories_cache
clear_nav_categories_cache()
except Exception: # 缓存失效失败不影响主流程
pass
@bp.get('/')
@authorize("system:nav-category:main")
def main():
@@ -118,6 +127,7 @@ def update():
cat.sort = int(req_json.get('sort') or 0)
cat.enable = int(req_json.get('enable') or 1)
db.session.commit()
_invalidate_nav_cache()
except Exception as e:
db.session.rollback()
return fail_api(msg=f'更新失败:{e}')
@@ -147,6 +157,7 @@ def enable():
res = curd.enable_status(NavCategory, cat_id)
if not res:
return fail_api(msg='操作失败')
_invalidate_nav_cache()
return success_api(msg='已启用')
@@ -160,4 +171,5 @@ def dis_enable():
res = curd.disable_status(NavCategory, cat_id)
if not res:
return fail_api(msg='操作失败')
_invalidate_nav_cache()
return success_api(msg='已禁用')