初始提交: LiteAdmin 社区平台
This commit is contained in:
@@ -0,0 +1,334 @@
|
||||
<!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 %}社区平台{% endblock %}</title>
|
||||
<style>
|
||||
:root {
|
||||
--primary: #2563eb;
|
||||
--primary-dark: #1d4ed8;
|
||||
--primary-light: #dbeafe;
|
||||
--bg: #f8fafc;
|
||||
--card-bg: #ffffff;
|
||||
--text: #1e293b;
|
||||
--text-light: #64748b;
|
||||
--border: #e2e8f0;
|
||||
--success: #22c55e;
|
||||
--warning: #f59e0b;
|
||||
--danger: #ef4444;
|
||||
--radius: 8px;
|
||||
--shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
|
||||
--header-bg: #1e293b;
|
||||
}
|
||||
|
||||
* { 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);
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
a { color: var(--primary); text-decoration: none; }
|
||||
a:hover { color: var(--primary-dark); text-decoration: underline; }
|
||||
|
||||
/* 顶部导航 */
|
||||
.header {
|
||||
background: var(--header-bg);
|
||||
color: #fff;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.header-inner {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 56px;
|
||||
}
|
||||
|
||||
.header .logo {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
margin-right: 32px;
|
||||
}
|
||||
|
||||
.header .logo:hover { text-decoration: none; }
|
||||
|
||||
.header nav { display: flex; gap: 4px; flex: 1; }
|
||||
|
||||
.header nav a {
|
||||
color: #94a3b8;
|
||||
padding: 8px 14px;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
transition: all 0.15s;
|
||||
}
|
||||
|
||||
.header nav a:hover { color: #fff; background: rgba(255,255,255,0.08); text-decoration: none; }
|
||||
.header nav a.active { color: #fff; background: var(--primary); }
|
||||
|
||||
.header .search-box { position: relative; margin: 0 8px; }
|
||||
.header .search-box input {
|
||||
background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15);
|
||||
color: #fff; padding: 6px 12px 6px 32px; border-radius: 20px; font-size: 13px;
|
||||
width: 180px; outline: none; transition: all 0.2s; font-family: inherit;
|
||||
}
|
||||
.header .search-box input:focus { background: rgba(255,255,255,0.15); border-color: var(--primary); width: 220px; }
|
||||
.header .search-box input::placeholder { color: #64748b; }
|
||||
.header .search-icon {
|
||||
position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
|
||||
color: #64748b; font-size: 14px; pointer-events: none;
|
||||
}
|
||||
|
||||
.header .user-area { display: flex; align-items: center; gap: 12px; }
|
||||
.header .user-area a { color: #94a3b8; font-size: 14px; }
|
||||
.header .user-area a:hover { color: #fff; }
|
||||
.header .user-area .username { color: #e2e8f0; font-size: 13px; }
|
||||
|
||||
/* 主内容 */
|
||||
.main { flex: 1; }
|
||||
.page-content { max-width: 1200px; margin: 0 auto; padding: 24px 20px; }
|
||||
|
||||
/* 页面标题 */
|
||||
.page-title { margin-bottom: 24px; }
|
||||
.page-title h1 { font-size: 24px; font-weight: 700; }
|
||||
.page-title p { color: var(--text-light); margin-top: 6px; font-size: 14px; }
|
||||
|
||||
/* 卡片 */
|
||||
.card {
|
||||
background: var(--card-bg);
|
||||
border-radius: var(--radius);
|
||||
box-shadow: var(--shadow);
|
||||
border: 1px solid var(--border);
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
padding: 14px 20px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
font-weight: 600;
|
||||
font-size: 15px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.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-sm { padding: 5px 10px; font-size: 13px; }
|
||||
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
|
||||
|
||||
/* 表单 */
|
||||
.form-group { margin-bottom: 16px; }
|
||||
.form-group label { display: block; font-size: 13px; font-weight: 500; 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); outline: none; transition: border-color 0.15s;
|
||||
font-family: inherit;
|
||||
}
|
||||
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
|
||||
textarea.form-control { min-height: 120px; resize: vertical; }
|
||||
select.form-control { cursor: pointer; }
|
||||
.form-error { color: var(--danger); font-size: 13px; margin-top: 4px; }
|
||||
|
||||
/* 列表项 */
|
||||
.list-item {
|
||||
display: flex;
|
||||
padding: 14px 0;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
.list-item:last-child { border-bottom: none; }
|
||||
.list-item .main-info { flex: 1; }
|
||||
.list-item .title { font-size: 15px; font-weight: 500; }
|
||||
.list-item .meta { font-size: 13px; color: var(--text-light); margin-top: 6px; display: flex; gap: 16px; flex-wrap: wrap; }
|
||||
.list-item .side-info { text-align: right; color: var(--text-light); font-size: 13px; white-space: nowrap; }
|
||||
|
||||
.badge {
|
||||
display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 500;
|
||||
}
|
||||
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
|
||||
.badge-success { background: #dcfce7; color: #166534; }
|
||||
.badge-warning { background: #fef3c7; color: #92400e; }
|
||||
.badge-info { background: #e0f2fe; color: #0369a1; }
|
||||
|
||||
/* 公告横幅 */
|
||||
.announcement-banner {
|
||||
background: linear-gradient(135deg, #1e40af, #3b82f6);
|
||||
color: #fff;
|
||||
border-radius: var(--radius);
|
||||
padding: 16px 20px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.announcement-banner a { color: #bfdbfe; }
|
||||
.announcement-banner .item { padding: 6px 0; display: flex; gap: 8px; }
|
||||
.announcement-banner .item .tag { flex-shrink: 0; }
|
||||
|
||||
/* 标签 */
|
||||
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
|
||||
.tag {
|
||||
display: inline-block; padding: 4px 10px; border-radius: 4px;
|
||||
font-size: 12px; background: #f1f5f9; color: var(--text-light); cursor: pointer;
|
||||
}
|
||||
.tag:hover { background: var(--primary-light); color: var(--primary); }
|
||||
.tag.active { background: var(--primary); color: #fff; }
|
||||
|
||||
/* 回复 */
|
||||
.reply-item {
|
||||
padding: 14px 0;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
.reply-item:last-child { border-bottom: none; }
|
||||
.reply-item .meta { font-size: 13px; color: var(--text-light); margin-bottom: 8px; }
|
||||
.reply-item .content { line-height: 1.7; }
|
||||
|
||||
/* 内容渲染 */
|
||||
.prose { line-height: 1.8; font-size: 15px; }
|
||||
.prose p { margin-bottom: 12px; }
|
||||
.prose h2 { font-size: 20px; margin: 24px 0 12px; }
|
||||
.prose h3 { font-size: 17px; margin: 20px 0 10px; }
|
||||
.prose ul, .prose ol { padding-left: 20px; margin-bottom: 12px; }
|
||||
.prose li { margin-bottom: 4px; }
|
||||
.prose code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 13px; }
|
||||
.prose pre { background: #1e293b; color: #e2e8f0; padding: 16px; border-radius: var(--radius); overflow-x: auto; margin-bottom: 12px; }
|
||||
|
||||
/* 空状态 */
|
||||
.empty-state { text-align: center; padding: 40px; color: var(--text-light); }
|
||||
|
||||
/* 分页 */
|
||||
.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; }
|
||||
|
||||
/* Markdown 表格样式 */
|
||||
.prose table { width: 100%; border-collapse: collapse; margin: 12px 0; }
|
||||
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
|
||||
.prose th { background: #f8fafc; font-weight: 600; }
|
||||
.prose tr:nth-child(even) { background: #fafbfc; }
|
||||
.prose pre { background: #1e293b; color: #e2e8f0; padding: 16px; border-radius: var(--radius); overflow-x: auto; margin-bottom: 12px; }
|
||||
.prose code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 13px; }
|
||||
.prose pre code { background: transparent; padding: 0; border-radius: 0; font-size: 13px; }
|
||||
.prose blockquote { border-left: 4px solid var(--primary); padding: 8px 16px; margin: 12px 0; background: #f8fafc; color: var(--text-light); }
|
||||
.prose img { max-width: 100%; border-radius: var(--radius); margin: 12px 0; }
|
||||
|
||||
/* 搜索 */
|
||||
.search-preview { font-size: 13px; color: var(--text-light); margin-top: 6px; line-height: 1.6; max-height: 48px; overflow: hidden; }
|
||||
.search-form { margin-bottom: 0; }
|
||||
|
||||
/* 统计统计 */
|
||||
.stats-bar { display: flex; gap: 24px; margin-bottom: 24px; }
|
||||
.stat-item { text-align: center; }
|
||||
.stat-item .num { font-size: 28px; font-weight: 700; color: var(--primary); }
|
||||
.stat-item .label { font-size: 13px; color: var(--text-light); margin-top: 2px; }
|
||||
|
||||
/* 底部 */
|
||||
.footer {
|
||||
background: var(--header-bg);
|
||||
color: #94a3b8;
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
font-size: 13px;
|
||||
margin-top: auto;
|
||||
}
|
||||
|
||||
.footer a { color: #60a5fa; }
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.header-inner { flex-wrap: wrap; height: auto; padding: 8px 12px; }
|
||||
.header nav { order: 3; width: 100%; margin-top: 8px; overflow-x: auto; }
|
||||
.stats-bar { flex-wrap: wrap; gap: 16px; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
<div class="header-inner">
|
||||
<a href="/" class="logo">社区平台</a>
|
||||
<nav>
|
||||
<a href="/" class="{% if request.path == '/' %}active{% endif %}">首页</a>
|
||||
<a href="/announcements/" class="{% if request.path.startswith('/announcements') %}active{% endif %}">公告</a>
|
||||
<a href="/forum/" class="{% if request.path.startswith('/forum') %}active{% endif %}">论坛</a>
|
||||
<a href="/knowledge/" class="{% if request.path.startswith('/knowledge') %}active{% endif %}">知识库</a>
|
||||
</nav>
|
||||
<div class="search-box">
|
||||
<span class="search-icon">🔍</span>
|
||||
<form method="get" action="/search/" style="display:inline;">
|
||||
<input type="text" name="q" placeholder="搜索...">
|
||||
</form>
|
||||
</div>
|
||||
<div class="user-area">
|
||||
{% if current_user %}
|
||||
<span class="username">{{ current_user.username }}</span>
|
||||
<span class="badge badge-primary">{{ current_user.get_level_name() }}</span>
|
||||
<a href="/admin/">管理</a>
|
||||
<a href="/admin/logout/">退出</a>
|
||||
{% else %}
|
||||
<a href="/login/">登录</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main">
|
||||
<div class="page-content">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
<p>社区平台 © 2026 Powered by LiteAdmin</p>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
document.querySelectorAll('.prose table').forEach(function(t) {
|
||||
if (!t.parentElement.classList.contains('table-wrap')) {
|
||||
var wrap = document.createElement('div');
|
||||
wrap.className = 'table-wrap';
|
||||
wrap.style.overflowX = 'auto';
|
||||
t.parentNode.insertBefore(wrap, t);
|
||||
wrap.appendChild(t);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user