187 lines
8.0 KiB
HTML
187 lines
8.0 KiB
HTML
<!doctype html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>{{ title or '数据处理平台' }}</title>
|
|
|
|
<!-- DNS Prefetch -->
|
|
<link rel="dns-prefetch" href="//cdn.jsdelivr.net">
|
|
<link rel="dns-prefetch" href="//cdnjs.cloudflare.com">
|
|
|
|
<!-- Critical CSS Inline -->
|
|
<style>
|
|
:root {
|
|
--primary-color: #4f46e5;
|
|
--bg-color: #f8fafc;
|
|
--text-main: #1e293b;
|
|
}
|
|
[data-bs-theme="dark"] {
|
|
--bg-color: #0f172a;
|
|
--text-main: #f1f5f9;
|
|
}
|
|
body {
|
|
background-color: var(--bg-color);
|
|
color: var(--text-main);
|
|
font-family: system-ui, -apple-system, sans-serif;
|
|
margin: 0;
|
|
}
|
|
#loadingOverlay {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: rgba(255, 255, 255, 0.8);
|
|
display: none;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
z-index: 9999;
|
|
}
|
|
</style>
|
|
|
|
<!-- Bootstrap CSS -->
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
|
|
<!-- Font Awesome Icons -->
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" media="print" onload="this.media='all'">
|
|
<noscript><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css"></noscript>
|
|
|
|
<!-- Custom CSS -->
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
|
|
|
<!-- Theme Initialization Script -->
|
|
<script>
|
|
(function() {
|
|
const theme = localStorage.getItem('theme') || 'light';
|
|
document.documentElement.setAttribute('data-bs-theme', theme);
|
|
})();
|
|
</script>
|
|
</head>
|
|
<body>
|
|
|
|
{# --- 导航栏块 --- #}
|
|
{% block navbar %}
|
|
<nav class="navbar navbar-expand-lg navbar-light bg-white sticky-top">
|
|
<div class="container">
|
|
<a class="navbar-brand" href="{{ url_for('main.index') }}">
|
|
<i class="fa-solid fa-chart-line me-2"></i>数据平台
|
|
</a>
|
|
<button class="navbar-toggler border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="navbarNav">
|
|
<div class="d-flex align-items-center ms-auto">
|
|
|
|
<!-- 主题切换按钮 -->
|
|
<button class="btn btn-link nav-link px-2 me-2" id="themeToggle" title="切换主题">
|
|
<i class="fa-solid fa-moon"></i>
|
|
</button>
|
|
|
|
<!-- 搜索表单 -->
|
|
{% if current_user.is_authenticated %}
|
|
<form method="POST" action="{{ url_for('main.search') }}" class="d-flex me-3 position-relative" id="searchForm" data-suggestions-url="{{ url_for('main.search_suggestions') }}">
|
|
{{ search_form.hidden_tag() }}
|
|
<div class="input-group input-group-sm">
|
|
{{ search_form.q(class="form-control border-end-0 bg-light", placeholder="搜索...", id="searchInput", autocomplete="off") }}
|
|
<button class="btn btn-outline-secondary border-start-0 bg-light" type="submit">
|
|
<i class="fa-solid fa-search text-muted"></i>
|
|
</button>
|
|
</div>
|
|
<!-- 搜索建议下拉框 -->
|
|
<div id="searchSuggestions" class="position-absolute w-100 bg-white shadow-lg rounded-bottom start-0" style="top: 100%; z-index: 1050; display: none; border: 1px solid rgba(0,0,0,.15); border-top: none;">
|
|
<!-- 建议内容将通过JS动态插入 -->
|
|
</div>
|
|
</form>
|
|
{% endif %}
|
|
|
|
<!-- 用户菜单 -->
|
|
<ul class="navbar-nav align-items-center">
|
|
{% if current_user.is_anonymous %}
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="{{ url_for('auth.login') }}">登录</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="btn btn-primary btn-sm ms-2 text-white" href="{{ url_for('auth.register') }}">注册</a>
|
|
</li>
|
|
{% else %}
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="{{ url_for('main.dashboard') }}">仪表盘</a>
|
|
</li>
|
|
{% if current_user.is_admin() %}
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="{{ url_for('admin.dashboard') }}"><i class="fa-solid fa-gauge-high me-1"></i>管理面板</a>
|
|
</li>
|
|
{% elif current_user.is_researcher() %}
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="{{ url_for('admin.integration_manager') }}"><i class="fa-solid fa-flask-vial me-1"></i>研究管理</a>
|
|
</li>
|
|
{% endif %}
|
|
<li class="nav-item dropdown ms-2">
|
|
<a class="nav-link dropdown-toggle d-flex align-items-center" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
|
<div class="rounded-circle bg-primary text-white d-flex justify-content-center align-items-center me-2" style="width: 32px; height: 32px;">
|
|
{{ current_user.username[0] | upper }}
|
|
</div>
|
|
{{ current_user.username }}
|
|
</a>
|
|
<ul class="dropdown-menu dropdown-menu-end shadow-sm border-0">
|
|
<li><a class="dropdown-item" href="{{ url_for('auth.logout') }}"><i class="fa-solid fa-right-from-bracket me-2 text-muted"></i> 登出</a></li>
|
|
</ul>
|
|
</li>
|
|
{% endif %}
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
{% endblock %}
|
|
|
|
{# --- 主内容块 --- #}
|
|
<main class="container mt-4">
|
|
{# Flash 消息 #}
|
|
{% with messages = get_flashed_messages(with_categories=true) %}
|
|
{% if messages %}
|
|
{% for category, message in messages %}
|
|
<div class="alert alert-{{ 'success' if category == 'message' else category }} alert-dismissible fade show shadow-sm border-0" role="alert">
|
|
<i class="fa-solid {{ 'fa-circle-check' if category == 'success' or category == 'message' else 'fa-circle-exclamation' }} me-2"></i>
|
|
{{ message }}
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
</div>
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endwith %}
|
|
|
|
{# 子模板将在这里填充内容 #}
|
|
{% block content %}
|
|
{% endblock %}
|
|
</main>
|
|
|
|
{# --- 页脚块 --- #}
|
|
<footer class="container text-center mt-5 mb-3 text-muted">
|
|
<hr>
|
|
<p>© 2025 数据处理平台</p>
|
|
</footer>
|
|
|
|
{# --- 交互组件 --- #}
|
|
<!-- 返回顶部按钮 -->
|
|
<div id="backToTop" title="返回顶部">
|
|
<i class="fa-solid fa-arrow-up"></i>
|
|
</div>
|
|
|
|
<!-- 全局加载遮罩 -->
|
|
<div id="loadingOverlay">
|
|
<div class="spinner-border text-primary mb-3" role="status" style="width: 3rem; height: 3rem;">
|
|
<span class="visually-hidden">Loading...</span>
|
|
</div>
|
|
<h5 class="text-primary fw-bold">请稍候...</h5>
|
|
<p class="text-muted small">正在处理您的请求</p>
|
|
</div>
|
|
|
|
<!-- Bootstrap JavaScript Bundle -->
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" defer></script>
|
|
|
|
<!-- Custom Main JS -->
|
|
<script src="{{ url_for('static', filename='js/main.js') }}" defer></script>
|
|
</body>
|
|
</html> |