feat: 优化移动端响应式布局与侧边栏抽屉适配

This commit is contained in:
ucmao
2026-11-08 15:36:17 +08:00
parent f668da6d3c
commit 3d1a0bddff
6 changed files with 254 additions and 62 deletions
+56
View File
@@ -518,3 +518,59 @@ input[type="number"] {
outline-offset: 2px;
border-radius: 4px;
}
/* ==========================================================================
Mobile Responsive Adaptations (Mobile Drawer, Fluid Tables & Safe Overflows)
========================================================================== */
.table-wrap {
-webkit-overflow-scrolling: touch;
}
@media (max-width: 1023px) {
.console-app .sidebar {
transform: translateX(-100%);
transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
z-index: 50;
box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.15), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
}
.console-app .sidebar.open {
transform: translateX(0);
}
.console-app .main-wrapper {
padding-left: 0 !important;
}
.main-topbar {
padding-left: 1rem;
padding-right: 1rem;
}
.topbar-breadcrumb {
max-width: calc(100vw - 160px);
}
.batch-floating-toolbar {
width: calc(100% - 32px);
max-width: 480px;
bottom: 16px;
}
}
@media (max-width: 640px) {
.table-filter-form .filter-input-text {
width: 100% !important;
}
.table-filter-form select {
flex: 1 1 auto;
}
.toast-container {
left: 1rem;
right: 1rem;
max-width: calc(100% - 2rem);
top: 1rem;
}
}
+9 -7
View File
@@ -56,14 +56,16 @@
</div>
</div>
<!-- 动态周期筛选栏 -->
<!-- 动态周期筛选栏 (支持小屏横向滚动) -->
<div class="flex items-center justify-between flex-wrap gap-3">
<div class="inline-flex rounded-xl bg-slate-200/70 p-1 border border-slate-200 text-xs font-semibold">
<a href="{{ url_for('admin.overview', days=7) }}" class="px-3 py-1.5 rounded-lg transition {{ 'bg-white text-slate-900 shadow-xs' if current_days == 7 else 'text-slate-600 hover:text-slate-900' }}">近 7 天</a>
<a href="{{ url_for('admin.overview', days=30) }}" class="px-3 py-1.5 rounded-lg transition {{ 'bg-white text-slate-900 shadow-xs' if current_days == 30 else 'text-slate-600 hover:text-slate-900' }}">近 30 天</a>
<a href="{{ url_for('admin.overview', days=90) }}" class="px-3 py-1.5 rounded-lg transition {{ 'bg-white text-slate-900 shadow-xs' if current_days == 90 else 'text-slate-600 hover:text-slate-900' }}">近 90 天</a>
<a href="{{ url_for('admin.overview', days=180) }}" class="px-3 py-1.5 rounded-lg transition {{ 'bg-white text-slate-900 shadow-xs' if current_days == 180 else 'text-slate-600 hover:text-slate-900' }}">近 180 天</a>
<a href="{{ url_for('admin.overview', days=0) }}" class="px-3 py-1.5 rounded-lg transition {{ 'bg-white text-slate-900 shadow-xs' if current_days == 0 else 'text-slate-600 hover:text-slate-900' }}">全周期</a>
<div class="overflow-x-auto max-w-full pb-1 -mb-1 custom-scroll">
<div class="inline-flex rounded-xl bg-slate-200/70 p-1 border border-slate-200 text-xs font-semibold whitespace-nowrap">
<a href="{{ url_for('admin.overview', days=7) }}" class="px-3 py-1.5 rounded-lg transition {{ 'bg-white text-slate-900 shadow-xs' if current_days == 7 else 'text-slate-600 hover:text-slate-900' }}">近 7 天</a>
<a href="{{ url_for('admin.overview', days=30) }}" class="px-3 py-1.5 rounded-lg transition {{ 'bg-white text-slate-900 shadow-xs' if current_days == 30 else 'text-slate-600 hover:text-slate-900' }}">近 30 天</a>
<a href="{{ url_for('admin.overview', days=90) }}" class="px-3 py-1.5 rounded-lg transition {{ 'bg-white text-slate-900 shadow-xs' if current_days == 90 else 'text-slate-600 hover:text-slate-900' }}">近 90 天</a>
<a href="{{ url_for('admin.overview', days=180) }}" class="px-3 py-1.5 rounded-lg transition {{ 'bg-white text-slate-900 shadow-xs' if current_days == 180 else 'text-slate-600 hover:text-slate-900' }}">近 180 天</a>
<a href="{{ url_for('admin.overview', days=0) }}" class="px-3 py-1.5 rounded-lg transition {{ 'bg-white text-slate-900 shadow-xs' if current_days == 0 else 'text-slate-600 hover:text-slate-900' }}">全周期</a>
</div>
</div>
</div>
+24 -23
View File
@@ -9,29 +9,30 @@
<p class="text-xs text-slate-500 mt-1">管理服务全局开放状态、访问体验、平台凭据与默认参数配置。(修改自动保存生效)</p>
</div>
<!-- 顶部 Tab 切换胶囊栏 -->
<div
class="flex items-center gap-1.5 p-1 bg-slate-200/60 rounded-xl max-w-fit border border-slate-200/80 select-none shadow-2xs">
<button type="button" onclick="switchSettingsTab('access')" id="tab-btn-access"
class="tab-nav-btn inline-flex items-center gap-2 px-3.5 py-2 text-xs font-semibold rounded-lg transition-all bg-white text-brand shadow-xs">
{{ icon('shield', 'w-3.5 h-3.5') }}
<span>服务与访问控制</span>
</button>
<button type="button" onclick="switchSettingsTab('cookies')" id="tab-btn-cookies"
class="tab-nav-btn inline-flex items-center gap-2 px-3.5 py-2 text-xs font-semibold rounded-lg transition-all text-slate-600 hover:text-slate-900">
{{ icon('key', 'w-3.5 h-3.5') }}
<span>平台凭据 (Cookie)</span>
</button>
<button type="button" onclick="switchSettingsTab('proxy')" id="tab-btn-proxy"
class="tab-nav-btn inline-flex items-center gap-2 px-3.5 py-2 text-xs font-semibold rounded-lg transition-all text-slate-600 hover:text-slate-900">
{{ icon('globe', 'w-3.5 h-3.5') }}
<span>网络与动态代理</span>
</button>
<button type="button" onclick="switchSettingsTab('branding')" id="tab-btn-branding"
class="tab-nav-btn inline-flex items-center gap-2 px-3.5 py-2 text-xs font-semibold rounded-lg transition-all text-slate-600 hover:text-slate-900">
{{ icon('tag', 'w-3.5 h-3.5') }}
<span>响应水印与版权</span>
</button>
<!-- 顶部 Tab 切换胶囊栏 (支持小屏横向滑动) -->
<div class="overflow-x-auto max-w-full pb-1 -mb-1 custom-scroll">
<div class="inline-flex items-center gap-1.5 p-1 bg-slate-200/60 rounded-xl border border-slate-200/80 select-none shadow-2xs whitespace-nowrap">
<button type="button" onclick="switchSettingsTab('access')" id="tab-btn-access"
class="tab-nav-btn inline-flex items-center gap-2 px-3.5 py-2 text-xs font-semibold rounded-lg transition-all bg-white text-brand shadow-xs whitespace-nowrap">
{{ icon('shield', 'w-3.5 h-3.5') }}
<span>服务与访问控制</span>
</button>
<button type="button" onclick="switchSettingsTab('cookies')" id="tab-btn-cookies"
class="tab-nav-btn inline-flex items-center gap-2 px-3.5 py-2 text-xs font-semibold rounded-lg transition-all text-slate-600 hover:text-slate-900 whitespace-nowrap">
{{ icon('key', 'w-3.5 h-3.5') }}
<span>平台凭据 (Cookie)</span>
</button>
<button type="button" onclick="switchSettingsTab('proxy')" id="tab-btn-proxy"
class="tab-nav-btn inline-flex items-center gap-2 px-3.5 py-2 text-xs font-semibold rounded-lg transition-all text-slate-600 hover:text-slate-900 whitespace-nowrap">
{{ icon('globe', 'w-3.5 h-3.5') }}
<span>网络与动态代理</span>
</button>
<button type="button" onclick="switchSettingsTab('branding')" id="tab-btn-branding"
class="tab-nav-btn inline-flex items-center gap-2 px-3.5 py-2 text-xs font-semibold rounded-lg transition-all text-slate-600 hover:text-slate-900 whitespace-nowrap">
{{ icon('tag', 'w-3.5 h-3.5') }}
<span>响应水印与版权</span>
</button>
</div>
</div>
<form method="post" action="{{ url_for('admin.update_settings') }}" id="admin-settings-form" class="space-y-6">
+96 -23
View File
@@ -43,17 +43,25 @@
{% block body %}
{% if g.user %}
<div class="console-app min-h-screen bg-slate-50">
<!-- 纯固定侧边栏 (Fixed Left Rail) -->
<aside class="sidebar fixed inset-y-0 left-0 w-64 bg-white border-r border-slate-200/80 flex flex-col justify-between select-none z-30 shadow-xs">
<!-- 移动端侧边栏遮罩 (Backdrop Overlay) -->
<div id="sidebar-backdrop" class="fixed inset-0 bg-slate-900/40 backdrop-blur-xs z-40 transition-opacity duration-300 opacity-0 pointer-events-none lg:hidden" aria-hidden="true" onclick="closeSidebar()"></div>
<!-- 侧边栏 (Fixed Left Rail on Desktop, Slide-over Drawer on Mobile) -->
<aside id="console-sidebar" class="sidebar fixed inset-y-0 left-0 w-64 bg-white border-r border-slate-200/80 flex flex-col justify-between select-none z-50 shadow-xl lg:shadow-xs -translate-x-full lg:translate-x-0 transition-transform duration-300 ease-in-out">
<!-- 顶部 Logo 栏 (固定 64px 高度与顶栏对齐) -->
<div class="sidebar-head h-16 px-5 border-b border-slate-100 flex items-center justify-between shrink-0">
<a class="brand flex items-center gap-2.5 font-bold text-slate-900 hover:text-brand transition" href="{{ url_for('web.index') }}" target="_blank">
<img src="{{ url_for('static', filename='images/logo-web.png') }}" alt="Logo" class="w-7 h-7 rounded-lg border border-slate-200 bg-white p-0.5 shadow-2xs">
<span class="text-sm font-bold tracking-tight text-slate-900">Media Parser</span>
<a class="brand flex items-center gap-2.5 font-bold text-slate-900 hover:text-brand transition min-w-0" href="{{ url_for('web.index') }}" target="_blank">
<img src="{{ url_for('static', filename='images/logo-web.png') }}" alt="Logo" class="w-7 h-7 rounded-lg border border-slate-200 bg-white p-0.5 shadow-2xs shrink-0">
<span class="text-sm font-bold tracking-tight text-slate-900 truncate">Media Parser</span>
</a>
<span class="role-badge text-xs font-semibold px-2 py-0.5 rounded-full {{ 'bg-indigo-50 text-indigo-700 border border-indigo-200' if g.user['role']=='admin' else 'bg-slate-100 text-slate-600 border border-slate-200' }}">
{{ '管理后台' if g.user['role']=='admin' else '控制台' }}
</span>
<div class="flex items-center gap-2 shrink-0">
<span class="role-badge text-xs font-semibold px-2 py-0.5 rounded-full {{ 'bg-indigo-50 text-indigo-700 border border-indigo-200' if g.user['role']=='admin' else 'bg-slate-100 text-slate-600 border border-slate-200' }}">
{{ '管理后台' if g.user['role']=='admin' else '控制台' }}
</span>
<button type="button" class="lg:hidden p-1.5 -mr-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-lg transition" onclick="closeSidebar()" aria-label="关闭侧边栏">
<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>
</button>
</div>
</div>
<!-- 独立滚动导航菜单列表 -->
@@ -137,8 +145,8 @@
</div>
</aside>
<!-- 主工作区 (Main Content Area, 左侧偏移 pl-64) -->
<div class="main-wrapper pl-64 flex flex-col flex-1 min-w-0 min-h-screen">
<!-- 主工作区 (Main Content Area, 大屏左侧偏移 pl-64, 小屏 pl-0 占满全宽) -->
<div class="main-wrapper pl-0 lg:pl-64 flex flex-col flex-1 min-w-0 min-h-screen">
<!-- 顶部浮动气泡卡片提示容器 (Toast Notification) -->
<div id="toast-container" class="toast-container fixed top-5 right-5 z-50 flex flex-col gap-2.5 max-w-sm pointer-events-none" aria-live="polite">
{% for category, message in get_flashed_messages(with_categories=true) %}
@@ -159,12 +167,19 @@
</div>
<!-- 顶部顶栏 (Topbar, 规范 64px 高度) -->
<header class="main-topbar h-16 px-8 bg-white/95 backdrop-blur-md border-b border-slate-200/80 flex items-center justify-between sticky top-0 z-20 shadow-2xs">
<div class="topbar-left flex items-center gap-2 text-sm">
<nav class="topbar-breadcrumb flex items-center gap-1.5 text-slate-500 font-medium" aria-label="Breadcrumb">
<a href="{{ url_for('admin.overview' if g.user['role']=='admin' else 'portal.overview') }}" class="hover:text-slate-900 transition">{{ '管理后台' if g.user['role']=='admin' else '控制台' }}</a>
<span class="topbar-separator text-slate-300">/</span>
<span class="text-slate-500">
<header class="main-topbar h-16 px-4 sm:px-6 lg:px-8 bg-white/95 backdrop-blur-md border-b border-slate-200/80 flex items-center justify-between sticky top-0 z-20 shadow-2xs">
<div class="topbar-left flex items-center gap-2 sm:gap-3 text-sm min-w-0">
<button type="button" class="sidebar-toggle-btn lg:hidden p-2 -ml-1 rounded-lg text-slate-500 hover:text-slate-900 hover:bg-slate-100 focus:outline-none focus:ring-2 focus:ring-brand/20 transition-colors shrink-0" onclick="openSidebar()" aria-label="打开导航菜单">
<svg class="w-5 h-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="3" y1="12" x2="21" y2="12"></line>
<line x1="3" y1="6" x2="21" y2="6"></line>
<line x1="3" y1="18" x2="21" y2="18"></line>
</svg>
</button>
<nav class="topbar-breadcrumb flex items-center gap-1.5 text-slate-500 font-medium truncate" aria-label="Breadcrumb">
<a href="{{ url_for('admin.overview' if g.user['role']=='admin' else 'portal.overview') }}" class="hover:text-slate-900 transition shrink-0 whitespace-nowrap">{{ '管理后台' if g.user['role']=='admin' else '控制台' }}</a>
<span class="topbar-separator text-slate-300 shrink-0">/</span>
<span class="text-slate-500 hidden sm:inline shrink-0 whitespace-nowrap">
{%- block nav_group -%}
{%- if g.user['role'] == 'admin' -%}
{%- if active_nav in ['overview', 'settings'] -%}系统管理
@@ -179,25 +194,25 @@
{%- endif -%}
{%- endblock -%}
</span>
<span class="topbar-separator text-slate-300">/</span>
<h1 class="page-title text-sm font-bold text-slate-900 inline" id="active-page-title">{% block page_title %}{% endblock %}</h1>
<span class="topbar-separator text-slate-300 hidden sm:inline shrink-0">/</span>
<h1 class="page-title text-sm font-bold text-slate-900 truncate" id="active-page-title">{% block page_title %}{% endblock %}</h1>
</nav>
</div>
<div class="topbar-right flex items-center gap-3">
<div class="topbar-right flex items-center gap-2 sm:gap-3 shrink-0 ml-2">
{% if is_api_enabled() %}
<span class="status-pill online inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-xs font-semibold bg-emerald-50 text-emerald-700 border border-emerald-200 shadow-2xs">
<span class="status-pill online inline-flex items-center gap-1.5 sm:gap-2 px-2.5 sm:px-3 py-1 sm:py-1.5 rounded-full text-xs font-semibold bg-emerald-50 text-emerald-700 border border-emerald-200 shadow-2xs whitespace-nowrap shrink-0">
<span class="status-dot w-2 h-2 rounded-full bg-emerald-500 animate-pulse"></span>API 正常
</span>
{% else %}
<span class="status-pill offline inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-xs font-semibold bg-amber-50 text-amber-700 border border-amber-200 shadow-2xs">
<span class="status-pill offline inline-flex items-center gap-1.5 sm:gap-2 px-2.5 sm:px-3 py-1 sm:py-1.5 rounded-full text-xs font-semibold bg-amber-50 text-amber-700 border border-amber-200 shadow-2xs whitespace-nowrap shrink-0">
<span class="status-dot w-2 h-2 rounded-full bg-amber-500"></span>API 维护中
</span>
{% endif %}
</div>
</header>
<!-- 内容区域 (内边距 p-8 舒适宽敞) -->
<div class="flex-1 p-6 sm:p-8 min-w-0">
<!-- 内容区域 (小屏 p-4, 中大屏 p-6~8 舒适宽敞) -->
<div class="flex-1 p-4 sm:p-6 lg:p-8 min-w-0">
{% block console_content %}{% endblock %}
</div>
</div>
@@ -689,11 +704,69 @@ function initDonutInteractions() {
});
}
// ==========================================
// 移动端响应式侧边栏控制器 (Mobile Drawer Sidebar)
// ==========================================
function openSidebar() {
const sidebar = document.getElementById('console-sidebar');
const backdrop = document.getElementById('sidebar-backdrop');
if (!sidebar || !backdrop) return;
sidebar.classList.remove('-translate-x-full');
sidebar.classList.add('open');
backdrop.classList.remove('opacity-0', 'pointer-events-none');
backdrop.classList.add('opacity-100', 'pointer-events-auto');
document.body.classList.add('overflow-hidden', 'lg:overflow-auto');
}
function closeSidebar() {
const sidebar = document.getElementById('console-sidebar');
const backdrop = document.getElementById('sidebar-backdrop');
if (!sidebar || !backdrop) return;
sidebar.classList.add('-translate-x-full');
sidebar.classList.remove('open');
backdrop.classList.add('opacity-0', 'pointer-events-none');
backdrop.classList.remove('opacity-100', 'pointer-events-auto');
document.body.classList.remove('overflow-hidden', 'lg:overflow-auto');
}
function toggleSidebar() {
const sidebar = document.getElementById('console-sidebar');
if (sidebar && sidebar.classList.contains('-translate-x-full')) {
openSidebar();
} else {
closeSidebar();
}
}
window.addEventListener('DOMContentLoaded', () => {
initChartInteractions();
initDonutInteractions();
initToasts();
initConfirmInterceptions();
// 移动端点击导航项自动关闭抽屉
document.querySelectorAll('#console-sidebar .nav-item').forEach(link => {
link.addEventListener('click', () => {
if (window.innerWidth < 1024) {
closeSidebar();
}
});
});
// 监听 ESC 键关闭侧边栏
document.addEventListener('keydown', (e) => {
if (e.key === 'Escape') {
closeSidebar();
}
});
// 窗口尺寸拉伸超过断点时自动恢复
window.addEventListener('resize', () => {
if (window.innerWidth >= 1024) {
closeSidebar();
}
});
const cpm = document.getElementById('change-password-modal-backdrop');
if (cpm) {
cpm.addEventListener('click', (e) => {
+60 -2
View File
@@ -33,7 +33,10 @@
<div class="fixed inset-0 grid-bg pointer-events-none"></div><div class="fixed -top-40 right-0 w-[620px] h-[620px] glow pointer-events-none"></div>
<header class="sticky top-0 z-50 border-b border-slate-200/80 bg-white/90 backdrop-blur-xl">
<div class="max-w-7xl mx-auto min-h-16 px-5 sm:px-8 py-3 flex items-center justify-between gap-4">
<a href="#top" class="flex items-center gap-3 shrink-0" aria-label="Media Parser 首页"><img src="{{ url_for('static', filename='images/logo-web.png') }}" alt="" class="w-9 h-9 rounded-xl border border-slate-200 bg-white p-1"><span class="hidden sm:inline font-bold tracking-tight text-slate-950">Media Parser <span class="text-brand">API</span></span></a>
<a href="#top" class="flex items-center gap-2.5 sm:gap-3 shrink-0" aria-label="Media Parser 首页">
<img src="{{ url_for('static', filename='images/logo-web.png') }}" alt="" class="w-9 h-9 rounded-xl border border-slate-200 bg-white p-1">
<span class="font-bold tracking-tight text-slate-950 text-sm sm:text-base">Media Parser <span class="text-brand">API</span></span>
</a>
<nav class="hidden lg:flex items-center gap-8 text-sm text-slate-600"><a href="#parser" class="hover:text-brand">在线解析</a><a href="#capabilities" class="hover:text-brand">平台能力</a><a href="#deployment" class="hover:text-brand">部署方式</a><a href="#docs" class="hover:text-brand">接入示例</a><a href="#faq" class="hover:text-brand">常见问题</a></nav>
<div class="flex items-center gap-2 sm:gap-3">
<a href="https://github.com/ucmao/media-parser" target="_blank" rel="noopener noreferrer" aria-label="在 GitHub 查看 Media Parser 源码" title="GitHub 开源仓库" class="inline-flex h-9 items-center gap-2 rounded-full border border-slate-200 bg-white px-3 text-xs font-semibold text-slate-700 hover:border-slate-300 hover:bg-slate-50 transition shadow-sm">
@@ -46,7 +49,31 @@
</span>
</span>
</a>
<a href="{{ url_for('auth.login') }}" class="hidden sm:inline text-sm font-medium text-slate-600 hover:text-brand">登录</a><a href="{{ url_for('auth.register') }}" class="rounded-lg bg-brand px-3 sm:px-4 py-2.5 text-sm font-bold text-white hover:bg-indigo-700 transition"><span class="sm:hidden">注册</span><span class="hidden sm:inline">创建账号</span></a>
<a href="{{ url_for('auth.login') }}" class="hidden sm:inline text-sm font-medium text-slate-600 hover:text-brand">登录</a>
<a href="{{ url_for('auth.register') }}" class="rounded-lg bg-brand px-3 sm:px-4 py-2 text-xs sm:text-sm font-bold text-white hover:bg-indigo-700 transition"><span class="sm:hidden">注册</span><span class="hidden sm:inline">创建账号</span></a>
<!-- 移动端导航菜单开关按钮 -->
<button type="button" id="landingMobileMenuBtn" onclick="toggleLandingMobileMenu()" class="lg:hidden p-2 -mr-1 rounded-lg text-slate-600 hover:text-slate-900 hover:bg-slate-100 transition" aria-label="切换导航菜单">
<svg id="menuIconOpen" class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
</svg>
<svg id="menuIconClose" class="w-5 h-5 hidden" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
</div>
<!-- 移动端展开导航菜单 (Mobile Dropdown Menu) -->
<div id="landingMobileMenu" class="hidden lg:hidden border-t border-slate-100 bg-white/95 backdrop-blur-xl px-5 py-4 space-y-3 shadow-lg">
<nav class="flex flex-col space-y-1 text-sm font-medium text-slate-700">
<a href="#parser" onclick="closeLandingMobileMenu()" class="px-3 py-2 rounded-lg hover:bg-slate-50 hover:text-brand transition">在线解析</a>
<a href="#capabilities" onclick="closeLandingMobileMenu()" class="px-3 py-2 rounded-lg hover:bg-slate-50 hover:text-brand transition">平台能力</a>
<a href="#deployment" onclick="closeLandingMobileMenu()" class="px-3 py-2 rounded-lg hover:bg-slate-50 hover:text-brand transition">部署方式</a>
<a href="#docs" onclick="closeLandingMobileMenu()" class="px-3 py-2 rounded-lg hover:bg-slate-50 hover:text-brand transition">接入示例</a>
<a href="#faq" onclick="closeLandingMobileMenu()" class="px-3 py-2 rounded-lg hover:bg-slate-50 hover:text-brand transition">常见问题</a>
</nav>
<div class="pt-3 border-t border-slate-100 flex items-center gap-2.5">
<a href="{{ url_for('auth.login') }}" class="flex-1 text-center py-2 text-xs font-semibold text-slate-700 hover:text-brand bg-slate-50 hover:bg-slate-100 rounded-lg transition border border-slate-200">登录控制台</a>
<a href="{{ url_for('auth.register') }}" class="flex-1 text-center py-2 text-xs font-semibold text-white bg-brand hover:bg-indigo-700 rounded-lg transition shadow-xs">注册新账号</a>
</div>
</div>
</header>
@@ -1215,6 +1242,37 @@
<script src="{{ url_for('static', filename='vendor/split-type.min.js') }}" defer></script>
<script src="{{ url_for('static', filename='vendor/lenis.min.js') }}" defer></script>
<script>
/* ---- 移动端导航菜单控制 ---- */
function toggleLandingMobileMenu() {
const menu = document.getElementById('landingMobileMenu');
const iconOpen = document.getElementById('menuIconOpen');
const iconClose = document.getElementById('menuIconClose');
if (!menu) return;
const isHidden = menu.classList.contains('hidden');
if (isHidden) {
menu.classList.remove('hidden');
if (iconOpen) iconOpen.classList.add('hidden');
if (iconClose) iconClose.classList.remove('hidden');
} else {
menu.classList.add('hidden');
if (iconOpen) iconOpen.classList.remove('hidden');
if (iconClose) iconClose.classList.add('hidden');
}
}
function closeLandingMobileMenu() {
const menu = document.getElementById('landingMobileMenu');
const iconOpen = document.getElementById('menuIconOpen');
const iconClose = document.getElementById('menuIconClose');
if (menu) menu.classList.add('hidden');
if (iconOpen) iconOpen.classList.remove('hidden');
if (iconClose) iconClose.classList.add('hidden');
}
window.addEventListener('resize', () => {
if (window.innerWidth >= 1024) {
closeLandingMobileMenu();
}
});
/* ---- 入场系统:IntersectionObserver + CSS 过渡,零 CDN 依赖 ---- */
(function () {
if (!document.documentElement.classList.contains('land-anim')) return;
+9 -7
View File
@@ -76,14 +76,16 @@
</div>
</div>
<!-- 动态周期筛选栏 -->
<!-- 动态周期筛选栏 (支持小屏横向滚动) -->
<div class="flex items-center justify-between flex-wrap gap-3">
<div class="inline-flex rounded-xl bg-slate-200/70 p-1 border border-slate-200 text-xs font-semibold">
<a href="{{ url_for('portal.overview', days=7) }}" class="px-3 py-1.5 rounded-lg transition {{ 'bg-white text-slate-900 shadow-xs' if current_days == 7 else 'text-slate-600 hover:text-slate-900' }}">近 7 天</a>
<a href="{{ url_for('portal.overview', days=30) }}" class="px-3 py-1.5 rounded-lg transition {{ 'bg-white text-slate-900 shadow-xs' if current_days == 30 else 'text-slate-600 hover:text-slate-900' }}">近 30 天</a>
<a href="{{ url_for('portal.overview', days=90) }}" class="px-3 py-1.5 rounded-lg transition {{ 'bg-white text-slate-900 shadow-xs' if current_days == 90 else 'text-slate-600 hover:text-slate-900' }}">近 90 天</a>
<a href="{{ url_for('portal.overview', days=180) }}" class="px-3 py-1.5 rounded-lg transition {{ 'bg-white text-slate-900 shadow-xs' if current_days == 180 else 'text-slate-600 hover:text-slate-900' }}">近 180 天</a>
<a href="{{ url_for('portal.overview', days=0) }}" class="px-3 py-1.5 rounded-lg transition {{ 'bg-white text-slate-900 shadow-xs' if current_days == 0 else 'text-slate-600 hover:text-slate-900' }}">全周期</a>
<div class="overflow-x-auto max-w-full pb-1 -mb-1 custom-scroll">
<div class="inline-flex rounded-xl bg-slate-200/70 p-1 border border-slate-200 text-xs font-semibold whitespace-nowrap">
<a href="{{ url_for('portal.overview', days=7) }}" class="px-3 py-1.5 rounded-lg transition {{ 'bg-white text-slate-900 shadow-xs' if current_days == 7 else 'text-slate-600 hover:text-slate-900' }}">近 7 天</a>
<a href="{{ url_for('portal.overview', days=30) }}" class="px-3 py-1.5 rounded-lg transition {{ 'bg-white text-slate-900 shadow-xs' if current_days == 30 else 'text-slate-600 hover:text-slate-900' }}">近 30 天</a>
<a href="{{ url_for('portal.overview', days=90) }}" class="px-3 py-1.5 rounded-lg transition {{ 'bg-white text-slate-900 shadow-xs' if current_days == 90 else 'text-slate-600 hover:text-slate-900' }}">近 90 天</a>
<a href="{{ url_for('portal.overview', days=180) }}" class="px-3 py-1.5 rounded-lg transition {{ 'bg-white text-slate-900 shadow-xs' if current_days == 180 else 'text-slate-600 hover:text-slate-900' }}">近 180 天</a>
<a href="{{ url_for('portal.overview', days=0) }}" class="px-3 py-1.5 rounded-lg transition {{ 'bg-white text-slate-900 shadow-xs' if current_days == 0 else 'text-slate-600 hover:text-slate-900' }}">全周期</a>
</div>
</div>
</div>