init
This commit is contained in:
87
templates/base.html
Normal file
87
templates/base.html
Normal file
@@ -0,0 +1,87 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% block title %}PT Manager{% endblock %}</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||
{% block head %}{% endblock %}
|
||||
</head>
|
||||
<body class="bg-gray-100">
|
||||
<div class="flex h-screen">
|
||||
<!-- Sidebar -->
|
||||
{% if session.user_id %}
|
||||
<div class="w-64 bg-blue-800 text-white">
|
||||
<div class="p-4 border-b border-blue-700">
|
||||
<h1 class="text-xl font-semibold">PT Manager</h1>
|
||||
<p class="text-blue-200 text-sm">{{ session.username }}</p>
|
||||
</div>
|
||||
<nav class="mt-4">
|
||||
<a href="{{ url_for('main.index') }}" class="flex items-center px-4 py-3 text-sm hover:bg-blue-700 {% if request.endpoint == 'main.index' %}bg-blue-700{% endif %}">
|
||||
<i class="fas fa-home mr-3"></i> 首页
|
||||
</a>
|
||||
<a href="{{ url_for('site.site_index') }}" class="flex items-center px-4 py-3 text-sm hover:bg-blue-700 {% if request.endpoint and 'site.' in request.endpoint %}bg-blue-700{% endif %}">
|
||||
<i class="fas fa-globe mr-3"></i> 站点
|
||||
</a>
|
||||
<a href="{{ url_for('qbittorrent.qbittorrent_index') }}" class="flex items-center px-4 py-3 text-sm hover:bg-blue-700 {% if request.endpoint and 'qbittorrent.' in request.endpoint %}bg-blue-700{% endif %}">
|
||||
<i class="fas fa-download mr-3"></i> qBittorrent
|
||||
</a>
|
||||
<a href="{{ url_for('transmission.transmission_index') }}" class="flex items-center px-4 py-3 text-sm hover:bg-blue-700 {% if request.endpoint and 'transmission.' in request.endpoint %}bg-blue-700{% endif %}">
|
||||
<i class="fas fa-cloud-download-alt mr-3"></i> Transmission
|
||||
</a>
|
||||
{% if session.role == 'admin' %}
|
||||
<a href="{{ url_for('user.user_index') }}" class="flex items-center px-4 py-3 text-sm hover:bg-blue-700 {% if request.endpoint and 'user.' in request.endpoint %}bg-blue-700{% endif %}">
|
||||
<i class="fas fa-users mr-3"></i> 用户管理
|
||||
</a>
|
||||
<a href="{{ url_for('settings.settings_index') }}" class="flex items-center px-4 py-3 text-sm hover:bg-blue-700 {% if request.endpoint and 'settings.' in request.endpoint %}bg-blue-700{% endif %}">
|
||||
<i class="fas fa-cog mr-3"></i> 设置
|
||||
</a>
|
||||
{% endif %}
|
||||
<a href="{{ url_for('auth.change_password') }}" class="flex items-center px-4 py-3 text-sm hover:bg-blue-700 {% if request.endpoint == 'auth.change_password' %}bg-blue-700{% endif %}">
|
||||
<i class="fas fa-key mr-3"></i> 修改密码
|
||||
</a>
|
||||
<a href="{{ url_for('auth.logout') }}" class="flex items-center px-4 py-3 text-sm hover:bg-blue-700">
|
||||
<i class="fas fa-sign-out-alt mr-3"></i> 登出
|
||||
</a>
|
||||
</nav>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Main Content -->
|
||||
<div class="flex-1 flex flex-col overflow-hidden">
|
||||
{% if session.user_id %}
|
||||
<header class="bg-white shadow">
|
||||
<div class="flex justify-between items-center px-6 py-4">
|
||||
<h2 class="text-lg font-semibold text-gray-800">{% block page_title %}{% endblock %}</h2>
|
||||
<div class="flex items-center">
|
||||
<span class="text-gray-600 mr-4">欢迎, {{ session.username }}</span>
|
||||
<span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded">{{ session.role }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
{% endif %}
|
||||
|
||||
<main class="flex-1 overflow-y-auto p-6 bg-gray-100">
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
{% for message in messages %}
|
||||
<div class="bg-blue-100 border-l-4 border-blue-500 text-blue-700 p-4 mb-4" role="alert">
|
||||
<p>{{ message }}</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal Container -->
|
||||
<div id="modal-container"></div>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
{% block scripts %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user