feat(portal): 门户改造成工作台并统一全局视觉
- Dashboard: 从平铺按钮列表改为「左侧动态导航 + 右侧概览面板」工作台
· 菜单仍全动态来自 currentUser().menuList,前端不硬编码任何菜单项
· 侧栏按目录分组,带图标块/选中态/实时计数徽标
· 概览面板全部取自真实接口:Engine/Info、Flow/FlowRun/List、
Device/List、ChainBlock/List;任一接口失败只显示 —,不伪造计数
· 新增最近运行实例表格、TEE 节点与链上存证真源速览
- ui.ts: 补齐门户设计令牌(顶栏/侧栏/统计卡/面板/徽标/键值行)
- portal.css: hover 等伪类样式(内联 style 表达不了的部分)
- Login: 改为左品牌介绍 + 右登录卡,与门户同一视觉语言
- CrudPage: 头部加「← 门户」入口与面包屑路径,表格横向滚动不再裁切
- .env.example: 补齐真源配置项(control-plane/FISCO/两方会话)
This commit is contained in:
1 parent
eb75ab06a9
commit
7a63b2b0c6
6 files changed
+1049
-87
No files matched your search
@@ -4,3 +4,44 @@ PGLLITE_DIR=memory://
|
||||
# 迁 JNPF 前关掉自动建表:PG_SYNC=false
|
||||
PG_SYNC=true
|
||||
PORT=30000
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# ★ 真源配置(不配 = 退化成 mock,界面会显示「模拟数据」)
|
||||
# 两个兄弟模块走 ssw-mpc 真实接口:设备注册读 control-plane,链上存证读 outbox + FISCO 链
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# 设备注册真源:ssw-mpc control-plane 的 /nodes(当前在线清单,TTL 90s)
|
||||
MPC_CONTROL_PLANE_URL=http://192.168.1.102:3020
|
||||
# 控制面共享密钥:必须是**原文**(不是 hex)。默认从 <stateRoot>/cluster.secret 读;
|
||||
# 也可在这里给文件路径:MPC_HOSTD_SHARED_SECRET_FILE=/path/to/cluster.secret
|
||||
MPC_HOSTD_SHARED_SECRET_FILE=../ssw-mpc/.mpc-state/cluster.secret
|
||||
|
||||
# 链上存证真源:FISCO 国密链 + ssw-mpc outbox
|
||||
MPC_FISCO_CHAIN_CONFIG=../ssw-mpc/tools/fisco-realnode/example.chain.json
|
||||
MPC_FISCO_OUTBOX=.mpc-state/chain-outbox.txt
|
||||
MPC_FISCO_NODE=node0
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# ★ 两方会话算子(prep.intersect / model.lr.train 走真密态时必需)
|
||||
# 对端不在场时后端会自动降级 partial + 写明原因,不会硬失败
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# 参与方(≥2 个),会话算子按此下发 --sites
|
||||
MPC_SITES=alice,bob
|
||||
# 共享主种子:必须是 64 位十六进制(32 字节),各方一致。
|
||||
# 不给 ⇒ 各方各自随机 ⇒ PSI 交集必空。
|
||||
MPC_SEED=
|
||||
# 连接参数:--listen 与 --connect 二选一(都给反而非法)
|
||||
MPC_SESSION_LISTEN=
|
||||
MPC_SESSION_CONNECT=
|
||||
# 训练超参:各方必须完全一致,否则报「open_batch 第 0 个值长度不一致」
|
||||
MPC_SESSION_EPOCHS=20
|
||||
MPC_SESSION_LR=0.1
|
||||
# 声明各方 agent 进程在场(1=在场)
|
||||
MPC_AGENT_PRESENT=
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 执行驱动:默认 simulation(纯本地);真实执行需 MPC_DRIVER=mpc + MPC_REAL_EXEC=1
|
||||
# ---------------------------------------------------------------------------
|
||||
MPC_DRIVER=simulation
|
||||
MPC_REAL_EXEC=0
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { wrap, card, btn, btnDanger, btnGhost, input, tableStyle, th, td } from '../views/ui';
|
||||
|
||||
export interface Field { key: string; label: string }
|
||||
@@ -38,6 +39,7 @@ export default function CrudPage({
|
||||
title, entity, columns, fields, api, readonly, filterKey, apiBase,
|
||||
sync, syncLabel, syncExtra, renderCell, banner,
|
||||
}: CrudPageProps) {
|
||||
const nav = useNavigate();
|
||||
const [rows, setRows] = useState<any[]>([]);
|
||||
const [editing, setEditing] = useState<any | null>(null);
|
||||
const [filter, setFilter] = useState('');
|
||||
@@ -83,19 +85,29 @@ export default function CrudPage({
|
||||
return (
|
||||
<div style={wrap}>
|
||||
<div style={card}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
|
||||
<h2 style={{ margin: 0 }}>{title}</h2>
|
||||
<span style={{ color: '#9aa7b5', fontSize: 12 }}>/api/ssw/{apiBase || 'sswflow'}/{entity}</span>
|
||||
<button style={btnGhost} onClick={() => history.back()}>返回</button>
|
||||
<button style={btn} onClick={load}>刷新</button>
|
||||
{sync && (
|
||||
<button style={btn} onClick={doSync} disabled={busy}>
|
||||
{busy ? '同步中…' : (syncLabel || '从真源同步')}
|
||||
</button>
|
||||
)}
|
||||
{!readonly && (
|
||||
<button style={btn} onClick={() => setEditing({})}>新增</button>
|
||||
)}
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 12, flexWrap: 'wrap' }}>
|
||||
<button
|
||||
style={{ ...btnGhost, padding: '5px 10px', fontSize: 12 }}
|
||||
onClick={() => nav('/')}
|
||||
title="返回工作台"
|
||||
>
|
||||
← 门户
|
||||
</button>
|
||||
<h2 style={{ margin: 0, fontSize: 17, fontWeight: 650 }}>{title}</h2>
|
||||
<span style={{ color: '#6b7a8c', fontSize: 11, fontFamily: 'ui-monospace, monospace' }}>
|
||||
/api/ssw/{apiBase || 'sswflow'}/{entity}
|
||||
</span>
|
||||
<div style={{ marginLeft: 'auto', display: 'flex', gap: 8 }}>
|
||||
<button style={btn} onClick={load}>刷新</button>
|
||||
{sync && (
|
||||
<button style={btn} onClick={doSync} disabled={busy}>
|
||||
{busy ? '同步中…' : (syncLabel || '从真源同步')}
|
||||
</button>
|
||||
)}
|
||||
{!readonly && (
|
||||
<button style={btn} onClick={() => setEditing({})}>新增</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{banner && <div style={{ marginTop: 12, fontSize: 12, color: '#9aa7b5', lineHeight: 1.7 }}>{banner}</div>}
|
||||
@@ -143,34 +155,38 @@ export default function CrudPage({
|
||||
</div>
|
||||
)}
|
||||
|
||||
<table style={tableStyle}>
|
||||
<thead>
|
||||
<tr>
|
||||
{columns.map((c) => <th key={c.key} style={th}>{c.label}</th>)}
|
||||
{!readonly && <th style={th}>操作</th>}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{shown.map((r) => (
|
||||
<tr key={r.id}>
|
||||
<div style={{ overflowX: 'auto', marginTop: 12 }}>
|
||||
<table style={{ ...tableStyle, marginTop: 0, minWidth: '100%', whiteSpace: 'nowrap' }}>
|
||||
<thead>
|
||||
<tr>
|
||||
{columns.map((c) => (
|
||||
<td key={c.key} style={td}>
|
||||
{renderCell ? renderCell(r, c.key) : format(r[c.key])}
|
||||
</td>
|
||||
<th key={c.key} style={{ ...th, whiteSpace: 'nowrap' }}>{c.label}</th>
|
||||
))}
|
||||
{!readonly && (
|
||||
<td style={td}>
|
||||
<button style={{ ...btnGhost, marginRight: 6 }} onClick={() => setEditing({ ...r })}>编辑</button>
|
||||
<button style={btnDanger} onClick={() => remove(r.id)}>删除</button>
|
||||
</td>
|
||||
)}
|
||||
{!readonly && <th style={{ ...th, whiteSpace: 'nowrap' }}>操作</th>}
|
||||
</tr>
|
||||
))}
|
||||
{shown.length === 0 && (
|
||||
<tr><td style={td} colSpan={columns.length + (readonly ? 0 : 1)}>暂无数据</td></tr>
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
</thead>
|
||||
<tbody>
|
||||
{shown.map((r) => (
|
||||
<tr key={r.id}>
|
||||
{columns.map((c) => (
|
||||
<td key={c.key} style={td}>
|
||||
{renderCell ? renderCell(r, c.key) : format(r[c.key])}
|
||||
</td>
|
||||
))}
|
||||
{!readonly && (
|
||||
<td style={td}>
|
||||
<button style={{ ...btnGhost, marginRight: 6 }} onClick={() => setEditing({ ...r })}>编辑</button>
|
||||
<button style={btnDanger} onClick={() => remove(r.id)}>删除</button>
|
||||
</td>
|
||||
)}
|
||||
</tr>
|
||||
))}
|
||||
{shown.length === 0 && (
|
||||
<tr><td style={td} colSpan={columns.length + (readonly ? 0 : 1)}>暂无数据</td></tr>
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,8 +1,32 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { currentUser } from '../api/auth';
|
||||
import { clearToken } from '../api/request';
|
||||
import { wrap, card, btnGhost, btn } from './ui';
|
||||
import { listFlows, engineInfo } from '../api/flow';
|
||||
import { listFlowRuns } from '../api/flowrun';
|
||||
import { listDevices } from '../api/device';
|
||||
import { listChainBlocks } from '../api/chainblock';
|
||||
import {
|
||||
portal, topbar, brandMark, portalBody, sidebar, mainArea,
|
||||
navGroupTitle, navItem, navItemActive, navIcon, navBadge,
|
||||
pageTitle, pageSub, statGrid, statCard, statValue, statLabel,
|
||||
panel, panelTitle, panelSub, chip, dot, kvRow, kvKey, kvVal,
|
||||
tableStyle, th, td,
|
||||
} from './ui';
|
||||
import './portal.css';
|
||||
|
||||
/**
|
||||
* 门户(工作台)——
|
||||
*
|
||||
* ★ 菜单**仍然全动态**:分组与条目全部来自 `currentUser().menuList`,
|
||||
* 不在前端硬编码任何菜单项(加菜单只需改 seed + Route + controller 三处)。
|
||||
* 这里只负责「怎么摆得好看、并且把运行态信息摆出来」。
|
||||
*
|
||||
* ★ 概览面板的数据全部来自真实接口,不造假数:
|
||||
* 引擎/算子能力 ← Engine/Info;流程/运行 ← Flow/List、FlowRun/List;
|
||||
* TEE 节点 ← sswdevice/Device/List;链上存证 ← sswchain/ChainBlock/List。
|
||||
* 任一接口失败只显示「—」,不伪造计数。
|
||||
*/
|
||||
|
||||
interface MenuNode {
|
||||
id: string;
|
||||
@@ -13,10 +37,45 @@ interface MenuNode {
|
||||
children: MenuNode[];
|
||||
}
|
||||
|
||||
interface EngineInfo {
|
||||
driver?: string;
|
||||
engines?: string[];
|
||||
mpc?: {
|
||||
bin?: string;
|
||||
binSource?: string;
|
||||
binSourceLabel?: string;
|
||||
releaseTag?: string;
|
||||
sites?: string[];
|
||||
available?: boolean;
|
||||
detail?: string;
|
||||
};
|
||||
capabilities?: { key: string; crate: string; status: string; note?: string }[];
|
||||
}
|
||||
|
||||
/** 最近运行实例(门户只取最近若干条做速览,完整列表在「运行监控」页)。 */
|
||||
interface RunRow {
|
||||
id: string;
|
||||
flowName?: string;
|
||||
status?: string;
|
||||
operator?: string;
|
||||
startTime?: string;
|
||||
costMs?: number;
|
||||
}
|
||||
|
||||
export default function Dashboard() {
|
||||
const nav = useNavigate();
|
||||
const [menu, setMenu] = useState<MenuNode[]>([]);
|
||||
const [user, setUser] = useState<any>(null);
|
||||
const [engine, setEngine] = useState<EngineInfo | null>(null);
|
||||
const [stats, setStats] = useState<{
|
||||
flows?: number; runs?: number; running?: number; success?: number; failed?: number;
|
||||
devices?: number; online?: number; receipts?: number;
|
||||
}>({});
|
||||
const [recentRuns, setRecentRuns] = useState<RunRow[]>([]);
|
||||
const [nodes, setNodes] = useState<any[]>([]);
|
||||
const [receipts, setReceipts] = useState<any[]>([]);
|
||||
const [active, setActive] = useState<string>('');
|
||||
const [loadErr, setLoadErr] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
currentUser()
|
||||
@@ -27,6 +86,79 @@ export default function Dashboard() {
|
||||
.catch(() => {});
|
||||
}, []);
|
||||
|
||||
// 概览数据:各自独立失败,互不拖累(一个挂了不影响其它面板)
|
||||
useEffect(() => {
|
||||
let alive = true;
|
||||
const put = (fn: () => Promise<any>) =>
|
||||
fn().then((v) => {
|
||||
if (alive) return v;
|
||||
}).catch(() => null);
|
||||
|
||||
put(() => engineInfo()).then((d) => d && alive && setEngine(d));
|
||||
put(() => listFlows()).then((d) => d && alive && setStats((s) => ({ ...s, flows: (d || []).length })));
|
||||
put(() => listFlowRuns()).then((d) => {
|
||||
if (!d || !alive) return;
|
||||
const rows: any[] = d || [];
|
||||
setStats((s) => ({
|
||||
...s,
|
||||
runs: rows.length,
|
||||
running: rows.filter((r) => r.status === 'RUNNING').length,
|
||||
success: rows.filter((r) => r.status === 'SUCCESS').length,
|
||||
failed: rows.filter((r) => r.status === 'FAILED').length,
|
||||
}));
|
||||
// 速览最近 6 条(按开始时间倒序;后端默认按创建序返回,这里再排一次保险)
|
||||
setRecentRuns(
|
||||
[...rows]
|
||||
.sort((a, b) => String(b.startTime || '').localeCompare(String(a.startTime || '')))
|
||||
.slice(0, 6),
|
||||
);
|
||||
});
|
||||
put(() => listDevices()).then((d) => {
|
||||
if (!d || !alive) return;
|
||||
const rows: any[] = d || [];
|
||||
setStats((s) => ({
|
||||
...s,
|
||||
devices: rows.length,
|
||||
online: rows.filter((r) => r.online === 1).length,
|
||||
}));
|
||||
setNodes(rows);
|
||||
});
|
||||
put(() => listChainBlocks()).then((d) => {
|
||||
if (!d || !alive) return;
|
||||
const rows: any[] = d || [];
|
||||
setStats((s) => ({ ...s, receipts: rows.length }));
|
||||
setReceipts(rows);
|
||||
});
|
||||
|
||||
return () => {
|
||||
alive = false;
|
||||
};
|
||||
}, []);
|
||||
|
||||
/** 侧栏分组:顶级节点为目录(type 1);顶级就是页面的(type 2)归入「直接访问」。 */
|
||||
const groups = useMemo(() => {
|
||||
const dirs = menu.filter((m) => m.children && m.children.length > 0);
|
||||
const loose = menu.filter((m) => !m.children || m.children.length === 0);
|
||||
return { dirs, loose };
|
||||
}, [menu]);
|
||||
|
||||
/** 目录条目 → 展示名 + 计数(统计口径与概览面板一致)。 */
|
||||
function countOf(url?: string): number | undefined {
|
||||
if (!url) return undefined;
|
||||
if (url === 'sswflow/Flow') return stats.flows;
|
||||
if (url === 'sswflow/FlowRun') return stats.runs;
|
||||
if (url === 'sswdevice/Device') return stats.devices;
|
||||
if (url === 'sswchain/ChainBlock') return stats.receipts;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/** 两字缩写做图标占位(菜单里没有真实图标资源,用首字生成稳定的彩色块)。 */
|
||||
function initials(name: string): string {
|
||||
const s = (name || '').trim();
|
||||
if (!s) return '·';
|
||||
return /[一-龥]/.test(s) ? s.slice(0, 1) : s.slice(0, 2).toUpperCase();
|
||||
}
|
||||
|
||||
function goto(addr?: string) {
|
||||
if (addr) nav('/' + addr);
|
||||
}
|
||||
@@ -35,30 +167,405 @@ export default function Dashboard() {
|
||||
location.reload();
|
||||
}
|
||||
|
||||
const caps = engine?.capabilities || [];
|
||||
const capStat = caps.reduce((acc: Record<string, number>, c) => {
|
||||
acc[c.status] = (acc[c.status] || 0) + 1;
|
||||
return acc;
|
||||
}, {});
|
||||
const nativeCount = capStat.native || 0;
|
||||
const totalCaps = caps.length;
|
||||
|
||||
return (
|
||||
<div style={wrap}>
|
||||
<div style={card}>
|
||||
<h2>SSW MPC Flow · 隐私计算编排</h2>
|
||||
<div style={{ color: '#9aa7b5' }}>
|
||||
{user?.userAccount} {user?.isAdministrator ? '(管理员)' : ''}
|
||||
<div style={portal}>
|
||||
{/* ---------- 顶栏 ---------- */}
|
||||
<header style={topbar}>
|
||||
<div style={brandMark}>SS</div>
|
||||
<div style={{ minWidth: 0 }}>
|
||||
<div style={{ fontSize: 15, fontWeight: 650, letterSpacing: 0.2 }}>SSW MPC Flow</div>
|
||||
<div style={{ fontSize: 11, color: '#6b7a8c' }}>隐私计算编排平台</div>
|
||||
</div>
|
||||
<h3 style={{ marginTop: 16 }}>功能菜单</h3>
|
||||
{menu.map((node) => (
|
||||
<div key={node.id} style={{ marginBottom: 10 }}>
|
||||
<div style={{ color: '#9aa7b5', fontSize: 12 }}>{node.fullName}</div>
|
||||
<div style={{ display: 'flex', gap: 8, flexWrap: 'wrap', marginTop: 4 }}>
|
||||
{node.children.map((c) => (
|
||||
<button key={c.id} style={btnGhost} onClick={() => goto(c.urlAddress)}>
|
||||
{c.fullName}
|
||||
</button>
|
||||
<div style={{ marginLeft: 'auto', display: 'flex', alignItems: 'center', gap: 12 }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 7, fontSize: 12, color: '#9aa7b5' }}>
|
||||
<span style={{ ...dot, background: engine?.mpc?.available ? '#3fb950' : '#8b949e' }} />
|
||||
引擎 {engine?.driver || '—'}
|
||||
</div>
|
||||
<div style={{ fontSize: 12, color: '#9aa7b5' }}>
|
||||
{user?.userAccount || '—'}{user?.isAdministrator ? ' · 管理员' : ''}
|
||||
</div>
|
||||
<button
|
||||
onClick={logout}
|
||||
style={{
|
||||
padding: '5px 12px', borderRadius: 6, border: '1px solid #2a3340',
|
||||
background: 'transparent', color: '#9aa7b5', cursor: 'pointer', fontSize: 12,
|
||||
}}
|
||||
>
|
||||
退出
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div style={portalBody}>
|
||||
{/* ---------- 左侧导航 ---------- */}
|
||||
<nav style={sidebar}>
|
||||
{groups.loose.length > 0 && (
|
||||
<>
|
||||
<div style={navGroupTitle}>快捷入口</div>
|
||||
{groups.loose.map((m) => (
|
||||
<NavButton
|
||||
key={m.id}
|
||||
name={m.fullName}
|
||||
initials={initials(m.fullName)}
|
||||
active={active === m.id}
|
||||
count={countOf(m.urlAddress)}
|
||||
onClick={() => { setActive(m.id); goto(m.urlAddress); }}
|
||||
/>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
|
||||
{groups.dirs.map((d) => (
|
||||
<div key={d.id}>
|
||||
<div style={navGroupTitle}>{d.fullName}</div>
|
||||
{d.children.map((c) => (
|
||||
<NavButton
|
||||
key={c.id}
|
||||
name={c.fullName}
|
||||
initials={initials(c.fullName)}
|
||||
active={active === c.id}
|
||||
count={countOf(c.urlAddress)}
|
||||
onClick={() => { setActive(c.id); goto(c.urlAddress); }}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
))}
|
||||
</nav>
|
||||
|
||||
{/* ---------- 右侧概览 ---------- */}
|
||||
<main style={mainArea}>
|
||||
<h1 style={pageTitle}>工作台</h1>
|
||||
<p style={pageSub}>
|
||||
隐私计算编排、设备注册与链上存证的统一入口。左侧菜单按账号权限动态生成,
|
||||
右侧概览直接取自真实接口。
|
||||
</p>
|
||||
|
||||
{/* 统计卡片 */}
|
||||
<div style={statGrid}>
|
||||
<Stat label="流程定义" value={stats.flows} unit="个" accent="#58a6ff" />
|
||||
<Stat label="运行实例" value={stats.runs} unit="次" accent="#a371f7" />
|
||||
<Stat label="运行中" value={stats.running} unit="个" accent="#d29922" />
|
||||
<Stat label="TEE 节点" value={stats.online} unit={`/ ${stats.devices ?? '—'} 在线`} accent="#3fb950" />
|
||||
<Stat label="链上存证" value={stats.receipts} unit="条" accent="#39c5cf" />
|
||||
</div>
|
||||
))}
|
||||
<button style={{ ...btn, background: '#712b13', marginTop: 12 }} onClick={logout}>
|
||||
退出
|
||||
</button>
|
||||
|
||||
{/* 引擎与算子能力 */}
|
||||
<section style={panel}>
|
||||
<h2 style={panelTitle}>
|
||||
执行引擎
|
||||
<span style={panelSub}>ssw-mpc 运行态与算子能力分布</span>
|
||||
</h2>
|
||||
<div style={{ marginTop: 12 }}>
|
||||
<div style={kvRow}>
|
||||
<span style={kvKey}>当前驱动</span>
|
||||
<span style={kvVal}>
|
||||
{engine?.driver || '—'}
|
||||
{engine?.engines?.length ? (
|
||||
<span style={{ ...chip, marginLeft: 8 }}>可用:{engine.engines.join(' / ')}</span>
|
||||
) : null}
|
||||
</span>
|
||||
</div>
|
||||
<div style={kvRow}>
|
||||
<span style={kvKey}>mpc 二进制</span>
|
||||
<span style={kvVal}>
|
||||
{engine?.mpc?.available ? (
|
||||
<span style={{ ...dot, background: '#3fb950', display: 'inline-block', marginRight: 6 }} />
|
||||
) : (
|
||||
<span style={{ ...dot, background: '#8b949e', display: 'inline-block', marginRight: 6 }} />
|
||||
)}
|
||||
{engine?.mpc?.bin || '—'}
|
||||
{engine?.mpc?.releaseTag ? (
|
||||
<span style={{ ...chip, marginLeft: 8 }}>{engine.mpc.releaseTag}</span>
|
||||
) : null}
|
||||
</span>
|
||||
</div>
|
||||
<div style={kvRow}>
|
||||
<span style={kvKey}>来源 / 参与方</span>
|
||||
<span style={kvVal}>
|
||||
{engine?.mpc?.binSourceLabel || engine?.mpc?.binSource || '—'}
|
||||
{engine?.mpc?.sites?.length ? (
|
||||
<span style={{ ...chip, marginLeft: 8 }}>站点 {engine.mpc.sites.join(' / ')}</span>
|
||||
) : null}
|
||||
</span>
|
||||
</div>
|
||||
<div style={kvRow}>
|
||||
<span style={kvKey}>探测结果</span>
|
||||
<span style={kvVal}>{engine?.mpc?.detail || '—'}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{totalCaps > 0 && (
|
||||
<div style={{ marginTop: 14 }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 10, fontSize: 12, color: '#8b9aab' }}>
|
||||
<span>算子能力</span>
|
||||
<CapabilityBar stat={capStat} total={totalCaps} />
|
||||
<span style={{ color: '#c7d3e0' }}>
|
||||
原生 {nativeCount} / {totalCaps}
|
||||
</span>
|
||||
</div>
|
||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 6, marginTop: 10 }}>
|
||||
{Object.entries(capStat).map(([k, v]) => (
|
||||
<span key={k} style={chip}>
|
||||
<span style={{ ...dot, background: statusColor(k) }} />
|
||||
{statusLabel(k)} {v}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
|
||||
{/* 运行态 */}
|
||||
<section style={panel}>
|
||||
<h2 style={panelTitle}>
|
||||
运行状态
|
||||
<span style={panelSub}>最近运行实例的成功与失败分布</span>
|
||||
</h2>
|
||||
<div style={{ display: 'flex', gap: 10, marginTop: 12, flexWrap: 'wrap' }}>
|
||||
<RunStat label="成功" value={stats.success} color="#3fb950" />
|
||||
<RunStat label="运行中" value={stats.running} color="#d29922" />
|
||||
<RunStat label="失败" value={stats.failed} color="#f85149" />
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* 最近运行实例 */}
|
||||
<section style={panel}>
|
||||
<h2 style={panelTitle}>
|
||||
最近运行实例
|
||||
<span style={panelSub}>点「运行监控」看全部</span>
|
||||
</h2>
|
||||
{recentRuns.length === 0 ? (
|
||||
<Empty text="暂无运行实例" />
|
||||
) : (
|
||||
<table style={{ ...tableStyle, marginTop: 10 }}>
|
||||
<thead>
|
||||
<tr>
|
||||
<th style={th}>流程</th>
|
||||
<th style={th}>状态</th>
|
||||
<th style={th}>触发人</th>
|
||||
<th style={th}>开始时间</th>
|
||||
<th style={th}>耗时</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{recentRuns.map((r) => (
|
||||
<tr key={r.id}>
|
||||
<td style={td}>{r.flowName || '—'}</td>
|
||||
<td style={td}>
|
||||
<span style={{ ...chip, background: statusBg(r.status || '') }}>
|
||||
<span style={{ ...dot, background: statusColor(r.status || '') }} />
|
||||
{statusLabel(r.status || '')}
|
||||
</span>
|
||||
</td>
|
||||
<td style={td}>{r.operator || '—'}</td>
|
||||
<td style={td}>{fmtTime(r.startTime)}</td>
|
||||
<td style={td}>{r.costMs != null ? `${r.costMs} ms` : '—'}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
)}
|
||||
</section>
|
||||
|
||||
{/* 真源双模块速览 */}
|
||||
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(320px, 1fr))', gap: 16, marginTop: 16 }}>
|
||||
<section style={{ ...panel, marginTop: 0 }}>
|
||||
<h2 style={panelTitle}>
|
||||
TEE 节点
|
||||
<span style={panelSub}>control-plane 真源</span>
|
||||
</h2>
|
||||
{nodes.length === 0 ? (
|
||||
<Empty text="暂无节点(可到「设备注册」从控制面同步)" />
|
||||
) : (
|
||||
<div style={{ marginTop: 10 }}>
|
||||
{nodes.slice(0, 5).map((n) => (
|
||||
<div key={n.id} style={{ ...kvRow, alignItems: 'flex-start' }}>
|
||||
<span style={{ ...kvKey, width: 150, paddingTop: 1 }}>
|
||||
<span style={{ ...dot, background: n.online === 1 ? '#3fb950' : '#6e7681', display: 'inline-block', marginRight: 6 }} />
|
||||
{n.site || '—'}
|
||||
</span>
|
||||
<span style={{ ...kvVal, display: 'flex', alignItems: 'center', gap: 6, flexWrap: 'wrap' }}>
|
||||
<span>{n.host || '—'}</span>
|
||||
<span style={chip}>{n.platform || '—'}</span>
|
||||
{n.tcb != null ? <span style={chip}>TCB {n.tcb}</span> : null}
|
||||
{n.online === 1 ? null : <span style={chip}>离线</span>}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
|
||||
<section style={{ ...panel, marginTop: 0 }}>
|
||||
<h2 style={panelTitle}>
|
||||
链上存证
|
||||
<span style={panelSub}>outbox + 国密链</span>
|
||||
</h2>
|
||||
{receipts.length === 0 ? (
|
||||
<Empty text="暂无存证(可到「链上存证」同步)" />
|
||||
) : (
|
||||
<div style={{ marginTop: 10 }}>
|
||||
{receipts.slice(0, 5).map((r) => (
|
||||
<div key={r.id} style={{ ...kvRow, alignItems: 'flex-start' }}>
|
||||
<span style={{ ...kvKey, width: 150, paddingTop: 1 }}>{r.orderId || '—'}</span>
|
||||
<span style={{ ...kvVal, display: 'flex', alignItems: 'center', gap: 6, flexWrap: 'wrap' }}>
|
||||
<span>{r.decisionId || '—'}</span>
|
||||
<span style={chip}>
|
||||
{r.status === 0 ? '已出块' : r.status == null ? '待确认' : `失败(${r.status})`}
|
||||
</span>
|
||||
{r.blockNumber != null ? (
|
||||
<span style={chip}>块高 {r.blockNumber}</span>
|
||||
) : null}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
</div>
|
||||
|
||||
{loadErr && (
|
||||
<div style={{ marginTop: 14, fontSize: 12, color: '#ff8a80' }}>{loadErr}</div>
|
||||
)}
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------- 小组件 */
|
||||
|
||||
function NavButton({
|
||||
name, initials, active, count, onClick,
|
||||
}: {
|
||||
name: string; initials: string; active: boolean; count?: number; onClick: () => void;
|
||||
}) {
|
||||
return (
|
||||
<button
|
||||
className={`ssw-nav-item${active ? ' ssw-nav-active' : ''}`}
|
||||
style={{ ...navItem, ...(active ? navItemActive : {}) }}
|
||||
onClick={onClick}
|
||||
title={name}
|
||||
>
|
||||
<span style={navIcon}>{initials}</span>
|
||||
<span style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{name}</span>
|
||||
{count !== undefined && <span style={navBadge}>{count}</span>}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
function Stat({
|
||||
label, value, unit, accent,
|
||||
}: {
|
||||
label: string; value?: number; unit?: string; accent: string;
|
||||
}) {
|
||||
return (
|
||||
<div className="ssw-portal-stat" style={statCard}>
|
||||
<div style={{ ...statValue, color: accent }}>{value ?? '—'}</div>
|
||||
<div style={statLabel}>
|
||||
{label}
|
||||
{unit ? <span style={{ color: '#5f6d7d', marginLeft: 6 }}>{unit}</span> : null}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function RunStat({ label, value, color }: { label: string; value?: number; color: string }) {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
display: 'flex', alignItems: 'center', gap: 8, fontSize: 13,
|
||||
padding: '8px 14px', borderRadius: 8, background: '#1e252d', border: '1px solid #232c36',
|
||||
}}
|
||||
>
|
||||
<span style={{ ...dot, background: color }} />
|
||||
<span style={{ color: '#8b9aab' }}>{label}</span>
|
||||
<span style={{ fontWeight: 650, fontVariantNumeric: 'tabular-nums' }}>{value ?? '—'}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** 能力分布条:按状态分段,一眼看出原生占比。 */
|
||||
function CapabilityBar({ stat, total }: { stat: Record<string, number>; total: number }) {
|
||||
const order = ['native', 'local', 'partial', 'unsupported', 'sim'];
|
||||
const known = order.filter((k) => stat[k]);
|
||||
const rest = Object.keys(stat).filter((k) => !order.includes(k));
|
||||
const segs = [...known, ...rest];
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
display: 'flex', width: 190, height: 7, borderRadius: 4, overflow: 'hidden',
|
||||
background: '#222c37', flexShrink: 0,
|
||||
}}
|
||||
title={segs.map((k) => `${statusLabel(k)} ${stat[k]}`).join(' · ')}
|
||||
>
|
||||
{segs.map((k) => (
|
||||
<div
|
||||
key={k}
|
||||
style={{ width: `${(stat[k] / total) * 100}%`, background: statusColor(k) }}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function statusColor(k: string): string {
|
||||
switch (k) {
|
||||
case 'native': return '#3fb950';
|
||||
case 'local': return '#58a6ff';
|
||||
case 'partial': return '#d29922';
|
||||
case 'sim': return '#a371f7';
|
||||
// 运行状态
|
||||
case 'SUCCESS': return '#3fb950';
|
||||
case 'RUNNING': return '#d29922';
|
||||
case 'FAILED': return '#f85149';
|
||||
case 'CANCELLED': return '#6e7681';
|
||||
default: return '#6e7681';
|
||||
}
|
||||
}
|
||||
|
||||
function statusLabel(k: string): string {
|
||||
switch (k) {
|
||||
case 'native': return '原生';
|
||||
case 'local': return '本地';
|
||||
case 'partial': return '降级';
|
||||
case 'sim': return '模拟';
|
||||
case 'unsupported': return '不支持';
|
||||
// 运行状态
|
||||
case 'SUCCESS': return '成功';
|
||||
case 'RUNNING': return '运行中';
|
||||
case 'FAILED': return '失败';
|
||||
case 'CANCELLED': return '已取消';
|
||||
case 'PENDING': return '等待中';
|
||||
default: return k || '—';
|
||||
}
|
||||
}
|
||||
|
||||
/** 徽标底色(按状态色淡化,作为 chip 背景)。 */
|
||||
function statusBg(k: string): string {
|
||||
const c = statusColor(k);
|
||||
return `${c}1f`;
|
||||
}
|
||||
|
||||
/** ISO 时间戳 → 本地可读时间。 */
|
||||
function fmtTime(v?: string): string {
|
||||
if (!v) return '—';
|
||||
const d = new Date(v);
|
||||
if (Number.isNaN(d.getTime())) return v;
|
||||
return d.toLocaleString('zh-CN', { hour12: false });
|
||||
}
|
||||
|
||||
/** 空态提示。 */
|
||||
function Empty({ text }: { text: string }) {
|
||||
return (
|
||||
<div style={{ marginTop: 12, fontSize: 12, color: '#6b7a8c', padding: '14px 0' }}>{text}</div>
|
||||
);
|
||||
}
|
||||
@@ -4,16 +4,22 @@ import { login } from '../api/auth';
|
||||
import { setToken } from '../api/request';
|
||||
import { encryptPassword } from '../utils/cipher';
|
||||
|
||||
/**
|
||||
* 登录页 —— 与门户(Dashboard)同一套视觉语言:
|
||||
* 左侧品牌介绍 + 右侧登录卡。默认值即 admin / 123456,直接点登录即可。
|
||||
*/
|
||||
export default function Login() {
|
||||
const [account, setAccount] = useState('admin');
|
||||
const [password, setPassword] = useState('123456');
|
||||
const [err, setErr] = useState('');
|
||||
const [busy, setBusy] = useState(false);
|
||||
const nav = useNavigate();
|
||||
const loc = useLocation();
|
||||
|
||||
async function onSubmit(e: React.FormEvent) {
|
||||
e.preventDefault();
|
||||
setErr('');
|
||||
setBusy(true);
|
||||
try {
|
||||
const hex = encryptPassword(password);
|
||||
const res = await login(account, hex);
|
||||
@@ -22,60 +28,176 @@ export default function Login() {
|
||||
nav(next);
|
||||
} catch (e: any) {
|
||||
setErr(e.message || '登录失败');
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={wrap}>
|
||||
<form onSubmit={onSubmit} style={card}>
|
||||
<h2>SSW JNPF Lite · React</h2>
|
||||
<input value={account} onChange={(e) => setAccount(e.target.value)} placeholder="账号" style={input} />
|
||||
<input
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
type="password"
|
||||
placeholder="密码"
|
||||
style={input}
|
||||
/>
|
||||
{err && <div style={{ color: '#e24b4a' }}>{err}</div>}
|
||||
<button type="submit" style={btn}>
|
||||
登录
|
||||
</button>
|
||||
<div style={{ fontSize: 12, color: '#888' }}>默认 admin / 123456</div>
|
||||
</form>
|
||||
{/* 左:品牌介绍 */}
|
||||
<div style={hero}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
|
||||
<div style={brandMark}>SS</div>
|
||||
<div>
|
||||
<div style={{ fontSize: 17, fontWeight: 650 }}>SSW MPC Flow</div>
|
||||
<div style={{ fontSize: 12, color: '#6b7a8c' }}>隐私计算编排平台</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h1 style={{ fontSize: 30, lineHeight: 1.35, margin: '28px 0 0', fontWeight: 650 }}>
|
||||
隐私计算编排
|
||||
<br />
|
||||
设备注册与链上存证
|
||||
</h1>
|
||||
<p style={{ fontSize: 13, color: '#8b9aab', lineHeight: 1.85, marginTop: 16, maxWidth: 400 }}>
|
||||
以可视化画布编排多方隐私计算流程,直接对接 ssw-mpc 的真实执行底座 ——
|
||||
TEE 节点注册表取自 control-plane,存证写入国密链,全部真源可溯。
|
||||
</p>
|
||||
|
||||
<div style={{ display: 'flex', gap: 10, marginTop: 26, flexWrap: 'wrap' }}>
|
||||
{['可视化流程画布', 'TEE 节点真源', '国密链存证', '两方密态计算'].map((t) => (
|
||||
<span key={t} style={chip}>{t}</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 右:登录卡 */}
|
||||
<div style={rightSide}>
|
||||
<form onSubmit={onSubmit} style={card}>
|
||||
<h2 style={{ margin: 0, fontSize: 18, fontWeight: 650 }}>账号登录</h2>
|
||||
<div style={{ fontSize: 12, color: '#7d8ea1', marginTop: 6 }}>
|
||||
请使用平台分配的账号进入工作台
|
||||
</div>
|
||||
|
||||
<label style={label}>
|
||||
账号
|
||||
<input
|
||||
style={input}
|
||||
value={account}
|
||||
autoComplete="username"
|
||||
onChange={(e) => setAccount(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<label style={label}>
|
||||
密码
|
||||
<input
|
||||
style={input}
|
||||
type="password"
|
||||
autoComplete="current-password"
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
|
||||
{err && (
|
||||
<div style={{ color: '#ff8a80', fontSize: 12, padding: '8px 10px', background: '#3a1f22', borderRadius: 6 }}>
|
||||
{err}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<button type="submit" style={{ ...btn, width: '100%', marginTop: 4, padding: 10 }} disabled={busy}>
|
||||
{busy ? '登录中…' : '登 录'}
|
||||
</button>
|
||||
|
||||
<div style={{ fontSize: 11, color: '#5f6d7d', textAlign: 'center' }}>
|
||||
默认 admin / 123456
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------- 样式 */
|
||||
|
||||
const wrap: React.CSSProperties = {
|
||||
minHeight: '100vh',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
background: '#0f1419',
|
||||
color: '#eee',
|
||||
fontFamily: 'system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif',
|
||||
};
|
||||
const card: React.CSSProperties = {
|
||||
|
||||
const hero: React.CSSProperties = {
|
||||
flex: 1,
|
||||
padding: '56px 60px',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
gap: 12,
|
||||
padding: 24,
|
||||
background: '#1a1f26',
|
||||
borderRadius: 12,
|
||||
width: 300,
|
||||
justifyContent: 'center',
|
||||
background:
|
||||
'radial-gradient(900px 480px at 12% 18%, rgba(24,95,165,0.22), transparent 62%), #0f1419',
|
||||
minWidth: 0,
|
||||
};
|
||||
|
||||
const rightSide: React.CSSProperties = {
|
||||
flex: '0 0 46%',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
padding: 32,
|
||||
background: '#141a21',
|
||||
borderLeft: '1px solid #232c36',
|
||||
};
|
||||
|
||||
const card: React.CSSProperties = {
|
||||
width: '100%',
|
||||
maxWidth: 340,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
gap: 14,
|
||||
padding: 28,
|
||||
background: '#1a1f26',
|
||||
border: '1px solid #232c36',
|
||||
borderRadius: 14,
|
||||
};
|
||||
|
||||
const brandMark: React.CSSProperties = {
|
||||
width: 34,
|
||||
height: 34,
|
||||
borderRadius: 9,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
background: 'linear-gradient(135deg, #185fa5, #2b7fd4)',
|
||||
color: '#fff',
|
||||
fontWeight: 700,
|
||||
fontSize: 15,
|
||||
};
|
||||
|
||||
const label: React.CSSProperties = {
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
gap: 5,
|
||||
fontSize: 12,
|
||||
color: '#8b9aab',
|
||||
};
|
||||
|
||||
const input: React.CSSProperties = {
|
||||
padding: 8,
|
||||
borderRadius: 6,
|
||||
border: '1px solid #333',
|
||||
padding: '9px 11px',
|
||||
borderRadius: 7,
|
||||
border: '1px solid #2a3340',
|
||||
background: '#0f1419',
|
||||
color: '#eee',
|
||||
fontSize: 13,
|
||||
outline: 'none',
|
||||
};
|
||||
|
||||
const btn: React.CSSProperties = {
|
||||
padding: 10,
|
||||
borderRadius: 6,
|
||||
borderRadius: 7,
|
||||
border: 0,
|
||||
background: '#185fa5',
|
||||
color: '#fff',
|
||||
cursor: 'pointer',
|
||||
fontSize: 13,
|
||||
fontWeight: 600,
|
||||
};
|
||||
|
||||
const chip: React.CSSProperties = {
|
||||
fontSize: 11,
|
||||
padding: '4px 10px',
|
||||
borderRadius: 12,
|
||||
background: '#1c2a38',
|
||||
color: '#8fb6dd',
|
||||
border: '1px solid #24425e',
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
/* 门户(Dashboard)专用样式 —— 只放伪类/动画这类内联 style 表达不了的部分。
|
||||
主题令牌在 views/ui.ts,与既有页面共用。 */
|
||||
|
||||
.ssw-nav-item {
|
||||
transition: background 0.14s ease, color 0.14s ease;
|
||||
}
|
||||
.ssw-nav-item:hover {
|
||||
background: #1c242d;
|
||||
color: #fff;
|
||||
}
|
||||
.ssw-nav-item.ssw-nav-active:hover {
|
||||
background: #1b2b3d;
|
||||
color: #cfe3ff;
|
||||
}
|
||||
|
||||
.ssw-portal-stat {
|
||||
transition: border-color 0.14s ease, transform 0.14s ease;
|
||||
}
|
||||
.ssw-portal-stat:hover {
|
||||
border-color: #33404e;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
@@ -43,4 +43,258 @@ export const th: CSSProperties = {
|
||||
export const td: CSSProperties = {
|
||||
padding: '8px',
|
||||
borderBottom: '1px solid #1f2630',
|
||||
maxWidth: 320,
|
||||
overflow: 'hidden',
|
||||
textOverflow: 'ellipsis',
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* 门户(Dashboard)专用令牌
|
||||
* 主题与既有页面一致:底 #0f1419 / 卡 #1a1f26 / 主色 #185fa5 / 次要字 #9aa7b5
|
||||
* ------------------------------------------------------------------------- */
|
||||
|
||||
/** 门户整页骨架:左侧导航 + 右侧内容 */
|
||||
export const portal: CSSProperties = {
|
||||
minHeight: '100vh',
|
||||
background: '#0f1419',
|
||||
color: '#eee',
|
||||
fontFamily: 'system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
};
|
||||
|
||||
/** 顶部品牌栏 */
|
||||
export const topbar: CSSProperties = {
|
||||
height: 58,
|
||||
flex: '0 0 58px',
|
||||
padding: '0 20px',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: 14,
|
||||
background: '#141a21',
|
||||
borderBottom: '1px solid #232c36',
|
||||
};
|
||||
|
||||
/** 品牌方块(左侧色块 logo) */
|
||||
export const brandMark: CSSProperties = {
|
||||
width: 30,
|
||||
height: 30,
|
||||
borderRadius: 8,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
background: 'linear-gradient(135deg, #185fa5, #2b7fd4)',
|
||||
color: '#fff',
|
||||
fontWeight: 700,
|
||||
fontSize: 14,
|
||||
flexShrink: 0,
|
||||
};
|
||||
|
||||
/** 主体两栏 */
|
||||
export const portalBody: CSSProperties = {
|
||||
flex: 1,
|
||||
display: 'flex',
|
||||
minHeight: 0,
|
||||
};
|
||||
|
||||
/** 左侧导航栏 */
|
||||
export const sidebar: CSSProperties = {
|
||||
width: 244,
|
||||
flex: '0 0 244px',
|
||||
background: '#141a21',
|
||||
borderRight: '1px solid #232c36',
|
||||
padding: '16px 10px',
|
||||
overflowY: 'auto',
|
||||
};
|
||||
|
||||
/** 右侧内容区 */
|
||||
export const mainArea: CSSProperties = {
|
||||
flex: 1,
|
||||
padding: 24,
|
||||
overflowY: 'auto',
|
||||
minWidth: 0,
|
||||
};
|
||||
|
||||
/** 侧栏分组标题 */
|
||||
export const navGroupTitle: CSSProperties = {
|
||||
padding: '12px 10px 6px',
|
||||
fontSize: 11,
|
||||
letterSpacing: 1,
|
||||
textTransform: 'uppercase',
|
||||
color: '#6b7a8c',
|
||||
fontWeight: 600,
|
||||
};
|
||||
|
||||
/** 侧栏导航项 */
|
||||
export const navItem: CSSProperties = {
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: 9,
|
||||
padding: '8px 10px',
|
||||
borderRadius: 7,
|
||||
color: '#c7d3e0',
|
||||
fontSize: 13,
|
||||
cursor: 'pointer',
|
||||
border: 'none',
|
||||
background: 'transparent',
|
||||
width: '100%',
|
||||
textAlign: 'left',
|
||||
};
|
||||
|
||||
/** 侧栏导航项 hover */
|
||||
export const navItemHover: CSSProperties = {
|
||||
background: '#1c242d',
|
||||
color: '#fff',
|
||||
};
|
||||
|
||||
/** 侧栏导航项选中态 */
|
||||
export const navItemActive: CSSProperties = {
|
||||
background: '#1b2b3d',
|
||||
color: '#cfe3ff',
|
||||
boxShadow: 'inset 2px 0 0 #2b7fd4',
|
||||
};
|
||||
|
||||
/** 导航项内的图标底座 */
|
||||
export const navIcon: CSSProperties = {
|
||||
width: 22,
|
||||
height: 22,
|
||||
borderRadius: 6,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
background: '#222c37',
|
||||
color: '#8fb6dd',
|
||||
fontSize: 11,
|
||||
fontWeight: 700,
|
||||
flexShrink: 0,
|
||||
};
|
||||
|
||||
/** 导航项右侧计数徽标 */
|
||||
export const navBadge: CSSProperties = {
|
||||
marginLeft: 'auto',
|
||||
fontSize: 11,
|
||||
color: '#7d8ea1',
|
||||
background: '#202a35',
|
||||
borderRadius: 9,
|
||||
padding: '1px 7px',
|
||||
fontVariantNumeric: 'tabular-nums',
|
||||
};
|
||||
|
||||
/** 页面标题 */
|
||||
export const pageTitle: CSSProperties = {
|
||||
margin: 0,
|
||||
fontSize: 19,
|
||||
fontWeight: 650,
|
||||
letterSpacing: 0.2,
|
||||
};
|
||||
|
||||
/** 页面副标题 */
|
||||
export const pageSub: CSSProperties = {
|
||||
margin: '6px 0 0',
|
||||
fontSize: 13,
|
||||
color: '#8b9aab',
|
||||
lineHeight: 1.6,
|
||||
};
|
||||
|
||||
/** 统计卡片容器 */
|
||||
export const statGrid: CSSProperties = {
|
||||
display: 'grid',
|
||||
gridTemplateColumns: 'repeat(auto-fit, minmax(150px, 1fr))',
|
||||
gap: 12,
|
||||
marginTop: 18,
|
||||
};
|
||||
|
||||
/** 单个统计卡片 */
|
||||
export const statCard: CSSProperties = {
|
||||
background: '#1a1f26',
|
||||
border: '1px solid #232c36',
|
||||
borderRadius: 10,
|
||||
padding: '14px 16px',
|
||||
};
|
||||
|
||||
/** 统计卡片的数值 */
|
||||
export const statValue: CSSProperties = {
|
||||
fontSize: 24,
|
||||
fontWeight: 680,
|
||||
lineHeight: 1.15,
|
||||
fontVariantNumeric: 'tabular-nums',
|
||||
};
|
||||
|
||||
/** 统计卡片的标签 */
|
||||
export const statLabel: CSSProperties = {
|
||||
fontSize: 12,
|
||||
color: '#8b9aab',
|
||||
marginTop: 5,
|
||||
};
|
||||
|
||||
/** 内容分区块(带标题的面板) */
|
||||
export const panel: CSSProperties = {
|
||||
background: '#1a1f26',
|
||||
border: '1px solid #232c36',
|
||||
borderRadius: 10,
|
||||
padding: '16px 18px',
|
||||
marginTop: 16,
|
||||
};
|
||||
|
||||
/** 面板标题 */
|
||||
export const panelTitle: CSSProperties = {
|
||||
margin: 0,
|
||||
fontSize: 14,
|
||||
fontWeight: 620,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: 8,
|
||||
};
|
||||
|
||||
/** 面板副标题 */
|
||||
export const panelSub: CSSProperties = {
|
||||
fontSize: 12,
|
||||
color: '#7d8ea1',
|
||||
marginTop: 4,
|
||||
fontWeight: 400,
|
||||
};
|
||||
|
||||
/** 小徽标(能力状态等) */
|
||||
export const chip: CSSProperties = {
|
||||
display: 'inline-flex',
|
||||
alignItems: 'center',
|
||||
gap: 5,
|
||||
fontSize: 11,
|
||||
padding: '2px 8px',
|
||||
borderRadius: 10,
|
||||
background: '#222c37',
|
||||
color: '#a9bacb',
|
||||
whiteSpace: 'nowrap',
|
||||
};
|
||||
|
||||
/** 状态圆点 */
|
||||
export const dot: CSSProperties = {
|
||||
width: 7,
|
||||
height: 7,
|
||||
borderRadius: '50%',
|
||||
flexShrink: 0,
|
||||
};
|
||||
|
||||
/** 定义列表行(键值对) */
|
||||
export const kvRow: CSSProperties = {
|
||||
display: 'flex',
|
||||
gap: 12,
|
||||
fontSize: 13,
|
||||
padding: '7px 0',
|
||||
borderBottom: '1px solid #1f2630',
|
||||
alignItems: 'baseline',
|
||||
};
|
||||
|
||||
/** 键名 */
|
||||
export const kvKey: CSSProperties = {
|
||||
color: '#8b9aab',
|
||||
width: 116,
|
||||
flexShrink: 0,
|
||||
};
|
||||
|
||||
/** 键值 */
|
||||
export const kvVal: CSSProperties = {
|
||||
color: '#dce6f0',
|
||||
wordBreak: 'break-all',
|
||||
fontVariantNumeric: 'tabular-nums',
|
||||
};
|
||||
Reference in new issue
Block a user