Files
vps_web/templates/admin/users.html
ddrwode 742b1286c9 哈哈
2026-02-10 11:07:04 +08:00

110 lines
5.4 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_user_new') }}">+ 新增用户</a>
<a href="{{ url_for('admin_forum_posts') }}">帖子管理</a>
<a href="{{ url_for('admin_forum_comments') }}">评论管理</a>
<a href="{{ url_for('admin_forum_categories') }}">论坛分类</a>
<a href="{{ url_for('admin_forum_reports') }}">举报审核</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_user_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="50" placeholder="输入用户名搜索">
</div>
<div class="filter-actions">
<button type="submit">筛选</button>
<a href="{{ url_for('admin_users') }}">重置</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>
</tr>
</thead>
<tbody>
{% for u in users %}
<tr>
<td>#{{ u.id }}</td>
<td>{{ u.username }}</td>
<td>{{ u.created_at.strftime('%Y-%m-%d %H:%M') if u.created_at else '—' }}</td>
<td>{{ u.last_login_at.strftime('%Y-%m-%d %H:%M') if u.last_login_at else '—' }}</td>
<td>
{% if u.is_banned %}
<span class="status-pill inactive">封禁</span>
<div class="muted-text">{{ u.banned_reason or '管理员封禁' }}</div>
{% if u.banned_at %}
<div class="muted-text">封禁时间:{{ u.banned_at.strftime('%Y-%m-%d %H:%M') }}</div>
{% endif %}
{% else %}
<span class="status-pill active">正常</span>
{% endif %}
</td>
<td>{{ post_count_map.get(u.id, 0) }}</td>
<td>{{ comment_count_map.get(u.id, 0) }}</td>
<td>{{ report_count_map.get(u.id, 0) }}</td>
<td>{{ unread_notification_count_map.get(u.id, 0) }}</td>
<td>
<a href="{{ url_for('admin_user_edit', user_id=u.id) }}">编辑</a>
{% if u.is_banned %}
<form method="post" action="{{ url_for('admin_user_unban', user_id=u.id) }}" style="display:inline;">
<button type="submit" class="btn-inline">解封</button>
</form>
{% else %}
<form method="post" action="{{ url_for('admin_user_ban', user_id=u.id) }}" style="display:inline;" onsubmit="return confirm('确认封禁用户 {{ u.username }}');">
<input type="hidden" name="reason" value="管理员封禁">
<button type="submit" class="btn-inline">封禁</button>
</form>
{% endif %}
<form method="post" action="{{ url_for('admin_user_delete', user_id=u.id) }}" style="display:inline;" onsubmit="return confirm('确认删除用户 {{ u.username }}?该用户的帖子/评论/举报/通知会一并删除。');">
<button type="submit" class="btn-delete">删除</button>
</form>
</td>
</tr>
{% else %}
<tr><td colspan="10">暂无用户。</td></tr>
{% endfor %}
</tbody>
</table>
</section>
</main>
</body>
</html>