103 lines
4.9 KiB
HTML
103 lines
4.9 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>评论管理 - 后台</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_comment_new', post_id=selected_post_id) }}">+ 新增评论</a>
|
||
<a href="{{ url_for('admin_forum_posts') }}">帖子管理</a>
|
||
<a href="{{ url_for('admin_users') }}">用户管理</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_comment_new', post_id=selected_post_id) }}" 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="post_id">帖子</label>
|
||
<select id="post_id" name="post_id">
|
||
<option value="">全部帖子</option>
|
||
{% for pid, ptitle in post_rows %}
|
||
<option value="{{ pid }}" {{ 'selected' if selected_post_id == pid else '' }}>#{{ pid }} {{ ptitle }}</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, comment_count in author_rows %}
|
||
<option value="{{ uid }}" {{ 'selected' if selected_author_id == uid else '' }}>{{ uname }}({{ comment_count }})</option>
|
||
{% endfor %}
|
||
</select>
|
||
</div>
|
||
<div class="filter-actions">
|
||
<button type="submit">筛选</button>
|
||
<a href="{{ url_for('admin_forum_comments') }}">重置</a>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
|
||
<table class="admin-table">
|
||
<thead>
|
||
<tr>
|
||
<th>ID</th>
|
||
<th>帖子</th>
|
||
<th>作者</th>
|
||
<th>评论内容</th>
|
||
<th>发布时间</th>
|
||
<th>操作</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for comment, post_title, author_name in rows %}
|
||
<tr>
|
||
<td>#{{ comment.id }}</td>
|
||
<td>
|
||
<a href="{{ url_for('forum_post_detail', post_id=comment.post_id) }}" target="_blank" rel="noopener">#{{ comment.post_id }} {{ post_title }}</a>
|
||
</td>
|
||
<td>{{ author_name or '用户' }}</td>
|
||
<td><div class="line-clamp-2">{{ comment.content }}</div></td>
|
||
<td>{{ comment.created_at.strftime('%Y-%m-%d %H:%M') if comment.created_at else '—' }}</td>
|
||
<td>
|
||
<a href="{{ url_for('admin_forum_comment_edit', comment_id=comment.id) }}">编辑</a>
|
||
<form method="post" action="{{ url_for('admin_forum_comment_delete', comment_id=comment.id) }}" style="display:inline;" onsubmit="return confirm('确认删除评论 #{{ comment.id }}?');">
|
||
<button type="submit" class="btn-delete">删除</button>
|
||
</form>
|
||
</td>
|
||
</tr>
|
||
{% else %}
|
||
<tr><td colspan="6">暂无评论。</td></tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</section>
|
||
</main>
|
||
</body>
|
||
</html>
|