Files
vps_web/templates/admin/forum_posts.html
ddrwode d454699f50 哈哈
2026-02-11 17:38:06 +08:00

145 lines
7.8 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>帖子管理 - 后台</title>
<link rel="stylesheet" href="/static/css/style.css">
<link rel="stylesheet" href="/static/css/admin.css">
</head>
<body class="admin-page">
<header class="admin-header">
<h1>帖子管理</h1>
<nav>
<a href="{{ url_for('admin_forum_post_new') }}">+ 新增帖子</a>
<a href="{{ url_for('admin_forum_comments') }}">评论管理</a>
<a href="{{ url_for('admin_users') }}">用户管理</a>
<a href="{{ url_for('admin_forum_categories') }}">论坛分类</a>
<a href="{{ url_for('admin_forum_reports') }}">举报审核</a>
<a href="{{ url_for('admin_forum_tracking') }}">埋点看板</a>
<a href="{{ url_for('admin_dashboard') }}">返回总览</a>
<a href="{{ url_for('admin_logout') }}">退出</a>
</nav>
</header>
<main class="admin-main">
{% if msg %}
<p class="hint success-msg">{{ msg }}</p>
{% endif %}
{% if error %}
<p class="error-msg">{{ error }}</p>
{% endif %}
<section class="dashboard-section">
<div class="admin-topline">
<h2>帖子列表</h2>
<a href="{{ url_for('admin_forum_post_new') }}" class="admin-btn-link">+ 新增帖子</a>
</div>
<form method="get" class="admin-filter-form">
<div class="filter-row">
<div class="filter-item">
<label for="q">关键词</label>
<input id="q" name="q" type="text" value="{{ keyword or '' }}" maxlength="80" placeholder="标题 / 内容 / 作者">
</div>
<div class="filter-item">
<label for="category">分类</label>
<select id="category" name="category">
<option value="">全部分类</option>
{% for name in category_names %}
<option value="{{ name }}" {{ 'selected' if selected_category == name else '' }}>{{ name }}</option>
{% endfor %}
</select>
</div>
<div class="filter-item">
<label for="author_id">作者</label>
<select id="author_id" name="author_id">
<option value="">全部作者</option>
{% for uid, uname, post_count in author_rows %}
<option value="{{ uid }}" {{ 'selected' if selected_author_id == uid else '' }}>{{ uname }}{{ post_count }}</option>
{% endfor %}
</select>
</div>
<div class="filter-actions">
<button type="submit">筛选</button>
<a href="{{ url_for('admin_forum_posts') }}">重置</a>
</div>
</div>
</form>
<table class="admin-table">
<thead>
<tr>
<th>ID</th>
<th>分类</th>
<th>标题</th>
<th>作者</th>
<th>评论</th>
<th>点赞</th>
<th>收藏</th>
<th>浏览</th>
<th>状态</th>
<th>发布时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{% for post, comment_count, author_name, like_count, bookmark_count in rows %}
<tr>
<td>#{{ post.id }}</td>
<td>{{ post.category }}</td>
<td>
<div class="table-title">{{ post.title }}</div>
<div class="muted-text line-clamp-2">{{ post.content }}</div>
</td>
<td>{{ author_name or '用户' }}</td>
<td>{{ comment_count }}</td>
<td>{{ like_count }}</td>
<td>{{ bookmark_count }}</td>
<td>{{ post.view_count or 0 }}</td>
<td>
{% if post.is_pinned %}<span class="status-pill active">置顶</span>{% endif %}
{% if post.is_featured %}<span class="status-pill active">精华</span>{% endif %}
{% if post.is_locked %}<span class="status-pill inactive">锁帖</span>{% endif %}
{% if not post.is_pinned and not post.is_featured and not post.is_locked %}
<span class="muted-text">普通</span>
{% endif %}
</td>
<td>{{ post.created_at.strftime('%Y-%m-%d %H:%M') if post.created_at else '—' }}</td>
<td>
<a href="{{ url_for('forum_post_detail', post_id=post.id) }}" target="_blank" rel="noopener">查看</a>
<a href="{{ url_for('admin_forum_post_edit', post_id=post.id) }}">编辑</a>
<a href="{{ url_for('admin_forum_comments', post_id=post.id) }}">评论</a>
<form method="post" action="{{ url_for('admin_forum_post_moderate', post_id=post.id) }}" style="display:inline;">
{% if post.is_pinned %}
<button type="submit" name="action" value="unpin" class="btn-inline">取消置顶</button>
{% else %}
<button type="submit" name="action" value="pin" class="btn-inline">置顶</button>
{% endif %}
</form>
<form method="post" action="{{ url_for('admin_forum_post_moderate', post_id=post.id) }}" style="display:inline;">
{% if post.is_featured %}
<button type="submit" name="action" value="unfeature" class="btn-inline">取消精华</button>
{% else %}
<button type="submit" name="action" value="feature" class="btn-inline">设为精华</button>
{% endif %}
</form>
<form method="post" action="{{ url_for('admin_forum_post_moderate', post_id=post.id) }}" style="display:inline;">
{% if post.is_locked %}
<button type="submit" name="action" value="unlock" class="btn-inline">解除锁帖</button>
{% else %}
<button type="submit" name="action" value="lock" class="btn-inline">锁帖</button>
{% endif %}
</form>
<form method="post" action="{{ url_for('admin_forum_post_delete', post_id=post.id) }}" style="display:inline;" onsubmit="return confirm('确认删除帖子 #{{ post.id }}?该帖下评论也会删除。');">
<button type="submit" class="btn-delete">删除</button>
</form>
</td>
</tr>
{% else %}
<tr><td colspan="11">暂无帖子。</td></tr>
{% endfor %}
</tbody>
</table>
</section>
</main>
</body>
</html>