Files
mce/templates/admin/html/dashboard/index.html
Victor_Jay f0bf450725 feat: 管理首页帖子总数统计(总数/已发布/待审核)
- PostRepo 新增 CountPostsByStatus 和 CountPending 方法
- Service 层定义 postAdminStatStore 接口 (ISP)
- AdminService 注入 postRepo,新增 PostStats 结构体和 GetPostStats 方法
- AdminController.Dashboard 调用 GetPostStats 并传参到模板
- Dashboard 帖子卡片显示总数 + 已发布 + 待审核(橙色徽章)
- DI 层将 AdminController 创建从 buildDepsCore 移至 buildDeps,以便注入 postRepo
2026-05-31 12:46:06 +08:00

52 lines
3.2 KiB
HTML

{{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">{{.TotalUsers}}</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">{{.PostTotal}}</div>
<div class="stat-desc">已发布 {{.PostApproved}}<span class="stat-badge badge-warn" style="margin-left: 12px;">待审核 {{.PostPending}}</span></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">{{.RoleDisplayName}}</div></div>
</div>
</div>
<div class="stats-grid" style="margin-top: 1rem;">
<div class="stat-card" style="grid-column: span 2;">
<div class="stat-icon {{if .StoreDegraded}}stat-red{{else if eq .StoreType "redis"}}stat-green{{else}}stat-blue{{end}}">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/><path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/></svg>
</div>
<div class="stat-info">
<div class="stat-label">会话存储后端</div>
<div class="stat-value">
{{if eq .StoreType "redis"}}Redis{{else}}内存{{end}}
{{if .StoreDegraded}}<span class="stat-badge badge-warn">已降级</span>{{end}}
</div>
{{if .DegradedNote}}<div class="stat-desc">{{.DegradedNote}}</div>{{end}}
{{if ge .ActiveSessions 0}}<div class="stat-desc">活跃会话数:{{.ActiveSessions}}</div>{{end}}
</div>
</div>
</div>
<div class="info-card">
<h3>快速开始</h3>
<ul>
<li>在左侧导航选择管理模块</li>
<li>使用「用户管理」查看、搜索和封禁用户</li>
<li>使用「返回前台」链接回到主站</li>
</ul>
</div>
{{template "admin/layout/footer.html" .}}