完善后台样式

This commit is contained in:
Azmat@qq.com
2026-08-20 11:06:22 +08:00
parent b883fed981
commit c7520e93b7
2 changed files with 537 additions and 188 deletions
+406 -100
View File
@@ -1,44 +1,130 @@
/* 平台超管后台 · 仅补充 admin 专属的少量样式;外壳/导航/卡片全部复用 design-restraint.css 共享类
遵守铁律:只用 token,不写裸 hex,8px 圆角,单橙 accent。 */
/* 平台后台 · 对齐影擎工作台:白顶栏、冷灰底、Klein 选中、黑胶囊分段
选择器收敛在 .admin-app / .admin-page,不改共享 .btn/.pill/.input 定义。 */
/* 品牌下方的超管标记(mono 品牌签名) */
.admin-badge {
margin: 2px 0 14px;
padding: 0 4px;
font-size: 11px;
color: var(--black-alpha-48);
.admin-app {
--klein: #002fa7;
--klein-hover: #002680;
--st-black: #101012;
--st-muted: #6f747c;
--st-text: #17181a;
--st-line: rgba(34, 42, 54, 0.10);
--st-wash: rgba(34, 42, 54, 0.045);
--st-hover: rgba(34, 42, 54, 0.08);
}
.admin-app .sidebar .nav-panel {
display: flex;
flex-direction: column;
height: calc(100vh - 116px);
min-height: 0;
padding: 10px 0 0;
overflow: hidden;
}
.admin-rail {
flex: 1;
min-height: 0;
overflow-x: hidden;
overflow-y: auto;
padding: 0 16px 12px;
}
.admin-rail-mark {
margin: 4px 8px 10px;
font-size: 12px;
font-weight: 500;
color: var(--st-muted);
letter-spacing: 0.04em;
}
.admin-nav-group {
margin-bottom: 2px;
.admin-nav-group { margin-top: 10px; }
.admin-group {
margin: 0 8px 4px;
padding: 8px 4px 2px;
font-size: 12px;
font-weight: 500;
color: var(--st-muted);
}
.admin-link {
width: 100%;
min-height: 38px;
display: flex;
align-items: center;
gap: 10px;
padding: 0 12px;
border: 0;
border-radius: 10px;
background: transparent;
color: rgba(39, 42, 47, 0.62);
font: inherit;
font-size: 13px;
font-weight: 600;
text-align: left;
cursor: pointer;
transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}
.admin-link svg {
width: 16px;
height: 16px;
flex: 0 0 auto;
color: currentColor;
}
.admin-link:hover {
color: var(--klein);
background: rgba(0, 47, 167, 0.055);
transform: translateX(2px);
}
.admin-link.active {
color: var(--klein);
background: rgba(0, 47, 167, 0.09);
}
/* 侧栏底部:返回工作台 + 超管身份 + 退出 */
.admin-foot {
flex-shrink: 0;
display: flex;
flex-direction: column;
gap: 8px;
padding: 12px 16px 16px;
border-top: 1px solid var(--st-line);
background: rgba(28, 34, 43, 0.02);
}
.admin-back {
align-self: flex-start;
display: inline-flex;
align-items: center;
gap: 8px;
height: 36px;
padding: 0 10px;
border: 0;
border-radius: 8px;
background: transparent;
color: var(--st-muted);
font: inherit;
font-size: 13px;
font-weight: 500;
cursor: pointer;
}
.admin-back:hover { color: var(--st-text); background: var(--st-hover); }
.admin-back svg { width: 16px; height: 16px; }
.admin-user {
display: flex;
align-items: center;
gap: 10px;
padding: 8px;
border-radius: var(--r-md);
padding: 8px 10px 8px 8px;
border-radius: 999px;
background: #f3f4f7;
}
.admin-user .av {
width: 30px;
height: 30px;
border-radius: 6px;
background: var(--heat-12);
color: var(--heat);
width: 36px;
height: 36px;
border-radius: 50%;
background: var(--st-black);
color: #fff;
display: grid;
place-items: center;
font-size: 13px;
font-size: 14px;
font-weight: 600;
flex-shrink: 0;
}
@@ -51,74 +137,267 @@
.admin-user-meta .nm {
font-size: 13px;
font-weight: 500;
color: var(--accent-black);
color: var(--st-text);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.admin-user-meta .rl {
font-size: 11px;
color: var(--black-alpha-48);
letter-spacing: 0.02em;
color: var(--st-muted);
}
.admin-logout {
width: 32px;
height: 32px;
display: grid;
place-items: center;
border: 0;
border-radius: 8px;
background: transparent;
color: var(--st-muted);
cursor: pointer;
flex-shrink: 0;
}
.admin-logout:hover { color: var(--st-text); background: var(--st-hover); }
/* 概览页快捷入口网格(复用 .shortcut 卡片) */
.admin-tip {
margin-bottom: 0;
.admin-app .topbar {
height: 116px;
min-height: 116px;
padding: 0 28px;
background: #fff;
border-bottom: 1px solid rgba(27, 32, 40, 0.08);
}
.admin-shortcut-grid {
.admin-crumb {
display: flex;
align-items: center;
gap: 10px;
font-size: 14px;
color: var(--st-muted);
}
.admin-crumb button {
border: 0;
background: transparent;
color: var(--st-muted);
font: inherit;
font-size: 14px;
cursor: pointer;
padding: 0;
}
.admin-crumb button:hover { color: var(--st-text); }
.admin-crumb span {
color: var(--st-text);
font-weight: 500;
}
.admin-crumb span::before {
content: "/";
margin-right: 10px;
color: var(--st-muted);
font-weight: 400;
}
.admin-mode {
display: inline-flex;
align-items: center;
height: 32px;
padding: 0 12px;
border-radius: 999px;
background: rgba(0, 47, 167, 0.08);
color: var(--klein);
font-size: 12px;
font-weight: 600;
}
.admin-page {
width: 100%;
max-width: none;
box-sizing: border-box;
margin: -24px -28px -60px;
padding: 52px clamp(40px, 3.2vw, 68px) 48px;
}
.admin-page .page-head {
margin-bottom: 28px;
}
.admin-page .page-head h1 {
margin: 0;
font-size: 32px;
line-height: 1.2;
letter-spacing: -.02em;
font-weight: 600;
color: var(--accent-black);
}
.admin-page .page-head .sub,
.admin-page .page-head p {
margin: 10px 0 0;
font-size: 15px;
color: var(--st-muted);
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.admin-page .page-head .sub .mono {
color: var(--st-muted);
letter-spacing: 0;
}
.admin-overview {
width: min(1220px, 100%);
margin: 0;
}
.admin-welcome {
width: 100%;
margin-bottom: 22px;
}
.admin-welcome h1 {
margin: 0 0 8px;
font-size: 28px;
line-height: 1.2;
font-weight: 600;
letter-spacing: -.02em;
color: var(--accent-black);
}
.admin-welcome p {
margin: 0;
color: #363a41;
font-size: 14px;
}
.admin-groups {
width: 100%;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
gap: 14px;
margin-top: 24px;
grid-template-columns: 1fr 1fr 1fr;
gap: 22px 18px;
align-items: start;
}
.admin-shortcut-text {
.admin-col {
display: grid;
gap: 18px;
align-content: start;
}
.admin-group-block { display: grid; gap: 8px; }
.admin-group-label {
display: flex;
align-items: baseline;
gap: 8px;
padding-left: 2px;
}
.admin-group-label strong {
font-size: 13px;
font-weight: 600;
color: var(--accent-black);
}
.admin-group-label span {
color: var(--st-muted);
font-size: 12px;
line-height: 1.4;
}
.admin-entry-pair {
display: grid;
gap: 8px;
}
.admin-entry {
width: 100%;
height: 68px;
display: grid;
grid-template-columns: 24px minmax(0, 1fr) 16px;
align-items: center;
gap: 10px;
padding: 0 14px;
border: 1px solid rgba(203, 208, 216, 0.72);
border-radius: 10px;
background: rgba(249, 250, 252, 0.9);
color: #263247;
font: inherit;
text-align: left;
cursor: pointer;
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.96),
0 6px 16px rgba(20, 27, 38, 0.07);
transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}
.admin-entry:hover {
transform: translateY(-2px);
background: rgba(252, 253, 254, 0.94);
box-shadow:
inset 0 1px 0 #fff,
0 10px 22px rgba(42, 53, 74, 0.12);
}
.admin-entry svg {
display: block;
width: 20px;
height: 20px;
flex-shrink: 0;
color: var(--klein);
}
.admin-entry svg:last-child { color: #263247; width: 16px; height: 16px; }
.admin-entry-copy {
display: flex;
flex-direction: column;
gap: 2px;
min-width: 0;
text-align: left;
}
.admin-entry-copy strong {
font-size: 14px;
font-weight: 600;
letter-spacing: -.01em;
}
.admin-entry-copy small {
overflow: hidden;
color: #727b8a;
font-size: 11px;
font-weight: 400;
line-height: 1.35;
text-overflow: ellipsis;
white-space: nowrap;
}
/* 顶栏面包屑链接可点 */
.admin-app .topbar .crumbs a {
cursor: pointer;
}
/* ── 邀请码页:筛选条 + 表格 + 弹窗 ── */
.admin-toolbar {
display: flex;
align-items: center;
gap: 12px;
margin: 4px 0 16px;
}
/* 类型筛选 = 模式切换段控(模式切换用黑激活,不抢主橙) */
.tabs-sub {
display: inline-flex;
gap: 2px;
background: var(--surface);
border: 1px solid var(--border-faint);
border-radius: var(--r-md);
background: var(--st-wash);
border: 1px solid var(--st-line);
border-radius: 8px;
padding: 3px;
}
.tab-sub {
height: 28px;
height: 32px;
padding: 0 14px;
border: 0;
background: transparent;
border-radius: 6px;
font-size: 12.5px;
color: var(--black-alpha-56);
font-size: 13px;
font-weight: 500;
color: var(--st-muted);
cursor: pointer;
transition: background var(--t-base), color var(--t-base);
transition: background 160ms ease, color 160ms ease;
}
.tab-sub:hover { background: var(--black-alpha-4); color: var(--accent-black); }
.tab-sub.active { background: var(--accent-black); color: var(--accent-white); }
.tab-sub:hover { background: var(--st-hover); color: var(--st-text); }
.tab-sub.active { background: var(--st-black); color: #fff; }
.admin-search { width: 220px; margin-left: auto; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; }
.admin-page table.t.admin-table {
background: #fff;
border-color: var(--st-line);
border-radius: 8px;
}
.admin-page table.t.admin-table thead th {
background: var(--st-wash);
border-bottom-color: var(--st-line);
text-transform: none;
letter-spacing: 0;
font-family: inherit;
font-size: 12px;
color: var(--st-muted);
}
.admin-table .admin-code { font-size: 12.5px; color: var(--accent-black); letter-spacing: 0.02em; }
.admin-table .col-time { color: var(--black-alpha-56); font-size: 12px; }
.admin-table .col-time { color: var(--st-muted); font-size: 12px; }
.admin-table .col-actions { text-align: right; white-space: nowrap; }
.admin-table td .muted { color: var(--black-alpha-32); }
.admin-table .btn-ghost.danger:hover { color: var(--accent-crimson); }
@@ -130,8 +409,6 @@
margin: 0 0 16px;
}
/* ── 团队 / 用户管理 ── */
.admin-search { width: 220px; margin-left: auto; }
.modal.modal-wide { max-width: 640px; }
.admin-detail-meta {
display: grid;
@@ -140,18 +417,19 @@
margin-bottom: 20px;
}
.admin-detail-meta > div { display: flex; flex-direction: column; gap: 3px; }
.admin-detail-meta .k { font-size: 11.5px; color: var(--black-alpha-48); font-family: var(--font-mono); }
.admin-detail-meta .k { font-size: 11.5px; color: var(--st-muted); }
.admin-detail-meta .v { font-size: 14px; color: var(--accent-black); }
.admin-detail-subhead { font-size: 13px; font-weight: 500; color: var(--accent-black); margin: 8px 0 10px; }
.admin-inline-pill { margin-left: 8px; }
/* ── 质量词:按 stage 分组 + 编辑模式 chip ── */
.qw-stages { display: flex; flex-direction: column; gap: 16px; }
.qw-stage { padding: 18px 20px; }
.qw-stage {
padding: 18px 20px;
}
.qw-stage-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.qw-stage-title { font-size: 14px; font-weight: 500; color: var(--accent-black); }
.qw-stage-hint { font-size: 11px; color: var(--black-alpha-48); }
.qw-empty { font-size: 12px; color: var(--black-alpha-48); }
.qw-stage-hint { font-size: 11px; color: var(--st-muted); }
.qw-empty { font-size: 12px; color: var(--st-muted); }
.qw-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.qw-chip {
display: inline-flex;
@@ -159,13 +437,13 @@
gap: 6px;
height: 28px;
padding: 0 12px;
background: var(--heat-12);
border: 1px solid var(--heat-20);
background: rgba(0, 47, 167, 0.07);
border: 1px solid rgba(0, 47, 167, 0.16);
border-radius: var(--r-pill);
font-size: 12.5px;
color: var(--heat);
color: var(--klein);
}
.qw-chip.editing { background: var(--surface); border-color: var(--border-faint); padding: 0 6px 0 10px; }
.qw-chip.editing { background: var(--surface); border-color: var(--st-line); padding: 0 6px 0 10px; }
.qw-chip-input {
border: 0;
background: transparent;
@@ -190,13 +468,12 @@
height: 18px;
border: 0;
background: transparent;
color: var(--black-alpha-48);
color: var(--st-muted);
cursor: pointer;
border-radius: 50%;
}
.qw-del:hover { color: var(--accent-crimson); background: var(--black-alpha-4); }
/* ── 资产审核队列 ── */
.admin-table .col-check { width: 36px; text-align: center; }
.admin-thumb-btn {
display: block;
@@ -210,7 +487,7 @@
}
.admin-thumb-btn:focus-visible {
outline: none;
box-shadow: 0 0 0 2px var(--background-base), 0 0 0 4px var(--heat-40);
box-shadow: 0 0 0 2px var(--background-base), 0 0 0 4px rgba(0, 47, 167, 0.28);
}
.admin-thumb {
width: 40px;
@@ -218,7 +495,7 @@
border-radius: var(--r-md);
object-fit: cover;
background: var(--background-lighter);
border: 1px solid var(--border-faint);
border: 1px solid var(--st-line);
display: block;
pointer-events: none;
}
@@ -235,8 +512,6 @@
font-size: 11px;
cursor: help;
}
/* 独立类名,避开商品库/项目页全局黑底 `.bulk-bar button`(白字透明边),
否则管理台白底浮条上按钮文字不可见,只剩一条扁边框。 */
.admin-bulk-bar {
position: fixed;
left: 50%;
@@ -247,9 +522,8 @@
gap: 12px;
padding: 10px 16px;
background: var(--surface-raised);
border: 1px solid var(--border-faint);
border: 1px solid var(--st-line);
border-radius: var(--r-md);
box-shadow: var(--shadow-floating);
z-index: 50;
}
.admin-bulk-count {
@@ -259,12 +533,11 @@
white-space: nowrap;
}
/* ── 任务监控 ── */
.admin-anomaly-chip { height: 28px; padding: 0 14px; font-size: 12.5px; cursor: pointer; }
.admin-drawer { width: 620px; max-width: 92vw; }
.admin-json {
background: var(--background-lighter);
border: 1px solid var(--border-faint);
background: var(--st-wash);
border: 1px solid var(--st-line);
border-radius: var(--r-md);
padding: 12px 14px;
margin: 0 0 16px;
@@ -281,22 +554,20 @@
.admin-attempt-list {
margin: 0 0 20px;
background: var(--surface);
border: 1px solid var(--border-muted);
border: 1px solid var(--st-line);
border-radius: var(--r-md);
overflow: hidden;
}
.admin-attempt {
padding: 14px 16px;
}
.admin-attempt + .admin-attempt { border-top: 1px solid var(--border-faint); }
.admin-attempt { padding: 14px 16px; }
.admin-attempt + .admin-attempt { border-top: 1px solid var(--st-line); }
.admin-attempt-head {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 8px;
}
.admin-attempt-seq { color: var(--black-alpha-48); font-size: 11px; }
.admin-attempt-kind { margin-left: auto; color: var(--black-alpha-56); font-size: 11px; }
.admin-attempt-seq { color: var(--st-muted); font-size: 11px; }
.admin-attempt-kind { margin-left: auto; color: var(--st-muted); font-size: 11px; }
.admin-attempt-model {
display: flex;
align-items: baseline;
@@ -312,7 +583,7 @@
flex-wrap: wrap;
gap: 4px 14px;
margin-top: 6px;
color: var(--black-alpha-48);
color: var(--st-muted);
font-size: 11px;
}
.admin-attempt-error {
@@ -334,7 +605,6 @@
.admin-attempt-kind { width: 100%; margin-left: 0; }
}
/* ── 计费 / 额度策略 ── */
.admin-switch-row {
display: flex;
align-items: center;
@@ -345,9 +615,8 @@
user-select: none;
margin-top: 4px;
}
.admin-switch-row input { width: 14px; height: 14px; accent-color: var(--heat); }
.admin-switch-row input { width: 14px; height: 14px; accent-color: var(--klein); }
/* ── 治理:数据体检卡 + 项目监控 ── */
.gov-integrity {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
@@ -359,32 +628,69 @@
flex-direction: column;
gap: 4px;
padding: 16px 18px;
background: var(--surface);
border: 1px solid var(--border-faint);
border-radius: var(--r-md);
background: #fff;
border: 1px solid var(--st-line);
border-radius: 8px;
}
.gov-card.warn { border-color: var(--heat-20); background: var(--heat-12); }
.gov-card.warn { border-color: rgba(0, 47, 167, 0.22); background: rgba(0, 47, 167, 0.06); }
.gov-count { font-size: 28px; font-weight: 500; color: var(--accent-black); font-variant-numeric: tabular-nums; line-height: 1.1; }
.gov-card.warn .gov-count { color: var(--heat); }
.gov-label { font-size: 12px; color: var(--black-alpha-56); }
.gov-total { margin-left: auto; font-size: 12px; color: var(--black-alpha-48); }
.gov-card.warn .gov-count { color: var(--klein); }
.gov-label { font-size: 12px; color: var(--st-muted); }
.gov-total { margin-left: auto; font-size: 12px; color: var(--st-muted); }
/* 提示词模板页(仅 token,8px 圆角,单橙 accent) */
.pt-list { display: flex; flex-direction: column; gap: 14px; }
.pt-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.pt-card {
padding: 16px 18px;
display: flex;
flex-direction: column;
gap: 12px;
}
.pt-card.pt-off { opacity: .6; }
.pt-head { display: flex; align-items: center; gap: 10px; }
.pt-title { font-size: 14px; font-weight: 600; color: var(--accent-black); }
.pt-key { font-size: 11.5px; color: var(--black-alpha-40); }
.pt-key { font-size: 11.5px; color: var(--st-muted); }
.pt-head .spacer { flex: 1; }
.pt-enabled { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--black-alpha-56); cursor: pointer; }
.pt-vars { font-size: 11.5px; color: var(--black-alpha-48); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pt-vars code { background: var(--heat-12); color: var(--heat); border-radius: var(--r-sm); padding: 1px 6px; }
.pt-vars-hint { color: var(--black-alpha-40); }
.pt-textarea { width: 100%; box-sizing: border-box; background: var(--background-base); border: 1px solid var(--border-faint); border-radius: var(--r-sm); padding: 10px 12px; font-size: 13px; line-height: 1.6; color: var(--accent-black); font-family: var(--font-mono); resize: vertical; outline: none; transition: border-color var(--t-base), box-shadow var(--t-base); }
.pt-textarea:focus { border-color: var(--heat); box-shadow: 0 0 0 3px var(--heat-12); }
.pt-enabled { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--st-muted); cursor: pointer; }
.pt-vars { font-size: 11.5px; color: var(--st-muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pt-vars code {
background: rgba(0, 47, 167, 0.08);
color: var(--klein);
border-radius: var(--r-sm);
padding: 1px 6px;
}
.pt-vars-hint { color: var(--st-muted); }
.pt-textarea {
width: 100%;
box-sizing: border-box;
background: var(--st-wash);
border: 1px solid var(--st-line);
border-radius: var(--r-sm);
padding: 10px 12px;
font-size: 13px;
line-height: 1.6;
color: var(--accent-black);
font-family: var(--font-mono);
resize: vertical;
outline: none;
}
.pt-textarea:focus { border-color: var(--klein); box-shadow: 0 0 0 3px rgba(0, 47, 167, 0.12); }
.pt-foot { display: flex; align-items: center; gap: 8px; }
.pt-ratio-label { font-size: 11.5px; color: var(--black-alpha-48); }
.pt-ratio-label { font-size: 11.5px; color: var(--st-muted); }
.pt-ratios { display: inline-flex; gap: 6px; }
.pt-ratio-na { font-size: 12px; color: var(--black-alpha-40); }
.pt-ratio-na { font-size: 12px; color: var(--st-muted); }
.pt-foot .spacer { flex: 1; }
.admin-page .card-hard {
background: #fff;
border-color: var(--st-line);
}
.admin-page .empty-state {
padding: 56px 24px;
background: var(--st-wash);
border: 1px dashed var(--st-line);
}
@media (max-width: 1100px) {
.admin-page { margin: -28px -24px -48px; padding: 28px 24px 40px; }
.admin-groups { grid-template-columns: 1fr; }
}
+131 -88
View File
@@ -1,6 +1,8 @@
import { useEffect, useState } from "react";
import { ArrowLeft, ArrowRight, LogOut } from "lucide-react";
import { IconKitSvg } from "../../components/IconKitSvg";
import { CornerMarks, Decorations, ToastLike } from "../../components/app-shell";
import { ConfirmModal } from "../../components/overlays";
import type { Team, User } from "../../types";
import type { NavigateFn } from "../route-config";
import { AdminLedgersPage, AdminQuotaPage } from "./admin-billing";
@@ -15,8 +17,8 @@ import { AdminTeamsPage, AdminUsersPage } from "./admin-teams-users";
export type AdminNotify = (type: "success" | "error" | "info", text: string) => void;
// 平台超管后台 · 分阶段上线。section slug 与 URL /admin/<slug> 对应("" = 概览)。
// 视觉一律复用 restraint 外壳类(.app/.sidebar/.topbar/.content/.nav-section),只加极少 admin 专属样式
// 平台超管后台 · section slug 与 URL /admin/<slug> 对应("" = 概览)。
// 外壳对齐影擎侧栏 / 顶栏,页面样式收敛在 admin-page.css
export type AdminSection = {
slug: string;
label: string;
@@ -41,7 +43,29 @@ export const ADMIN_SECTIONS: AdminSection[] = [
{ slug: "governance", label: "治理", icon: "sliders", group: "系统", phase: 9 }
];
const SECTION_GROUPS = ["概览", "团队 · 用户", "内容", "生成", "财务", "系统"];
const SECTION_GROUPS = ["团队 · 用户", "内容", "生成", "财务", "系统"];
const SECTION_BLURB: Record<string, string> = {
invites: "发放开团队码,开通新团队",
teams: "团队状态、成员与定价系数",
users: "停用账号、重置登录密码",
prompts: "生图 / 视频提示词模板",
quality: "各生成阶段的画质与风格词",
reviews: "人像资产送审与结果",
tasks: "生成任务、重试与异常",
providers: "模型供应商与可用模型",
billing: "积分流水与手动调额",
quota: "团队额度与消耗策略",
governance: "数据体检与项目监控"
};
const GROUP_HINT: Record<string, string> = {
"团队 · 用户": "邀请开通、团队状态与账号",
"内容": "提示词、质量词与人像审核",
"生成": "任务队列与模型供应商",
"财务": "积分流水与额度策略",
"系统": "数据体检与项目监控"
};
type AdminAppProps = {
section: string;
@@ -55,6 +79,7 @@ type AdminAppProps = {
export function AdminApp({ section, user, team, navigateAdmin, navigate, logout }: AdminAppProps) {
const active = ADMIN_SECTIONS.find((s) => s.slug === section) || ADMIN_SECTIONS[0];
const [toast, setToast] = useState<{ type: "success" | "error" | "info"; text: string } | null>(null);
const [logoutOpen, setLogoutOpen] = useState(false);
const notify: AdminNotify = (type, text) => setToast({ type, text });
// 进后台任一页都滚到顶,行为与主壳 navigate 一致
@@ -85,86 +110,86 @@ export function AdminApp({ section, user, team, navigateAdmin, navigate, logout
<span className="brand-clip"><img className="brand-logo" src="/assets/yz/logo-horizontal.png" alt="影擎" /></span>
</a>
</div>
<div className="admin-badge mono">[ PLATFORM ADMIN ]</div>
{SECTION_GROUPS.map((group) => {
const items = ADMIN_SECTIONS.filter((s) => s.group === group);
if (items.length === 0) return null;
return (
<div key={group} className="admin-nav-group">
<div className="nav-section">{group}</div>
<nav>
{items.map((item) => (
<a
key={item.slug || "overview"}
href={item.slug ? `/admin/${item.slug}` : "/admin"}
className={active.slug === item.slug ? "active" : ""}
title={item.label}
aria-label={item.label}
onClick={(event) => {
event.preventDefault();
navigateAdmin(item.slug);
}}
>
<IconKitSvg name={item.icon} />
<span>{item.label}</span>
</a>
))}
</nav>
</div>
);
})}
<div className="aside-foot admin-foot">
{team && (
<div className="nav-panel">
<div className="admin-rail">
<p className="admin-rail-mark"></p>
<button
type="button"
className="btn btn-ghost btn-sm admin-back"
onClick={() => navigate("dashboard")}
className={`admin-link${active.slug === "" ? " active" : ""}`}
onClick={() => navigateAdmin("")}
>
<IconKitSvg name="chevronLeft" size={14} />
<IconKitSvg name="dashboard" />
<span></span>
</button>
)}
<div className="admin-user">
<div className="av">{(user.username || "A").slice(0, 1).toUpperCase()}</div>
<div className="admin-user-meta">
<span className="nm">{user.username}</span>
<span className="rl mono"></span>
{SECTION_GROUPS.map((group) => {
const items = ADMIN_SECTIONS.filter((s) => s.group === group);
if (items.length === 0) return null;
return (
<div key={group} className="admin-nav-group">
<div className="admin-group">{group}</div>
{items.map((item) => (
<button
key={item.slug}
type="button"
className={`admin-link${active.slug === item.slug ? " active" : ""}`}
onClick={() => navigateAdmin(item.slug)}
>
<IconKitSvg name={item.icon} />
<span>{item.label}</span>
</button>
))}
</div>
);
})}
</div>
<div className="admin-foot">
{team && (
<button type="button" className="admin-back" onClick={() => navigate("dashboard")}>
<ArrowLeft size={16} strokeWidth={1.8} />
</button>
)}
<div className="admin-user">
<div className="av">{(user.username || "A").slice(0, 1).toUpperCase()}</div>
<div className="admin-user-meta">
<span className="nm">{user.username}</span>
<span className="rl"></span>
</div>
<button type="button" className="admin-logout" title="退出登录" aria-label="退出登录" onClick={() => setLogoutOpen(true)}>
<LogOut size={16} strokeWidth={1.8} />
</button>
</div>
<button type="button" className="icon-btn admin-logout" title="退出登录" aria-label="退出登录" onClick={logout}>
<IconKitSvg name="logOut" size={16} />
</button>
</div>
</div>
</aside>
<main>
<Decorations />
<header className="topbar">
<div className="crumbs">
<a
href="/admin"
onClick={(event) => {
event.preventDefault();
navigateAdmin("");
}}
>
</a>
{active.slug && (
<>
<span className="sep">/</span>
<span className="here">{active.label}</span>
</>
)}
<div className="admin-crumb">
<button type="button" onClick={() => navigateAdmin("")}></button>
{active.slug ? <span>{active.label}</span> : null}
</div>
<div className="right">
<span className="pill info"><span className="dot" /></span>
<span className="admin-mode"></span>
</div>
</header>
<div className="content" id="page-content">
<CornerMarks />
{toast && <ToastLike notice={toast} />}
<AdminSectionView section={active} navigateAdmin={navigateAdmin} notify={notify} />
<div className="admin-page">
<AdminSectionView section={active} navigateAdmin={navigateAdmin} notify={notify} />
</div>
</div>
</main>
<ConfirmModal
open={logoutOpen}
title="退出登录"
icon={<LogOut size={16} />}
detail="确定退出当前超管账号?退出后需要重新登录才能进入平台后台。"
confirmText="确认退出"
onCancel={() => setLogoutOpen(false)}
onConfirm={() => { setLogoutOpen(false); logout(); }}
/>
</div>
);
}
@@ -210,34 +235,54 @@ function AdminSectionView({ section, navigateAdmin, notify }: { section: AdminSe
return <AdminPlaceholder section={section} />;
}
function AdminOverview({ navigateAdmin }: { navigateAdmin: (s: string) => void }) {
const shortcuts = ADMIN_SECTIONS.filter((s) => s.slug);
const OVERVIEW_COLS = [
["团队 · 用户", "财务"],
["内容", "系统"],
["生成"]
];
function OverviewGroup({ group, navigateAdmin }: { group: string; navigateAdmin: (s: string) => void }) {
const items = ADMIN_SECTIONS.filter((s) => s.group === group);
if (items.length === 0) return null;
return (
<>
<div className="page-head">
<div>
<h1></h1>
<div className="sub">
<span className="mono"></span> ·
</div>
</div>
<section className="admin-group-block">
<div className="admin-group-label">
<strong>{group}</strong>
<span>{GROUP_HINT[group]}</span>
</div>
<div className="tip admin-tip">
<strong></strong>
线 ,线
</div>
<div className="admin-shortcut-grid">
{shortcuts.map((s) => (
<button key={s.slug} type="button" className="shortcut" onClick={() => navigateAdmin(s.slug)}>
<span className="ic"><IconKitSvg name={s.icon} size={16} /></span>
<span className="admin-shortcut-text">
<span className="t">{s.label}</span>
<span className="d">{s.slug}</span>
<div className="admin-entry-pair">
{items.map((s) => (
<button key={s.slug} className="admin-entry" type="button" onClick={() => navigateAdmin(s.slug)}>
<IconKitSvg name={s.icon} size={22} strokeWidth={1.8} />
<span className="admin-entry-copy">
<strong>{s.label}</strong>
<small>{SECTION_BLURB[s.slug] || s.slug}</small>
</span>
<ArrowRight size={18} strokeWidth={1.8} />
</button>
))}
</div>
</>
</section>
);
}
function AdminOverview({ navigateAdmin }: { navigateAdmin: (s: string) => void }) {
return (
<div className="admin-overview">
<section className="admin-welcome">
<h1></h1>
<p></p>
</section>
<div className="admin-groups">
{OVERVIEW_COLS.map((col) => (
<div className="admin-col" key={col[0]}>
{col.map((group) => (
<OverviewGroup key={group} group={group} navigateAdmin={navigateAdmin} />
))}
</div>
))}
</div>
</div>
);
}
@@ -247,9 +292,7 @@ function AdminPlaceholder({ section }: { section: AdminSection }) {
<div className="page-head">
<div>
<h1>{section.label}</h1>
<div className="sub">
<span className="mono">admin · {section.slug}</span>
</div>
<p>admin · {section.slug}</p>
</div>
</div>
<div className="empty-state show">