初始化项目:基础设施 + 用户认证 + 后台管理系统 + AGPL 3.0 许可

This commit is contained in:
2026-05-26 13:46:33 +08:00
parent 1315df6501
commit 483fdd919f
56 changed files with 5804 additions and 40 deletions

View File

@ -0,0 +1,30 @@
{{template "admin/layout/base.html" .}}
<div class="page-header">
<h1>欢迎,{{.Username}}</h1>
<p class="page-desc">MetaLab 管理控制面板</p>
</div>
<div class="stats-grid">
<div class="stat-card">
<div class="stat-icon stat-blue"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="8" r="4"/><path d="M4 20c0-4 4-7 8-7s8 3 8 7"/></svg></div>
<div class="stat-info"><div class="stat-label">用户总数</div><div class="stat-value"></div></div>
</div>
<div class="stat-card">
<div class="stat-icon stat-green"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18"/><line x1="9" y1="9" x2="15" y2="9"/><line x1="9" y1="13" x2="15" y2="13"/></svg></div>
<div class="stat-info"><div class="stat-label">帖子总数</div><div class="stat-value"></div></div>
</div>
<div class="stat-card">
<div class="stat-icon stat-orange"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></svg></div>
<div class="stat-info"><div class="stat-label">当前角色</div><div class="stat-value">{{.Role}}</div></div>
</div>
</div>
<div class="info-card">
<h3>快速开始</h3>
<ul>
<li>在左侧导航选择管理模块</li>
<li>使用「用户管理」查看、搜索和封禁用户</li>
<li>使用「返回前台」链接回到主站</li>
</ul>
</div>
{{template "admin/layout/footer.html" .}}

View File

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{if .CSRFToken}}<meta name="csrf-token" content="{{.CSRFToken}}">{{end}}
<title>{{.Title}} - MetaLab CP</title>
<link rel="stylesheet" href="/admin/static/css/common.css">
{{if .ExtraCSS}}
<link rel="stylesheet" href="{{.ExtraCSS}}">
{{end}}
</head>
<body>
<header class="admin-header">
<div class="admin-header-inner">
<a href="/admin" class="admin-logo">MetaLab <span>管理面板</span></a>
<div class="admin-header-right">
<span class="admin-user">{{.Username}}</span>
<a href="/" class="admin-back-btn">← 返回前台</a>
</div>
</div>
</header>
<div class="admin-container">
<aside class="admin-sidebar">
<nav>
<a href="/admin" class="sidebar-item {{if eq .CurrentPath "/admin"}}active{{end}}">
<span class="sidebar-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/></svg></span>
管理首页
</a>
{{if .CanManageUsers}}
<a href="/admin/users" class="sidebar-item {{if eq .CurrentPath "/admin/users"}}active{{end}}">
<span class="sidebar-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="8" r="4"/><path d="M4 20c0-4 4-7 8-7s8 3 8 7"/></svg></span>
用户管理
</a>
{{end}}
</nav>
</aside>
<main class="admin-main">

View File

@ -0,0 +1,8 @@
</main>
</div>
<script src="/admin/static/js/common.js"></script>
{{if .ExtraJS}}
<script src="{{.ExtraJS}}"></script>
{{end}}
</body>
</html>

View File

@ -0,0 +1,50 @@
{{template "admin/layout/base.html" .}}
<div class="page-header">
<h1>用户管理</h1>
<p class="page-desc">搜索、查看和管理本站用户</p>
</div>
<!-- 搜索与筛选 -->
<div class="filter-bar">
<input type="text" id="searchInput" class="filter-input" placeholder="搜索邮箱或用户名..." autocomplete="off">
<select id="roleFilter" class="filter-select">
<option value="">全部角色</option>
<option value="user">普通用户</option>
<option value="moderator">版主</option>
<option value="admin">管理员</option>
<option value="owner">站长</option>
</select>
<select id="statusFilter" class="filter-select">
<option value="">全部状态</option>
<option value="active">正常</option>
<option value="banned">已封禁</option>
<option value="deleted">已注销</option>
<option value="locked">已锁定</option>
</select>
<button id="searchBtn" class="btn btn-primary">搜索</button>
</div>
<!-- 用户表格 -->
<div class="table-container">
<table class="data-table">
<thead>
<tr>
<th>UID</th>
<th>用户名</th>
<th>邮箱</th>
<th>角色</th>
<th>状态</th>
<th>注册时间</th>
<th>操作</th>
</tr>
</thead>
<tbody id="userTableBody">
<tr class="table-loading"><td colspan="7">加载中...</td></tr>
</tbody>
</table>
</div>
<!-- 分页 -->
<div class="pagination-bar" id="paginationBar"></div>
<script>window.__currentUid = {{.UID}}; window.__isOwner = {{if .IsOwner}}true{{else}}false{{end}};</script>
{{template "admin/layout/footer.html" .}}