diff --git a/frontend/design-proposals/app.js b/frontend/design-proposals/app.js new file mode 100644 index 0000000..5b08153 --- /dev/null +++ b/frontend/design-proposals/app.js @@ -0,0 +1,828 @@ +/** + * Scert 首次初始化向导 - 全 4 步骤 UI 设计方案选型核心脚本 + * 支持 3 套视觉体系(Deck、Ops、Minimal)无缝切换与全 4 步无损联动 + */ + +let currentTheme = 'deck'; // 'deck' | 'ops' | 'minimal' +let currentStep = 1; // 1 | 2 | 3 | 4 + +// 页面步骤元数据定义 +const stepMetadata = { + 1: { num: '01', title: '超级管理员与基础配置', sub: '初始化向导 • 第 1 步 / 共 4 步 (账户与持久化存储)' }, + 2: { num: '02', title: '服务与通知配置', sub: '初始化向导 • 第 2 步 / 共 4 步 (出站 SMTP 告警通道)' }, + 3: { num: '03', title: 'DNS 授权与验证', sub: '初始化向导 • 第 3 步 / 共 4 步 (DNS-01 自动化凭据)' }, + 4: { num: '04', title: '管理页面证书与部署生效', sub: '初始化向导 • 第 4 步 / 共 4 步 (证书目录与核心服务)' } +}; + +// 步骤切换处理 +function goStep(step) { + if (step < 1 || step > 4) return; + currentStep = step; + render(); +} + +function nextStep() { + if (currentStep < 4) { + currentStep++; + render(); + } else { + alert('恭喜!初始化向导全部 4 个步骤已演练完成,点击确认后可向后端发起完整生效请求。'); + } +} + +function prevStep() { + if (currentStep > 1) { + currentStep--; + render(); + } +} + +// 方案切换处理 +function switchTheme(theme) { + currentTheme = theme; + document.querySelectorAll('.nav-btn').forEach(btn => { + if (btn.getAttribute('data-theme') === theme) { + btn.classList.add('active'); + } else { + btn.classList.remove('active'); + } + }); + render(); +} + +// 渲染通用步骤进度条 +function renderStepper() { + const steps = [ + { num: 1, name: '超级管理员', desc: '账号 / 网络 / 存储' }, + { num: 2, name: '服务与通知', desc: 'SMTP 告警出站通道' }, + { num: 3, name: 'DNS 验证', desc: 'DNS-01 API 授权' }, + { num: 4, name: '证书与生效', desc: '证书目录 / 签发环境' } + ]; + + return ` + + `; +} +// ========================================================================= +// 方案 A:卡片式分体与状态联运流 (Card-Deck Flow) 全 4 步表单 +// ========================================================================= + +function renderDeckStep(step) { + if (step === 1) { + return ` + +
+
+
+
01
+

超级管理员凭据录入

+
+ 账号用于登录 Scert Web 与受保护运维 CLI +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+
+
+
02
+

网络与管理访问定位

+
+ 支持通过公网 IP 或独立域名接入 +
+
+
+ + +
+
+ + +
+
+
+ + +
+
+
+
03
+

持久化存储引擎 (Database)

+
+ 建议轻量环境使用 SQLite 本地免运维引擎 +
+
+
+
+ + +
+
+ + SQLite 读写权限已在线校验通过 +
+
+ +
+
+ + +
+ +
+ 高安全受保护体系说明: + 生产环境已彻底移除公网 /reset HTTP 入口。若遗忘超级管理员密码,请在物理宿主机通过系统管理员终端运行 scert.exe admin localreset,在受保护的本地 IPC 域内安全重置。 +
+
+ `; + } else if (step === 2) { + return ` + +
+
+
+
01
+

SMTP 出站告警通知服务

+
+ 仅作为出站邮件客户端向管理员分发证书通知 +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+
+
+
02
+

高级通知策略与重试控制

+
+ 保障高可用投递与敏感信息收敛 +
+
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+
+ `; + } else if (step === 3) { + return ` + +
+
+
+
01
+

DNS 服务商授权配置

+
+ 支持通过 API 自动化注入 _acme-challenge TXT 记录 +
+
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+
+ + +
+
+
+
02
+

DNS API 联调探针 (Live Verification)

+
+ +
+ +
+
+ API 权限三阶段检验状态: + 探针通过 • 有效期 15 分钟 +
+
+
+ ① TXT 临时记录创建 +
✔ 注入成功 (Status 200)
+
+
+ ② 权威 DNS 节点解析 +
✔ 权威节点秒级生效
+
+
+ ③ 残留记录原子清理 +
✔ 临时记录清理完成
+
+
+
+
+ `; + } else if (step === 4) { + return ` + +
+
+
+
01
+

证书部署根目录与环境

+
+ 填写服务器宿主机绝对路径,系统将自动创建受保护目录 +
+
+
+ + +
+
+ + +
+
+
+ + +
+
+
+
02
+

HTTPS 模式与服务入口设定

+
+ 支持直接核心接管或前置反向代理 +
+
+
+ + +
+
+ +
+ +
+
+
+
+ + +
+ +
+ 初始化已就绪: + 点击下方“完成初始化并启动服务”后,Scert 将在后台安全签发管理证书、固化数据库配置并直接进入主控制台。 +
+
+ `; + } +} +// ========================================================================= +// 方案 B:沉浸式专业运维仪表板 (Ops-Console Split) 全 4 步表单与实时链路拓扑 +// ========================================================================= + +function renderOpsStep(step) { + let formContent = ''; + let topoContent = ''; + + if (step === 1) { + formContent = ` +
+
+
+
SEC
+

管理员安全凭据

+
+
+
+
+
+
+
+
+
+ +
+
+
+
NET
+

网络拓扑与存储核心

+
+
+
+
+
+
+ +
+ + +
+
+
+
+ `; + + topoContent = ` +
+ 实时系统链路 (TOPOLOGY) + ● READY +
+
+
INBOUND TRAFFIC
+
HTTP/HTTPS :5200 (127.0.0.1)
+
+
▼ 协议隔离与拦截
+
+
SCERT CORE ENGINE
+
Strict-Same-Origin Check
+
+
▼ 本地事务锁
+
+
STORAGE BACKEND
+
scert.db (WAL 模式)
+
+
+
Same-Origin HeaderPASS
+
Database TokenVERIFIED
+
DNS API ProbeSTEP 3 PENDING
+
Admin Reset ModeLOCAL IPC ONLY
+
+ `; + } else if (step === 2) { + formContent = ` +
+
+
+
MAIL
+

SMTP 出站路由通道

+
+
+ +
+
+
+
+
+
+
+
+
+ +
+
+
+
OPT
+

高级通知策略

+
+
+
+
+
+
+
+ `; + + topoContent = ` +
+ 出站通知拓扑 (OUTBOUND MAIL) + ● CONFIGURED +
+
+
ALERT TRIGGER SOURCE
+
Certificate Expiry / Renew Hook
+
+
▼ STARTTLS 587
+
+
GATEWAY HOST
+
smtp.solit.cn
+
+
▼ 直达运维邮箱
+
+
RECIPIENTS
+
ops@solit.cn (2 targets)
+
+
+
SMTP Host DNSRESOLVED
+
STARTTLS HandshakeSTANDBY
+
+ `; + } else if (step === 3) { + formContent = ` +
+
+
+
DNS
+

DNS-01 验证适配器凭据

+
+
+
+
+
+
+
+
+
+ +
+
+ `; + + topoContent = ` +
+ DNS-01 挑战拓扑 (CHALLENGE) + ● READY +
+
+
ACME SERVER REQUEST
+
_acme-challenge.solit.cn
+
+
▼ API 注入 TXT 记录
+
+
ALIYUN DNS CLOUD
+
AliyunDNSFullAccess API
+
+
▼ 全球 DNS 权威解析节点
+
+
PROPAGATION STATUS
+
300s SLA Max (Avg: 2.1s)
+
+
+
API CredentialsVALID
+
Live ProbePASSED (1.3s)
+
+ `; + } else if (step === 4) { + formContent = ` +
+
+
+
SSL
+

证书根目录与签发引擎环境

+
+
+
+
+
+
+
+
+
+ `; + + topoContent = ` +
+ 生产证书生效链路 (CERT OPS) + ● READY TO ISSUE +
+
+
MANAGED ROOT DIR
+
D:/Desktop/Scert/.../ssl
+
+
▼ 自动下发受信任证书
+
+
PRODUCTION CA
+
Let's Encrypt Production
+
+
▼ 绑定核心端口并启动
+
+
HTTPS LISTENER
+
Direct TLS :5200 (Active)
+
+
+
Directory AccessWRITABLE
+
Bootstrap LockFINAL READY
+
+ `; + } + + return ` +
+
+ ${formContent} +
+
+ ${topoContent} +
+
+ `; +} +// ========================================================================= +// 方案 C:极简轻奢分步引导台 (Minimalist Focus) 全 4 步表单 +// ========================================================================= + +function renderMinimalStep(step) { + if (step === 1) { + return ` +
+
01 / ADMIN IDENTITY (超级管理员账户)
+
+
+
+
+
+
+
+
+ +
02 / ACCESS & PERSISTENCE (访问入口与存储)
+
+
+
+
+
+
+
+ ✔ SQLite 存储文件读写状态验证正常 + +
+
+
+ `; + } else if (step === 2) { + return ` +
+
01 / NOTIFICATION ROUTE (告警通知路由)
+
+ +
+
+
+
+
+
+
+
+
+
+ `; + } else if (step === 3) { + return ` +
+
01 / DNS-01 API INTEGRATION (DNS-01 自动化接口)
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+ `; + } else if (step === 4) { + return ` +
+
01 / CERTIFICATE & ENGINE FINALIZE (证书与最终部署)
+
+
+
+
+
+
+
+
+
+ `; + } +} + +// ========================================================================= +// 统一渲染调度主函数 render() +// ========================================================================= + +function render() { + const frame = document.getElementById('preview-frame'); + if (!frame) return; + + const meta = stepMetadata[currentStep]; + + // 1. 侧边栏 + const brandSidebar = ` + + `; + + // 2. 右侧主体 + let stepBody = ''; + if (currentTheme === 'deck') { + stepBody = renderDeckStep(currentStep); + } else if (currentTheme === 'ops') { + stepBody = renderOpsStep(currentStep); + } else if (currentTheme === 'minimal') { + stepBody = renderMinimalStep(currentStep); + } + + // 3. 底部操作栏 + const isLast = currentStep === 4; + const isFirst = currentStep === 1; + const footer = ` + + `; + + // 4. 组装整个容器 + frame.innerHTML = ` + ${brandSidebar} +
+
+
+ ${meta.sub} +

${meta.title}

+
+
+ + 受保护的 HTTPS 初始化 (Strict-Same-Origin) +
+
+ + ${renderStepper()} + +
+ ${stepBody} +
+ + ${footer} +
+ `; +} + +// 页面加载完成后自动触发初始渲染 +window.addEventListener('DOMContentLoaded', () => { + render(); +}); +render(); \ No newline at end of file diff --git a/frontend/design-proposals/index.html b/frontend/design-proposals/index.html index 1c8acc9..c9a81d4 100644 --- a/frontend/design-proposals/index.html +++ b/frontend/design-proposals/index.html @@ -1,393 +1,51 @@ - + - Scert 首次初始化向导 - UI 设计方案选型 + + Scert 首次初始化向导 - 全 4 步骤 UI 设计方案选型 - + +
- Logo - Scert 首次初始化向导 - 交互与布局方案评审 + Scert Logo + Scert 初始化向导 • 4步骤设计方案选型
-
+
-
- - - - -
-
-
- 初始化向导 • 第 1 步 / 共 4 步 -

超级管理员与基础配置

-
-
- - 受保护的 HTTPS 初始化 (Strict-Same-Origin) -
-
- - - - - -
- -
- -
- 请放行初始化及正式服务端口。验证凭据加密保存;完成后关闭临时入口并切换正式管理地址。 - -
-
+
+
- + - + \ No newline at end of file diff --git a/frontend/design-proposals/style.css b/frontend/design-proposals/style.css new file mode 100644 index 0000000..a8ba2d5 --- /dev/null +++ b/frontend/design-proposals/style.css @@ -0,0 +1,112 @@ +/* Scert ????? 4????????????? */ +* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; } +body { background: #0b1120; color: #f1f5f9; min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; } + +/* ????? */ +header.top-nav { height: 60px; background: #0f172a; border-bottom: 1px solid #1e293b; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 100; } +.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 15px; color: #38bdf8; } +.brand img { width: 30px; height: 30px; object-fit: contain; } +.nav-center { display: flex; align-items: center; } +.nav-group { display: flex; gap: 6px; background: #1e293b; padding: 4px; border-radius: 10px; border: 1px solid #334155; } +.nav-btn { display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 6px; border: none; background: transparent; color: #94a3b8; font-size: 13px; font-weight: 500; cursor: pointer; transition: all .2s; } +.nav-btn:hover { color: #f8fafc; } +.nav-btn.active { background: #0284c7; color: #fff; box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4); font-weight: 600; } +.badge-tag { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; background: rgba(255,255,255,0.15); } +.meta-badge { font-size: 12px; color: #94a3b8; background: #1e293b; padding: 5px 12px; border-radius: 20px; border: 1px solid #334155; display: flex; align-items: center; gap: 8px; } +.meta-dot { width: 8px; height: 8px; border-radius: 50%; background: #10b981; box-shadow: 0 0 8px #10b981; } + +/* ????????? */ +main.viewport { flex: 1; padding: 20px 24px; display: flex; justify-content: center; align-items: center; } +.preview-frame { width: 100%; max-width: 1480px; height: 870px; background: #fff; border-radius: 16px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); overflow: hidden; display: flex; color: #0f172a; position: relative; } + +/* ??????? */ +.access-brand { width: 280px; background: linear-gradient(175deg, #1e3a8a 0%, #1e40af 40%, #0f172a 100%); color: #fff; padding: 28px 24px; display: flex; flex-direction: column; justify-content: space-between; position: relative; flex-shrink: 0; } +.brand-top .logo { width: 68px; height: 68px; margin-bottom: 16px; filter: drop-shadow(0 8px 16px rgba(0,0,0,0.25)); } +.brand-top .tag { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: #93c5fd; font-weight: 700; margin-bottom: 6px; } +.brand-top h1 { font-size: 22px; font-weight: 700; line-height: 1.35; margin-bottom: 10px; } +.brand-top p { font-size: 13px; color: #bfdbfe; line-height: 1.55; } +.brand-notice { background: rgba(255,255,255,0.08); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,0.15); border-radius: 10px; padding: 14px; font-size: 12px; line-height: 1.5; color: #dbeafe; } +.brand-notice strong { display: block; color: #fff; margin-bottom: 4px; font-size: 12px; } + +/* ????? */ +.content-area { flex: 1; display: flex; flex-direction: column; background: #f8fafc; overflow: hidden; } +.wizard-header { padding: 16px 28px; background: #fff; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; } +.wizard-header .title-group h2 { font-size: 20px; font-weight: 700; color: #0f172a; } +.wizard-header .title-group span { font-size: 12px; color: #64748b; } +.badge-secure { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; font-size: 12px; font-weight: 500; padding: 5px 12px; border-radius: 6px; display: flex; align-items: center; gap: 6px; } + +/* ????? Stepper */ +.step-stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 12px 28px; background: #fff; border-bottom: 1px solid #f1f5f9; flex-shrink: 0; } +.step-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; border: 1px solid #e2e8f0; background: #f8fafc; cursor: pointer; transition: all .2s; } +.step-item:hover { border-color: #cbd5e1; background: #f1f5f9; } +.step-item.current { background: #eff6ff; border-color: #3b82f6; box-shadow: 0 1px 4px rgba(59, 130, 246, 0.15); } +.step-item.complete { background: #f0fdf4; border-color: #86efac; } +.step-circle { width: 28px; height: 28px; border-radius: 50%; background: #e2e8f0; color: #64748b; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; } +.step-item.current .step-circle { background: #1d4ed8; color: #fff; } +.step-item.complete .step-circle { background: #10b981; color: #fff; } +.step-info { display: flex; flex-direction: column; overflow: hidden; } +.step-info strong { font-size: 12px; color: #1e293b; white-space: nowrap; } +.step-info small { font-size: 11px; color: #64748b; white-space: nowrap; } + +/* ?????? */ +.wizard-body { flex: 1; padding: 20px 28px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; } + +/* ?????? */ +.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; } +.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; } +.form-group { display: flex; flex-direction: column; gap: 6px; } +.form-group label { font-size: 12px; font-weight: 600; color: #334155; display: flex; align-items: center; justify-content: space-between; } +.form-group label .help-tip { font-weight: normal; color: #94a3b8; font-size: 11px; } +.form-group input, .form-group select, .form-group textarea { height: 38px; border: 1px solid #cbd5e1; border-radius: 6px; padding: 0 12px; font-size: 13px; color: #0f172a; outline: none; transition: border-color .15s; background: #fff; width: 100%; } +.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: #0284c7; box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15); } +.form-group input[readonly] { background: #f8fafc; color: #64748b; cursor: not-allowed; } +.email-input-wrap { display: flex; gap: 8px; } +.email-input-wrap input { flex: 1; } +.email-input-wrap select { width: 140px; } + +/* ????? */ +.checkbox-card { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; cursor: pointer; } +.checkbox-card input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: #1d4ed8; } +.checkbox-card .checkbox-label { font-size: 13px; font-weight: 600; color: #1e293b; } +.checkbox-card .checkbox-desc { font-size: 12px; color: #64748b; margin-left: 4px; } + +/* ??????? */ +.wizard-footer { padding: 14px 28px; background: #fff; border-top: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; } +.wizard-footer .hint { font-size: 12px; color: #64748b; display: flex; align-items: center; gap: 6px; } +.wizard-footer .actions { display: flex; gap: 10px; } +.btn-prev { height: 38px; padding: 0 22px; background: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .2s; } +.btn-prev:hover { background: #e2e8f0; } +.btn-next { height: 38px; padding: 0 26px; background: #1d4ed8; color: #fff; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .2s; box-shadow: 0 2px 8px rgba(29, 78, 216, 0.3); } +.btn-next:hover { background: #1e40af; } +.btn-submit { background: #10b981 !important; box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3) !important; } +.btn-submit:hover { background: #059669 !important; } + +/* ================= ?? A?????? (Card-Deck Flow) ================= */ +.deck-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.02); } +.deck-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px dashed #f1f5f9; } +.deck-header-left { display: flex; align-items: center; gap: 8px; } +.deck-header .tag { width: 22px; height: 22px; border-radius: 6px; background: #e0f2fe; color: #0369a1; font-weight: 700; font-size: 11px; display: flex; align-items: center; justify-content: center; } +.deck-header h3 { font-size: 14px; font-weight: 700; color: #0f172a; } +.db-verify-box { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 4px; } +.db-badge-verified { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 20px; display: flex; align-items: center; gap: 6px; } +.btn-verify { height: 36px; padding: 0 16px; background: #0284c7; color: #fff; border: none; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; transition: background .2s; white-space: nowrap; } +.btn-verify:hover { background: #0369a1; } +.info-callout { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 12px 14px; font-size: 12px; color: #166534; line-height: 1.5; display: flex; gap: 10px; align-items: flex-start; } + +/* ================= ?? B??????????? (Ops Split) ================= */ +.ops-split { display: grid; grid-template-columns: 1fr 360px; gap: 18px; flex: 1; height: 100%; min-height: 0; } +.ops-main { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; padding-right: 4px; } +.topo-panel { background: #0f172a; border-radius: 12px; padding: 18px; color: #e2e8f0; display: flex; flex-direction: column; gap: 14px; border: 1px solid #1e293b; height: 100%; } +.topo-title { font-size: 13px; font-weight: 700; color: #38bdf8; letter-spacing: 0.5px; border-bottom: 1px solid #1e293b; padding-bottom: 8px; display: flex; justify-content: space-between; align-items: center; } +.topo-node { background: #1e293b; border: 1px solid #334155; border-radius: 8px; padding: 10px 12px; } +.topo-node-name { font-size: 11px; color: #94a3b8; margin-bottom: 4px; } +.topo-node-val { font-size: 13px; font-family: monospace; color: #f8fafc; font-weight: 600; } +.topo-arrow { text-align: center; color: #0284c7; font-size: 13px; line-height: 1; } +.topo-check-item { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: #94a3b8; padding: 7px 0; border-bottom: 1px dashed #334155; } +.topo-check-item .status-ok { color: #34d399; font-weight: 600; } +.topo-check-item .status-wait { color: #f59e0b; font-weight: 600; } + +/* ================= ?? C?????????? (Minimalist Focus) ================= */ +.minimal-container { max-width: 820px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: 20px; } +.minimal-section-title { font-size: 12px; font-weight: 700; color: #0284c7; text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid #e2e8f0; padding-bottom: 6px; } +.minimal-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 18px 22px; }