545 lines
12 KiB
HTML
545 lines
12 KiB
HTML
<!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 %}LiteAdmin 管理后台{% endblock %}</title>
|
|
<style>
|
|
:root {
|
|
--primary: #2563eb;
|
|
--primary-dark: #1d4ed8;
|
|
--primary-light: #dbeafe;
|
|
--sidebar-bg: #1e293b;
|
|
--sidebar-text: #94a3b8;
|
|
--sidebar-active: #2563eb;
|
|
--bg: #f1f5f9;
|
|
--card-bg: #ffffff;
|
|
--text: #1e293b;
|
|
--text-light: #64748b;
|
|
--border: #e2e8f0;
|
|
--success: #22c55e;
|
|
--warning: #f59e0b;
|
|
--danger: #ef4444;
|
|
--info: #3b82f6;
|
|
--radius: 8px;
|
|
--shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
|
|
--shadow-lg: 0 4px 6px rgba(0,0,0,0.07), 0 10px 15px rgba(0,0,0,0.1);
|
|
}
|
|
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
font-size: 14px;
|
|
color: var(--text);
|
|
background: var(--bg);
|
|
display: flex;
|
|
min-height: 100vh;
|
|
}
|
|
|
|
a { color: var(--primary); text-decoration: none; }
|
|
a:hover { color: var(--primary-dark); text-decoration: underline; }
|
|
|
|
/* 侧边栏 */
|
|
.sidebar {
|
|
width: 240px;
|
|
background: var(--sidebar-bg);
|
|
color: var(--sidebar-text);
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex-shrink: 0;
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
height: 100vh;
|
|
z-index: 100;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.sidebar-header {
|
|
padding: 20px;
|
|
border-bottom: 1px solid rgba(255,255,255,0.06);
|
|
}
|
|
|
|
.sidebar-header h1 {
|
|
font-size: 18px;
|
|
color: #fff;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.sidebar-header .subtitle {
|
|
font-size: 12px;
|
|
color: var(--sidebar-text);
|
|
margin-top: 4px;
|
|
}
|
|
|
|
.sidebar-nav { padding: 12px 0; flex: 1; }
|
|
|
|
.nav-section { margin-bottom: 8px; }
|
|
|
|
.nav-section-title {
|
|
padding: 8px 20px 4px;
|
|
font-size: 11px;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
color: #475569;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.nav-item {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 10px 20px;
|
|
color: var(--sidebar-text);
|
|
transition: all 0.15s;
|
|
cursor: pointer;
|
|
border-left: 3px solid transparent;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.nav-item:hover {
|
|
background: rgba(255,255,255,0.05);
|
|
color: #e2e8f0;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.nav-item.active {
|
|
background: rgba(37,99,235,0.15);
|
|
color: #60a5fa;
|
|
border-left-color: var(--sidebar-active);
|
|
}
|
|
|
|
.nav-item .icon {
|
|
margin-right: 10px;
|
|
font-size: 16px;
|
|
width: 20px;
|
|
text-align: center;
|
|
}
|
|
|
|
.sidebar-footer {
|
|
padding: 16px 20px;
|
|
border-top: 1px solid rgba(255,255,255,0.06);
|
|
font-size: 13px;
|
|
}
|
|
|
|
.sidebar-footer .user-info {
|
|
color: #e2e8f0;
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
/* 主区域 */
|
|
.main {
|
|
margin-left: 240px;
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
min-height: 100vh;
|
|
}
|
|
|
|
.topbar {
|
|
background: var(--card-bg);
|
|
border-bottom: 1px solid var(--border);
|
|
padding: 12px 28px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
position: sticky;
|
|
top: 0;
|
|
z-index: 50;
|
|
}
|
|
|
|
.topbar .breadcrumb {
|
|
font-size: 14px;
|
|
color: var(--text-light);
|
|
}
|
|
|
|
.topbar .breadcrumb a { color: var(--text-light); }
|
|
.topbar .breadcrumb span { color: var(--text); font-weight: 500; }
|
|
|
|
.topbar-right { display: flex; align-items: center; gap: 16px; }
|
|
|
|
.content {
|
|
padding: 24px 28px;
|
|
flex: 1;
|
|
}
|
|
|
|
/* 页面标题 */
|
|
.page-header {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
margin-bottom: 24px;
|
|
}
|
|
|
|
.page-header h2 {
|
|
font-size: 22px;
|
|
font-weight: 600;
|
|
color: var(--text);
|
|
}
|
|
|
|
/* 卡片 */
|
|
.card {
|
|
background: var(--card-bg);
|
|
border-radius: var(--radius);
|
|
box-shadow: var(--shadow);
|
|
border: 1px solid var(--border);
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.card-header {
|
|
padding: 16px 20px;
|
|
border-bottom: 1px solid var(--border);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.card-header h3 {
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.card-body { padding: 20px; }
|
|
|
|
/* 按钮 */
|
|
.btn {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
padding: 8px 16px;
|
|
border-radius: 6px;
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
border: 1px solid var(--border);
|
|
background: var(--card-bg);
|
|
color: var(--text);
|
|
transition: all 0.15s;
|
|
text-decoration: none;
|
|
line-height: 1.4;
|
|
}
|
|
|
|
.btn:hover { text-decoration: none; }
|
|
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
|
|
.btn-primary:hover { background: var(--primary-dark); }
|
|
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
|
|
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
|
|
.btn-sm { padding: 5px 10px; font-size: 13px; }
|
|
.btn-danger:hover { background: #dc2626; }
|
|
|
|
/* 表单 */
|
|
.form-group { margin-bottom: 16px; }
|
|
|
|
.form-group label {
|
|
display: block;
|
|
font-size: 13px;
|
|
font-weight: 500;
|
|
color: var(--text);
|
|
margin-bottom: 6px;
|
|
}
|
|
|
|
.form-control {
|
|
width: 100%;
|
|
padding: 8px 12px;
|
|
border: 1px solid var(--border);
|
|
border-radius: 6px;
|
|
font-size: 14px;
|
|
color: var(--text);
|
|
background: var(--card-bg);
|
|
transition: border-color 0.15s;
|
|
outline: none;
|
|
font-family: inherit;
|
|
}
|
|
|
|
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
|
|
select.form-control { cursor: pointer; }
|
|
textarea.form-control { min-height: 100px; resize: vertical; }
|
|
.form-hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }
|
|
|
|
/* 表格 */
|
|
.table-wrap { overflow-x: auto; }
|
|
|
|
table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
}
|
|
|
|
table th, table td {
|
|
padding: 10px 14px;
|
|
text-align: left;
|
|
border-bottom: 1px solid var(--border);
|
|
font-size: 14px;
|
|
}
|
|
|
|
table th {
|
|
background: #f8fafc;
|
|
font-weight: 600;
|
|
color: var(--text-light);
|
|
font-size: 12px;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.3px;
|
|
}
|
|
|
|
table tr:hover td { background: #f8fafc; }
|
|
table tr:last-child td { border-bottom: none; }
|
|
|
|
/* 搜索框 */
|
|
.search-box {
|
|
display: flex;
|
|
gap: 8px;
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.search-box input { flex: 1; max-width: 320px; }
|
|
|
|
/* 分页 */
|
|
.pagination {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 4px;
|
|
margin-top: 16px;
|
|
}
|
|
|
|
.pagination a, .pagination span {
|
|
padding: 6px 12px;
|
|
border: 1px solid var(--border);
|
|
border-radius: 4px;
|
|
font-size: 13px;
|
|
color: var(--text);
|
|
text-decoration: none;
|
|
}
|
|
|
|
.pagination a:hover { background: var(--primary-light); border-color: var(--primary); }
|
|
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }
|
|
.pagination .disabled { color: var(--text-light); cursor: not-allowed; }
|
|
|
|
/* 标签 / Badge */
|
|
.badge {
|
|
display: inline-block;
|
|
padding: 2px 8px;
|
|
border-radius: 10px;
|
|
font-size: 12px;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.badge-success { background: #dcfce7; color: #166534; }
|
|
.badge-warning { background: #fef3c7; color: #92400e; }
|
|
.badge-danger { background: #fce4ec; color: #c62828; }
|
|
.badge-info { background: var(--primary-light); color: var(--primary-dark); }
|
|
|
|
/* 统计卡片 */
|
|
.stats-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 16px;
|
|
margin-bottom: 24px;
|
|
}
|
|
|
|
.stat-card {
|
|
background: var(--card-bg);
|
|
border-radius: var(--radius);
|
|
border: 1px solid var(--border);
|
|
padding: 20px;
|
|
box-shadow: var(--shadow);
|
|
}
|
|
|
|
.stat-card .stat-label {
|
|
font-size: 13px;
|
|
color: var(--text-light);
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.stat-card .stat-value {
|
|
font-size: 28px;
|
|
font-weight: 700;
|
|
color: var(--text);
|
|
}
|
|
|
|
.stat-card .stat-icon {
|
|
float: right;
|
|
font-size: 32px;
|
|
opacity: 0.15;
|
|
}
|
|
|
|
/* Toast 消息 */
|
|
.toast-container {
|
|
position: fixed;
|
|
top: 16px;
|
|
right: 16px;
|
|
z-index: 9999;
|
|
}
|
|
|
|
.toast {
|
|
padding: 12px 20px;
|
|
border-radius: 6px;
|
|
color: #fff;
|
|
font-size: 14px;
|
|
margin-bottom: 8px;
|
|
box-shadow: var(--shadow-lg);
|
|
animation: slideIn 0.25s ease;
|
|
}
|
|
|
|
.toast-success { background: var(--success); }
|
|
.toast-error { background: var(--danger); }
|
|
.toast-info { background: var(--info); }
|
|
.toast-warning { background: var(--warning); }
|
|
|
|
@keyframes slideIn {
|
|
from { transform: translateX(100%); opacity: 0; }
|
|
to { transform: translateX(0); opacity: 1; }
|
|
}
|
|
|
|
/* 空状态 */
|
|
.empty-state {
|
|
text-align: center;
|
|
padding: 40px;
|
|
color: var(--text-light);
|
|
}
|
|
|
|
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.3; }
|
|
|
|
/* 确认对话框 */
|
|
.modal-overlay {
|
|
display: none;
|
|
position: fixed;
|
|
top: 0; left: 0; right: 0; bottom: 0;
|
|
background: rgba(0,0,0,0.5);
|
|
z-index: 1000;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.modal-overlay.active { display: flex; }
|
|
|
|
.modal {
|
|
background: var(--card-bg);
|
|
border-radius: var(--radius);
|
|
padding: 24px;
|
|
max-width: 400px;
|
|
width: 90%;
|
|
box-shadow: var(--shadow-lg);
|
|
}
|
|
|
|
.modal h3 { margin-bottom: 12px; }
|
|
.modal .actions { margin-top: 20px; display: flex; gap: 8px; justify-content: flex-end; }
|
|
|
|
/* 文件管理 */
|
|
.file-list .file-item {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 8px 12px;
|
|
border-bottom: 1px solid var(--border);
|
|
}
|
|
|
|
.file-list .file-item:last-child { border-bottom: none; }
|
|
.file-list .file-item .name { flex: 1; }
|
|
.file-list .file-item .size { color: var(--text-light); font-size: 13px; margin-right: 12px; }
|
|
.file-list .file-item .date { color: var(--text-light); font-size: 13px; margin-right: 12px; }
|
|
|
|
/* 日志查看器 */
|
|
.log-viewer {
|
|
background: #1e293b;
|
|
color: #e2e8f0;
|
|
border-radius: var(--radius);
|
|
padding: 16px;
|
|
font-family: "SF Mono", "Fira Code", "Consolas", monospace;
|
|
font-size: 13px;
|
|
line-height: 1.6;
|
|
max-height: 500px;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.log-entry { padding: 2px 0; white-space: pre-wrap; word-break: break-all; }
|
|
.log-DEBUG { color: #94a3b8; }
|
|
.log-INFO { color: #60a5fa; }
|
|
.log-WARNING { color: #fbbf24; }
|
|
.log-ERROR { color: #f87171; }
|
|
.log-CRITICAL { color: #ef4444; font-weight: bold; }
|
|
|
|
/* 响应式 */
|
|
@media (max-width: 768px) {
|
|
.sidebar { width: 60px; }
|
|
.sidebar-header h1, .sidebar-header .subtitle,
|
|
.nav-item span, .nav-section-title, .sidebar-footer { display: none; }
|
|
.main { margin-left: 60px; }
|
|
.content { padding: 16px; }
|
|
.stats-grid { grid-template-columns: 1fr 1fr; }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<!-- 侧边栏 -->
|
|
<div class="sidebar">
|
|
<div class="sidebar-header">
|
|
<h1>LiteAdmin</h1>
|
|
<div class="subtitle">管理后台</div>
|
|
</div>
|
|
<nav class="sidebar-nav">
|
|
<div class="nav-section">
|
|
<div class="nav-section-title">概览</div>
|
|
<a href="/admin/" class="nav-item {% if request.path == '/admin/' %}active{% endif %}">
|
|
<span class="icon">☗</span><span>控制台</span>
|
|
</a>
|
|
</div>
|
|
{% if admin_models %}
|
|
<div class="nav-section">
|
|
<div class="nav-section-title">数据管理</div>
|
|
{% for model_name, model_info in admin_models.items() %}
|
|
<a href="/admin/{{ model_name }}/" class="nav-item {% if request.path.startswith('/admin/' + model_name) %}active{% endif %}">
|
|
<span class="icon">☰</span><span>{{ model_info.verbose_name or model_name }}</span>
|
|
</a>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
<div class="nav-section">
|
|
<div class="nav-section-title">系统</div>
|
|
<a href="/admin/logs/" class="nav-item {% if request.path == '/admin/logs/' %}active{% endif %}">
|
|
<span class="icon">⚙</span><span>运行日志</span>
|
|
</a>
|
|
<a href="/admin/files/" class="nav-item {% if request.path == '/admin/files/' %}active{% endif %}">
|
|
<span class="icon">📁</span><span>文件管理</span>
|
|
</a>
|
|
</div>
|
|
</nav>
|
|
<div class="sidebar-footer">
|
|
<div class="user-info">{{ current_user.username }}</div>
|
|
<a href="/admin/logout/" style="color: var(--danger); font-size: 13px;">退出登录</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 主区域 -->
|
|
<div class="main">
|
|
<div class="topbar">
|
|
<div class="breadcrumb">
|
|
{% block breadcrumb %}
|
|
<a href="/admin/">控制台</a>
|
|
{% endblock %}
|
|
</div>
|
|
<div class="topbar-right">
|
|
<span style="font-size:13px;color:var(--text-light);">{{ current_user.username }}</span>
|
|
</div>
|
|
</div>
|
|
<div class="content">
|
|
{% if flash_message %}
|
|
<div class="toast-container">
|
|
<div class="toast toast-{{ flash_type or 'info' }}">{{ flash_message }}</div>
|
|
</div>
|
|
{% endif %}
|
|
{% block content %}{% endblock %}
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Toast 自动消失
|
|
var toasts = document.querySelectorAll('.toast');
|
|
toasts.forEach(function(t) {
|
|
setTimeout(function() { t.style.opacity = '0'; t.style.transition = 'opacity 0.3s'; }, 3000);
|
|
setTimeout(function() { t.remove(); }, 3300);
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |