Files
pear-admin-flask/templates/public/base.html
T
bwstudio b208087f74 feat(nav): 新增前台公开导航页与后台导航管理
新增模块
- Nav 模型(applications/models/admin_nav.py):公开导航表,与 admin_power 解耦
- NavOutSchema / NavManageSchema(applications/schemas/admin_nav.py)
- 前台公开视图 applications/view/public/nav.py:/site/、/site/category/<name>、/site/api/navs,无需登录
- 后台管理视图 applications/view/system/nav.py:CRUD + 启用/禁用,挂入 system_bp
- 前台模板 templates/public/{base,index,category}.html(独立配色,无需登录即可访问)
- 后台模板 templates/system/nav/{main,add,edit}.html(Layui table + form)

调整
- applications/view/__init__.py:注册前台蓝图到根
- applications/view/system/__init__.py:注册后台 nav 子蓝图
- applications/common/script/admin.py:admin init/export 支持 navs 数组
- applications/common/script/app_data/init.json:新增 10 条导航种子 + 4 条 system:nav 权限

数据库
- 新增 public_nav 表(含 category 索引)
- migration: 38751d88d42c_add_public_nav_table.py
2026-09-05 14:58:08 +08:00

153 lines
5.4 KiB
HTML

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>{% block title %}{{ site_name|default('BWStudio · 导航') }}{% endblock %}</title>
<meta name="description" content="BWStudio 公开导航聚合页:精选开发工具、AI、设计资源、效率工具等优质站点。">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/layui@2.9.7/dist/css/layui.css">
<style>
:root {
--brand: #16baaa;
--bg: #f5f7fa;
--card-bg: #ffffff;
--text: #2c3e50;
--text-muted: #6c7a89;
--border: #e8eef0;
--shadow: 0 2px 12px rgba(0,0,0,0.06);
--shadow-hover: 0 8px 24px rgba(22, 186, 170, 0.18);
}
body {
margin: 0;
background: var(--bg);
color: var(--text);
font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.topbar {
background: linear-gradient(135deg, #16baaa 0%, #2e8de8 100%);
color: #fff;
padding: 56px 0 48px;
}
.topbar .container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.topbar h1 { font-size: 36px; margin: 0 0 8px; font-weight: 600; }
.topbar .sub { font-size: 15px; opacity: 0.92; }
.topbar .actions { margin-top: 18px; }
.topbar .actions a {
display: inline-block;
padding: 6px 14px;
margin-right: 8px;
background: rgba(255,255,255,0.18);
border: 1px solid rgba(255,255,255,0.35);
color: #fff;
border-radius: 999px;
font-size: 13px;
text-decoration: none;
transition: all 0.2s;
}
.topbar .actions a:hover { background: rgba(255,255,255,0.32); }
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section { margin: 32px 0; }
.section-header {
display: flex;
align-items: baseline;
justify-content: space-between;
margin-bottom: 16px;
border-left: 4px solid var(--brand);
padding-left: 12px;
}
.section-header h2 {
font-size: 20px;
margin: 0;
font-weight: 600;
}
.section-header .meta { font-size: 13px; color: var(--text-muted); }
.grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
gap: 16px;
}
.card {
background: var(--card-bg);
border: 1px solid var(--border);
border-radius: 10px;
padding: 18px;
text-decoration: none;
color: inherit;
box-shadow: var(--shadow);
transition: all 0.25s ease;
display: flex;
flex-direction: column;
gap: 6px;
}
.card:hover {
transform: translateY(-3px);
box-shadow: var(--shadow-hover);
border-color: var(--brand);
}
.card .title-row {
display: flex; align-items: center; gap: 10px;
}
.card .icon-wrap {
width: 36px; height: 36px;
background: rgba(22, 186, 170, 0.1);
color: var(--brand);
border-radius: 8px;
display: flex; align-items: center; justify-content: center;
font-size: 18px;
flex-shrink: 0;
}
.card .title {
font-size: 15px; font-weight: 600; color: var(--text);
flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card .desc {
font-size: 13px; color: var(--text-muted);
line-height: 1.5;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
min-height: 38px;
}
.card .url {
font-size: 12px; color: #b0bac3;
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.empty {
text-align: center; padding: 48px 0; color: var(--text-muted);
}
footer.site-footer {
margin-top: 48px; padding: 24px 0;
text-align: center; color: var(--text-muted); font-size: 13px;
border-top: 1px solid var(--border);
}
</style>
{% block extra_head %}{% endblock %}
</head>
<body>
<header class="topbar">
<div class="container">
<h1>{{ site_name|default('BWStudio · 导航') }}</h1>
<div class="sub">{% block subtitle %}精选优质站点,按分类聚合展示 · 共 {{ total|default(0) }} 个链接{% endblock %}</div>
<div class="actions">
<a href="{{ url_for('public_nav.index') }}">🏠 首页</a>
<a href="/admin/login">🔐 登录后台</a>
</div>
</div>
</header>
<main class="container">
{% block content %}{% endblock %}
</main>
<footer class="site-footer">
© 2026 BWStudio · 基于 <a href="https://gitea.bwhome.top/bwadmin/pear-admin-flask" style="color:var(--brand);">Pear Admin Flask</a> 构建
</footer>
{% block extra_js %}{% endblock %}
</body>
</html>