Complete project files including setup.sh

This commit is contained in:
2026-01-11 14:17:26 +08:00
commit 0bbe394cb5
29 changed files with 3060 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
{% extends "base.html" %}
{% block title %}创建管理员 - 管理面板{% endblock %}
{% block content %}
<div class="container admin-container">
<div class="page-header">
<h1>👤 创建新管理员</h1>
<a href="{{ url_for('admin.dashboard') }}" class="btn btn-secondary">返回面板</a>
</div>
<div class="auth-card" style="max-width: 600px; margin: 0 auto;">
<form method="POST" class="auth-form">
<div class="form-group">
<label for="username">用户名</label>
<input type="text" id="username" name="username" required placeholder="请输入用户名" class="form-control">
</div>
<div class="form-group">
<label for="email">邮箱</label>
<input type="email" id="email" name="email" required placeholder="请输入邮箱" class="form-control">
</div>
<div class="form-group">
<label for="password">密码</label>
<input type="password" id="password" name="password" required placeholder="至少6位" class="form-control">
</div>
<div class="form-group">
<label for="confirm_password">确认密码</label>
<input type="password" id="confirm_password" name="confirm_password" required placeholder="再次输入密码"
class="form-control">
</div>
<div class="info-box">
<p><strong>提示:</strong>新管理员将拥有完整的管理权限,包括审核用户、帖子和创建其他管理员。</p>
</div>
<button type="submit" class="btn btn-primary btn-block">创建管理员</button>
</form>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,49 @@
{% extends "base.html" %}
{% block title %}管理面板 - 泸州高中摄影社论坛{% endblock %}
{% block content %}
<div class="container admin-container">
<div class="page-header">
<h1>🛡️ 管理面板</h1>
</div>
<div class="admin-stats">
<div class="stat-card">
<div class="stat-icon">👥</div>
<div class="stat-info">
<div class="stat-number">{{ pending_users }}</div>
<div class="stat-label">待审核用户</div>
</div>
<a href="{{ url_for('admin.users') }}" class="stat-link">查看</a>
</div>
<div class="stat-card">
<div class="stat-icon">📝</div>
<div class="stat-info">
<div class="stat-number">{{ pending_posts }}</div>
<div class="stat-label">待审核帖子</div>
</div>
<a href="{{ url_for('admin.posts') }}" class="stat-link">查看</a>
</div>
</div>
<div class="admin-quick-links">
<h2>快速链接</h2>
<div class="quick-links-grid">
<a href="{{ url_for('admin.users') }}" class="quick-link-card">
<span class="quick-link-icon">👤</span>
<span class="quick-link-text">用户审核</span>
</a>
<a href="{{ url_for('admin.posts') }}" class="quick-link-card">
<span class="quick-link-icon">📸</span>
<span class="quick-link-text">帖子审核</span>
</a>
<a href="{{ url_for('admin.create_admin') }}" class="quick-link-card">
<span class="quick-link-icon"></span>
<span class="quick-link-text">创建管理员</span>
</a>
</div>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,84 @@
{% extends "base.html" %}
{% block title %}帖子审核 - 管理面板{% endblock %}
{% block content %}
<div class="container admin-container">
<div class="page-header">
<h1>📝 帖子审核</h1>
<a href="{{ url_for('admin.dashboard') }}" class="btn btn-secondary">返回面板</a>
</div>
<!-- Pending Posts -->
<section class="admin-section">
<h2 class="section-title">待审核帖子 ({{ pending_posts|length }})</h2>
{% if pending_posts %}
<div class="admin-posts-grid">
{% for post in pending_posts %}
<div class="admin-post-card">
<img src="{{ url_for('uploaded_file', filename=post.image_path) }}" alt="Post image"
class="admin-post-image">
<div class="admin-post-info">
<div class="admin-post-author">
<a href="{{ url_for('users.profile', username=post.author.username) }}">
{{ post.author.username }}
</a>
<span class="post-time">{{ post.created_at.strftime('%Y-%m-%d %H:%M') }}</span>
</div>
{% if post.description %}
<div class="admin-post-description">
{{ post.description }}
</div>
{% endif %}
<div class="admin-actions">
<form method="POST" action="{{ url_for('admin.approve_post', post_id=post.id) }}"
style="display: inline;">
<button type="submit" class="btn btn-success">✓ 批准</button>
</form>
<form method="POST" action="{{ url_for('admin.reject_post', post_id=post.id) }}"
style="display: inline;" onsubmit="return confirm('确定要拒绝该帖子吗?');">
<button type="submit" class="btn btn-danger">✗ 拒绝</button>
</form>
</div>
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="empty-state">
<p>暂无待审核帖子</p>
</div>
{% endif %}
</section>
<!-- Recently Approved Posts -->
<section class="admin-section">
<h2 class="section-title">最近批准的帖子</h2>
{% if approved_posts %}
<div class="posts-grid">
{% for post in approved_posts %}
<div class="post-card">
<a href="{{ url_for('posts.post_detail', post_id=post.id) }}" class="post-image-link">
<img src="{{ url_for('uploaded_file', filename=post.image_path) }}" alt="Post image"
class="post-image" loading="lazy">
</a>
<div class="post-footer">
<span>{{ post.author.username }}</span>
<span class="badge badge-success">已批准</span>
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="empty-state">
<p>暂无已批准帖子</p>
</div>
{% endif %}
</section>
</div>
{% endblock %}

View File

@@ -0,0 +1,85 @@
{% extends "base.html" %}
{% block title %}用户审核 - 管理面板{% endblock %}
{% block content %}
<div class="container admin-container">
<div class="page-header">
<h1>👥 用户审核</h1>
<a href="{{ url_for('admin.dashboard') }}" class="btn btn-secondary">返回面板</a>
</div>
<!-- Pending Users -->
<section class="admin-section">
<h2 class="section-title">待审核用户 ({{ pending_users|length }})</h2>
{% if pending_users %}
<div class="admin-list">
{% for user in pending_users %}
<div class="admin-item">
<div class="admin-item-header">
<div class="user-info">
<div class="user-avatar">{{ user.username[0].upper() }}</div>
<div>
<div class="username">{{ user.username }}</div>
<div class="user-email">{{ user.email }}</div>
<div class="user-time">注册于 {{ user.created_at.strftime('%Y-%m-%d %H:%M') }}</div>
</div>
</div>
</div>
<!-- Student ID Photo -->
<div class="student-id-preview">
<p><strong>学生证照片:</strong></p>
<img src="{{ url_for('uploaded_file', filename=user.student_id_photo) }}" alt="Student ID"
class="student-id-image">
</div>
<!-- Actions -->
<div class="admin-actions">
<form method="POST" action="{{ url_for('admin.approve_user', user_id=user.id) }}"
style="display: inline;">
<button type="submit" class="btn btn-success">✓ 批准</button>
</form>
<form method="POST" action="{{ url_for('admin.reject_user', user_id=user.id) }}"
style="display: inline;" onsubmit="return confirm('确定要拒绝该用户的注册吗?');">
<button type="submit" class="btn btn-danger">✗ 拒绝</button>
</form>
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="empty-state">
<p>暂无待审核用户</p>
</div>
{% endif %}
</section>
<!-- Recently Approved Users -->
<section class="admin-section">
<h2 class="section-title">最近批准的用户</h2>
{% if approved_users %}
<div class="users-list">
{% for user in approved_users %}
<div class="user-list-item">
<div class="user-avatar">{{ user.username[0].upper() }}</div>
<div class="user-list-info">
<a href="{{ url_for('users.profile', username=user.username) }}" class="username">
{{ user.username }}
</a>
<p class="user-stats">{{ user.email }} · 加入于 {{ user.created_at.strftime('%Y-%m-%d') }}</p>
</div>
<span class="badge badge-success">已批准</span>
</div>
{% endfor %}
</div>
{% else %}
<div class="empty-state">
<p>暂无已批准用户</p>
</div>
{% endif %}
</section>
</div>
{% endblock %}