补齐 SetUserLevel 表单;用户主页/资料页展示徽章并触发 EvaluateAuto;勾选 §H Exp 与防刷。 Co-authored-by: Cursor <cursoragent@cursor.com>
121 lines
4.9 KiB
Cheetah
121 lines
4.9 KiB
Cheetah
{{define "admin/users"}}
|
|
{{template "base/head" .}}
|
|
{{template "base/navbar" .}}
|
|
<main class="j13-main j13-admin">
|
|
<h1>用户管理</h1>
|
|
{{template "admin/nav" .}}
|
|
{{template "base/alert" .}}
|
|
|
|
<form method="get" action="/admin/users" class="j13-form j13-admin-form j13-admin-search">
|
|
<label>搜索 <input name="q" value="{{.Keyword}}" placeholder="用户名 / 昵称 / 邮箱 / ID"/></label>
|
|
<label>筛选
|
|
<select name="filter">
|
|
<option value="all"{{if eq .Filter "all"}} selected{{end}}>全部</option>
|
|
<option value="verified"{{if eq .Filter "verified"}} selected{{end}}>认证用户</option>
|
|
<option value="banned"{{if eq .Filter "banned"}} selected{{end}}>已禁言</option>
|
|
<option value="admin"{{if eq .Filter "admin"}} selected{{end}}>管理员</option>
|
|
</select>
|
|
</label>
|
|
<button type="submit">查询</button>
|
|
</form>
|
|
|
|
<p class="j13-admin-filters">
|
|
<a href="/admin/users"{{if eq .Filter "all"}} class="is-active"{{end}}>全部</a>
|
|
<a href="/admin/users?filter=verified"{{if eq .Filter "verified"}} class="is-active"{{end}}>认证</a>
|
|
<a href="/admin/users?filter=banned"{{if eq .Filter "banned"}} class="is-active"{{end}}>禁言</a>
|
|
<a href="/admin/users?filter=admin"{{if eq .Filter "admin"}} class="is-active"{{end}}>管理员</a>
|
|
</p>
|
|
|
|
{{if .Users}}
|
|
<table class="j13-admin-table">
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>用户</th>
|
|
<th>角色</th>
|
|
<th>积分 / Lv</th>
|
|
<th>状态</th>
|
|
<th>注册</th>
|
|
<th>操作</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{range .Users}}
|
|
<tr>
|
|
<td>{{.ID}}</td>
|
|
<td>
|
|
<a href="/user/{{.ID}}">{{.Nickname}}</a>
|
|
<div class="j13-muted">@{{.Username}}{{if .Email}} · {{.Email}}{{end}}</div>
|
|
</td>
|
|
<td>{{.RoleLabel}}</td>
|
|
<td>{{.Points}} · Lv{{.Level}}</td>
|
|
<td>
|
|
{{if .Banned}}<span class="j13-tag j13-tag--rejected">禁言</span>{{end}}
|
|
{{if .Verified}}<span class="j13-tag j13-tag--resolved">认证</span>{{end}}
|
|
{{if and (not .Banned) (not .Verified)}}<span class="j13-muted">—</span>{{end}}
|
|
</td>
|
|
<td>{{.Created}}</td>
|
|
<td class="j13-admin-user-ops">
|
|
{{if not .IsAdmin}}
|
|
<form method="post" action="/admin/users/{{.ID}}/ban" class="j13-inline-form">
|
|
<input type="hidden" name="_csrf" value="{{$.CSRF}}"/>
|
|
{{if .Banned}}
|
|
<input type="hidden" name="banned" value="0"/>
|
|
<button type="submit" class="j13-btn-secondary">解禁</button>
|
|
{{else}}
|
|
<input type="hidden" name="banned" value="1"/>
|
|
<button type="submit">禁言</button>
|
|
{{end}}
|
|
</form>
|
|
<form method="post" action="/admin/users/{{.ID}}/verify" class="j13-inline-form">
|
|
<input type="hidden" name="_csrf" value="{{$.CSRF}}"/>
|
|
{{if .Verified}}
|
|
<input type="hidden" name="verified" value="0"/>
|
|
<button type="submit" class="j13-btn-secondary">取消认证</button>
|
|
{{else}}
|
|
<input type="hidden" name="verified" value="1"/>
|
|
<button type="submit" class="j13-btn-secondary">设为认证</button>
|
|
{{end}}
|
|
</form>
|
|
{{else}}
|
|
<span class="j13-muted">管理员不可禁言</span>
|
|
{{end}}
|
|
<form method="post" action="/admin/users/{{.ID}}/points" class="j13-form j13-admin-points">
|
|
<input type="hidden" name="_csrf" value="{{$.CSRF}}"/>
|
|
<input name="delta" type="number" required placeholder="±积分" style="width:5.5rem"/>
|
|
<input name="note" maxlength="120" placeholder="备注(可选)" style="width:8rem"/>
|
|
<button type="submit" class="j13-btn-secondary">调积分</button>
|
|
</form>
|
|
<form method="post" action="/admin/users/{{.ID}}/level" class="j13-form j13-admin-level">
|
|
<input type="hidden" name="_csrf" value="{{$.CSRF}}"/>
|
|
{{$cur := .Level}}
|
|
<select name="level" aria-label="设定等级">
|
|
{{range $.LevelOptions}}
|
|
<option value="{{.}}"{{if eq . $cur}} selected{{end}}>Lv{{.}}</option>
|
|
{{end}}
|
|
</select>
|
|
<button type="submit" class="j13-btn-secondary">设等级</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
{{if or .HasPrev .HasMore}}
|
|
<nav class="j13-pager">
|
|
{{if .HasPrev}}
|
|
<a href="/admin/users?{{if .QuerySuffix}}{{.QuerySuffix}}&{{end}}page={{.PrevPage}}">上一页</a>
|
|
{{end}}
|
|
<span>第 {{.Page}} 页</span>
|
|
{{if .HasMore}}
|
|
<a href="/admin/users?{{if .QuerySuffix}}{{.QuerySuffix}}&{{end}}page={{.NextPage}}">下一页</a>
|
|
{{end}}
|
|
</nav>
|
|
{{end}}
|
|
{{else}}
|
|
<p class="j13-empty">没有匹配的用户。</p>
|
|
{{end}}
|
|
</main>
|
|
{{template "base/footer" .}}
|
|
{{end}}
|