feat(works): 新增成品「开发文档中心 · 甄房」

- 回收 ZhenOS-SH/ruoyi-ui public/devdoc 静态站(16 文件 / 3.69 MB)到 works/devdoc
- 目录页 5 分类 21 条文档 + 10 个子页(业务全流程流程图 mermaid / 菜单图标选型 / 头像素材规范等)
- works.js 追加索引(文档类),works.html 版本 bump
This commit is contained in:
sgp
2026-11-15 22:48:48 +08:00
parent e801e14575
commit 12f8b65e1c
18 changed files with 8286 additions and 1 deletions
@@ -0,0 +1,694 @@
:root {
--page: #ffffff;
--ink: #2f302d;
--muted: #6b7280;
--faint: #9aa1ad;
--line: #e6e8ec;
--line-strong: #d4d8df;
--soft: #f7f8fa;
--soft-2: #f1f4f7;
--accent: #2563eb;
--teal: #0f766e;
--rose: #b83f58;
--gold: #b7791f;
}
* {
box-sizing: border-box;
}
html {
background: var(--page);
scroll-behavior: smooth;
}
body {
margin: 0;
background: var(--page);
color: var(--ink);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
font-size: 16px;
line-height: 1.72;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
}
a {
color: var(--accent);
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.doc-page {
width: min(780px, calc(100vw - 48px));
margin: 0 auto;
padding: 72px 0 96px;
}
.doc-title {
margin-bottom: 32px;
}
.doc-title h1 {
margin: 0;
color: var(--ink);
font-size: 36px;
line-height: 1.18;
font-weight: 650;
letter-spacing: 0;
text-wrap: balance;
}
.doc-subtitle {
margin: 18px 0 0;
color: var(--muted);
font-size: 18px;
line-height: 1.7;
}
.doc-block {
margin: 36px 0;
scroll-margin-top: 28px;
}
.doc-block h2,
.doc-chart h2,
.doc-table h2,
.doc-diagram h2 {
margin: 0 0 12px;
color: var(--ink);
font-size: 23px;
line-height: 1.35;
font-weight: 620;
letter-spacing: 0;
text-wrap: balance;
}
.doc-block p,
.doc-chart p,
.doc-table p,
.doc-diagram p {
margin: 10px 0 16px;
color: #4b5059;
text-wrap: pretty;
}
.doc-block ul,
.doc-block ol {
margin: 10px 0 0;
padding-left: 24px;
}
.doc-block li {
margin: 8px 0;
}
.doc-block strong,
.doc-callout strong,
.doc-note strong {
color: var(--ink);
font-weight: 620;
}
.doc-callout {
margin: 28px 0 34px;
padding: 16px 18px;
border: 1px solid #dfe5e2;
border-radius: 16px;
background: #f7faf8;
}
.doc-callout p {
margin: 6px 0 0;
color: #46534f;
}
.doc-note {
margin: 22px 0;
padding: 13px 15px;
border-left: 3px solid var(--line-strong);
border-radius: 0 16px 16px 0;
background: var(--soft);
color: #535a66;
}
.doc-note p {
margin: 0;
}
.doc-metrics {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
margin: 30px 0 42px;
border: 1px solid var(--line);
border-radius: 16px;
overflow: hidden;
background: #fff;
}
.doc-metric {
min-width: 0;
padding: 16px 17px;
}
.doc-metric + .doc-metric {
border-left: 1px solid var(--line);
}
.doc-metric span {
display: block;
color: var(--muted);
font-size: 13px;
line-height: 1.35;
}
.doc-metric strong {
display: block;
margin: 6px 0 3px;
color: var(--ink);
font-size: 23px;
line-height: 1.18;
font-weight: 640;
}
.doc-metric small {
display: block;
color: var(--muted);
font-size: 13px;
line-height: 1.35;
}
.doc-chart,
.doc-table,
.doc-diagram {
margin: 46px 0;
scroll-margin-top: 28px;
}
.chart-frame,
.table-frame,
.diagram-frame {
position: relative;
margin-top: 18px;
}
.mermaid-frame {
padding: 20px;
border: 1px solid var(--line);
border-radius: 16px;
background: #fff;
}
.mermaid {
min-width: 680px;
margin: 0;
color: var(--ink);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
.mermaid svg {
display: block;
width: 100%;
max-width: none;
height: auto;
}
.diagram-zoom-trigger {
position: absolute;
top: 9px;
right: 9px;
z-index: 3;
display: inline-flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
border: 1px solid var(--line-strong);
border-radius: 999px;
background: rgba(255, 255, 255, 0.94);
color: var(--muted);
cursor: pointer;
padding: 0;
box-shadow: 0 1px 2px rgba(32, 33, 36, 0.04);
opacity: 0;
transition: opacity 140ms ease, color 140ms ease, background 140ms ease;
}
.lucide-icon {
width: 14px;
height: 14px;
stroke: currentColor;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
fill: none;
pointer-events: none;
}
.mermaid-frame:hover .diagram-zoom-trigger,
.mermaid-frame:focus-within .diagram-zoom-trigger {
opacity: 1;
}
.diagram-zoom-trigger:hover,
.diagram-zoom-trigger:focus-visible {
background: #fff;
color: var(--ink);
outline: none;
}
.diagram-lightbox {
position: fixed;
inset: 0;
z-index: 100;
display: none;
padding: 34px;
background: rgba(25, 28, 34, 0.62);
}
.diagram-lightbox.open {
display: flex;
align-items: center;
justify-content: center;
}
.diagram-lightbox-panel {
position: relative;
width: min(1120px, calc(100vw - 48px));
max-height: calc(100vh - 48px);
overflow: auto;
border: 1px solid var(--line-strong);
border-radius: 16px;
background: #fff;
box-shadow: 0 22px 60px rgba(15, 23, 42, 0.28);
padding: 28px;
}
.diagram-lightbox-content {
min-width: 880px;
padding-top: 6px;
}
.diagram-lightbox-content svg {
display: block;
width: 100%;
height: auto;
}
.diagram-lightbox-close {
position: absolute;
top: 12px;
right: 12px;
z-index: 4;
display: inline-flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
border: 0;
border-radius: 999px;
background: transparent;
color: var(--muted);
cursor: pointer;
padding: 0;
}
.diagram-lightbox-close:hover,
.diagram-lightbox-close:focus-visible {
background: var(--soft);
color: var(--ink);
outline: none;
}
.chart-menu {
position: absolute;
top: 10px;
right: 10px;
z-index: 3;
opacity: 0;
transition: opacity 140ms ease;
}
.chart-frame:hover .chart-menu,
.chart-frame:focus-within .chart-menu {
opacity: 1;
}
.chart-menu-trigger {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 3px;
width: 30px;
height: 30px;
border: 1px solid var(--line-strong);
border-radius: 999px;
background: rgba(255, 255, 255, 0.94);
color: var(--muted);
cursor: pointer;
padding: 0;
box-shadow: 0 1px 2px rgba(32, 33, 36, 0.04);
}
.chart-menu-trigger span {
display: block;
width: 3px;
height: 3px;
border-radius: 50%;
background: currentColor;
}
.chart-menu-trigger:hover,
.chart-menu-trigger:focus-visible {
background: #fff;
color: var(--ink);
outline: none;
}
.chart-menu-popover {
display: none;
position: absolute;
right: 0;
top: 34px;
width: 156px;
padding: 6px;
border: 1px solid var(--line-strong);
border-radius: 8px;
background: #fff;
box-shadow: 0 8px 18px rgba(32, 33, 36, 0.12);
}
.chart-menu:hover .chart-menu-popover,
.chart-menu:focus-within .chart-menu-popover {
display: block;
}
.chart-menu-popover button {
display: block;
width: 100%;
border: 0;
border-radius: 6px;
background: transparent;
color: var(--ink);
font: inherit;
font-size: 13px;
text-align: left;
padding: 8px 10px;
cursor: pointer;
}
.chart-menu-popover button.active,
.chart-menu-popover button:hover,
.chart-menu-popover button:focus-visible {
background: var(--soft-2);
color: var(--ink);
outline: none;
}
.chart-canvas {
width: 100%;
height: 390px;
border: 1px solid var(--line);
border-radius: 16px;
background: #fff;
}
.figure-caption {
margin-top: 9px;
color: var(--muted);
font-size: 14px;
line-height: 1.48;
}
.figure-caption strong {
display: block;
color: #343941;
font-weight: 620;
}
.figure-caption span {
display: block;
margin-top: 2px;
}
.table-scroll {
overflow-x: auto;
border: 1px solid var(--line);
border-radius: 16px;
background: #fff;
}
.doc-data-table {
width: 100%;
min-width: 720px;
border-collapse: collapse;
font-size: 14px;
line-height: 1.45;
}
.doc-data-table th,
.doc-data-table td {
padding: 11px 12px;
border-bottom: 1px solid var(--line);
text-align: left;
vertical-align: top;
}
.doc-data-table th {
background: var(--soft);
color: #566173;
font-weight: 620;
}
.doc-data-table tbody tr:last-child td {
border-bottom: 0;
}
.doc-data-table .num {
text-align: right;
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
.diagram-flow {
display: grid;
grid-template-columns: 1fr auto 1fr auto 1fr;
gap: 10px;
align-items: stretch;
min-width: 640px;
}
.diagram-node {
padding: 15px;
border: 1px solid var(--line);
border-radius: 16px;
background: #fff;
}
.diagram-node strong {
display: block;
margin-bottom: 4px;
color: var(--ink);
font-weight: 620;
}
.diagram-node span {
color: var(--muted);
font-size: 14px;
line-height: 1.5;
}
.diagram-arrow {
display: flex;
align-items: center;
color: var(--faint);
font-size: 22px;
}
.doc-sources {
margin-top: 48px;
padding-top: 4px;
}
.source-links {
margin: 16px 0 0;
padding-left: 22px;
color: #535a66;
font-size: 14px;
line-height: 1.6;
}
.source-links li {
margin: 7px 0;
}
.toc-rail {
position: fixed;
left: 18px;
top: 50%;
z-index: 10;
width: 320px;
transform: translateY(-50%);
}
.toc-lines {
display: flex;
flex-direction: column;
gap: 4px;
width: 28px;
padding: 8px 5px;
}
.toc-line {
position: relative;
display: block;
width: 18px;
height: 8px;
color: #c3c6cd;
}
.toc-line::before {
content: "";
position: absolute;
left: 0;
top: 50%;
width: 18px;
height: 2px;
border-radius: 999px;
background: currentColor;
transform: translateY(-50%);
}
.toc-line.active,
.toc-line:hover {
color: var(--ink);
}
.toc-popup {
position: absolute;
left: 0;
top: 50%;
width: 310px;
padding: 12px;
border: 1px solid var(--line-strong);
border-radius: 16px;
background: rgba(255, 255, 255, 0.98);
box-shadow: 0 16px 36px rgba(35, 37, 42, 0.13);
opacity: 0;
pointer-events: none;
transform: translateY(-50%) translateX(-4px);
transition: opacity 140ms ease, transform 140ms ease;
}
.toc-rail:hover .toc-popup,
.toc-rail:focus-within .toc-popup {
opacity: 1;
pointer-events: auto;
transform: translateY(-50%) translateX(0);
}
.toc-popup a {
display: block;
padding: 7px 9px;
border-radius: 6px;
color: var(--ink);
font-size: 14px;
line-height: 1.35;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.toc-popup a:hover,
.toc-popup a.active {
background: var(--soft);
text-decoration: none;
}
@media (max-width: 1040px) {
.toc-rail {
display: none;
}
}
@media (max-width: 820px) {
.doc-page {
width: min(100vw - 32px, 780px);
padding-top: 44px;
}
.doc-title h1 {
font-size: 30px;
}
.doc-subtitle {
font-size: 16px;
}
.doc-metrics {
grid-template-columns: 1fr 1fr;
}
.doc-metric:nth-child(odd) {
border-left: 0;
}
.doc-metric:nth-child(n + 3) {
border-top: 1px solid var(--line);
}
.chart-canvas {
height: 360px;
}
.diagram-lightbox {
padding: 18px;
}
.diagram-lightbox-panel {
width: calc(100vw - 24px);
max-height: calc(100vh - 24px);
padding: 22px;
}
.diagram-lightbox-content {
min-width: 760px;
}
}
@media (max-width: 560px) {
.doc-page {
width: min(100vw - 24px, 780px);
}
.doc-title h1 {
font-size: 27px;
}
.doc-block h2,
.doc-chart h2,
.doc-table h2,
.doc-diagram h2 {
font-size: 21px;
}
.doc-metrics {
grid-template-columns: 1fr;
}
.doc-metric,
.doc-metric + .doc-metric {
border-left: 0;
}
.doc-metric + .doc-metric {
border-top: 1px solid var(--line);
}
.chart-canvas {
height: 320px;
}
}
@@ -0,0 +1,350 @@
(function () {
const palette = {
blue: "#2563eb",
teal: "#0f766e",
rose: "#b83f58",
gold: "#b7791f",
line: "#e6ebf0",
axis: "#475569"
};
const chartColors = [palette.blue, palette.teal, palette.gold, palette.rose, "#64748b", "#7c3aed"];
function readJson(id) {
const el = document.getElementById(id);
if (!el) return null;
try {
return JSON.parse(el.textContent || "null");
} catch (error) {
console.warn("Invalid JSON block", id, error);
return null;
}
}
function pct(value) {
return Number(value).toFixed(1) + "%";
}
function grid() {
return { left: 58, right: 48, top: 52, bottom: 58, containLabel: true };
}
function marketOption(rows, type) {
if (type === "bar") {
return {
animation: false,
color: [palette.blue, palette.gold],
tooltip: { trigger: "axis" },
legend: { top: 8 },
grid: grid(),
xAxis: { type: "category", data: rows.map((row) => row.year) },
yAxis: [
{ type: "value", name: "销量 百万辆", splitLine: { lineStyle: { color: palette.line } } },
{ type: "value", name: "渗透率", axisLabel: { formatter: (value) => value + "%" } }
],
series: [
{ name: "销量", type: "bar", data: rows.map((row) => row.sales_m) },
{
name: "渗透率",
type: "line",
yAxisIndex: 1,
data: rows.map((row) => row.penetration),
lineStyle: { width: 3 }
}
]
};
}
return {
animation: false,
color: [palette.blue, palette.gold],
tooltip: { trigger: "axis" },
legend: { top: 8 },
grid: grid(),
xAxis: { type: "category", data: rows.map((row) => row.year) },
yAxis: [
{ type: "value", name: "销量 百万辆", splitLine: { lineStyle: { color: palette.line } } },
{ type: "value", name: "渗透率", axisLabel: { formatter: (value) => value + "%" } }
],
series: [
{
name: "销量",
type: "line",
smooth: true,
data: rows.map((row) => row.sales_m),
lineStyle: { width: 3 }
},
{
name: "渗透率",
type: "line",
yAxisIndex: 1,
smooth: true,
data: rows.map((row) => row.penetration),
lineStyle: { width: 3, type: "dashed" }
}
]
};
}
function shareOption(rows, type) {
if (type === "pie") {
return {
animation: false,
color: chartColors,
tooltip: { trigger: "item", valueFormatter: (value) => pct(value) },
legend: { bottom: 8, type: "scroll" },
series: [
{
type: "pie",
radius: ["42%", "70%"],
center: ["50%", "42%"],
data: rows.map((row) => ({ name: row.brand, value: row.share })),
label: { formatter: (params) => params.name + "\n" + pct(params.value) }
}
]
};
}
const reversed = rows.slice().reverse();
return {
animation: false,
color: [palette.teal],
tooltip: {
trigger: "axis",
axisPointer: { type: "shadow" },
valueFormatter: (value) => pct(value)
},
grid: { left: 92, right: 42, top: 28, bottom: 24, containLabel: true },
xAxis: {
type: "value",
axisLabel: { formatter: (value) => value + "%" },
splitLine: { lineStyle: { color: palette.line } }
},
yAxis: { type: "category", data: reversed.map((row) => row.brand) },
series: [
{
name: "份额",
type: "bar",
data: reversed.map((row) => ({
value: row.share,
itemStyle: {
color:
row.brand === "比亚迪"
? palette.teal
: row.brand === "特斯拉中国"
? palette.rose
: palette.blue
}
})),
label: { show: true, position: "right", formatter: (params) => pct(params.value) }
}
]
};
}
function setupToc() {
const nav = document.querySelector(".toc-rail");
const page = document.querySelector(".doc-page");
if (!nav || !page) return;
const targets = Array.from(
page.querySelectorAll("header[id], section[id]")
).filter((block) => block.querySelector("h1, h2"));
const lines = document.createElement("div");
const popup = document.createElement("div");
lines.className = "toc-lines";
popup.className = "toc-popup";
targets.forEach((target) => {
const heading = target.querySelector("h1, h2");
const label = heading.textContent.trim();
const line = document.createElement("a");
const link = document.createElement("a");
line.className = "toc-line";
line.href = "#" + target.id;
line.dataset.target = target.id;
line.setAttribute("aria-label", label);
link.href = "#" + target.id;
link.dataset.target = target.id;
link.textContent = label;
lines.appendChild(line);
popup.appendChild(link);
});
nav.replaceChildren(lines, popup);
const links = Array.from(nav.querySelectorAll("a[data-target]"));
function setActive(id) {
links.forEach((link) => link.classList.toggle("active", link.dataset.target === id));
}
if ("IntersectionObserver" in window) {
const observer = new IntersectionObserver(
(entries) => {
const visible = entries
.filter((entry) => entry.isIntersecting)
.sort((a, b) => Math.abs(a.boundingClientRect.top) - Math.abs(b.boundingClientRect.top))[0];
if (visible) setActive(visible.target.id);
},
{ rootMargin: "-22% 0px -62% 0px", threshold: 0.01 }
);
targets.forEach((target) => observer.observe(target));
} else if (links[0]) {
links[0].classList.add("active");
}
}
function setupCharts() {
if (!window.echarts) return;
const instances = [];
document.querySelectorAll("[data-chart]").forEach((block) => {
const canvas = block.querySelector(".chart-canvas");
const dataId = block.getAttribute("data-data");
const chartKind = block.getAttribute("data-chart");
const initialType = block.getAttribute("data-type") || "line";
const rows = readJson(dataId);
if (!canvas || !rows) return;
const chart = echarts.init(canvas, null, { renderer: "canvas" });
function optionFor(type) {
if (chartKind === "market-trend") return marketOption(rows, type);
if (chartKind === "share-ranking") return shareOption(rows, type);
return {};
}
chart.setOption(optionFor(initialType), true);
instances.push(chart);
block.querySelectorAll("[data-chart-type]").forEach((button) => {
button.classList.toggle("active", button.dataset.chartType === initialType);
button.addEventListener("click", () => {
block
.querySelectorAll("[data-chart-type]")
.forEach((item) => item.classList.toggle("active", item === button));
chart.setOption(optionFor(button.dataset.chartType), true);
});
});
});
window.addEventListener("resize", () => {
instances.forEach((chart) => chart.resize());
});
}
function setupMermaid() {
if (!window.mermaid || !document.querySelector(".mermaid")) return;
window.mermaid.initialize({
startOnLoad: true,
securityLevel: "loose",
theme: "base",
themeVariables: {
fontFamily: "-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica Neue, Arial, sans-serif",
primaryColor: "#eef4ff",
primaryBorderColor: "#b9cdfd",
primaryTextColor: "#2f302d",
lineColor: "#9aa1ad",
textColor: "#2f302d",
mainBkg: "#ffffff",
clusterBkg: "#f7f8fa",
clusterBorder: "#e6e8ec"
},
flowchart: {
htmlLabels: true,
curve: "basis",
padding: 14,
nodeSpacing: 42,
rankSpacing: 58
}
});
}
const lucideIcons = {
maximize2: [
["path", { d: "M15 3h6v6" }],
["path", { d: "m21 3-7 7" }],
["path", { d: "m3 21 7-7" }],
["path", { d: "M9 21H3v-6" }]
],
x: [
["path", { d: "M18 6 6 18" }],
["path", { d: "m6 6 12 12" }]
]
};
function lucideIcon(name) {
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
svg.setAttribute("class", "lucide-icon");
svg.setAttribute("viewBox", "0 0 24 24");
svg.setAttribute("aria-hidden", "true");
svg.setAttribute("focusable", "false");
(lucideIcons[name] || []).forEach(([tag, attrs]) => {
const child = document.createElementNS("http://www.w3.org/2000/svg", tag);
Object.entries(attrs).forEach(([key, value]) => child.setAttribute(key, value));
svg.appendChild(child);
});
return svg;
}
function setupDiagramZoom() {
const frames = Array.from(document.querySelectorAll(".mermaid-frame"));
if (!frames.length) return;
const lightbox = document.createElement("div");
const panel = document.createElement("div");
const close = document.createElement("button");
const content = document.createElement("div");
lightbox.className = "diagram-lightbox";
panel.className = "diagram-lightbox-panel";
close.className = "diagram-lightbox-close";
close.type = "button";
close.title = "Close";
close.setAttribute("aria-label", "Close enlarged diagram");
close.appendChild(lucideIcon("x"));
content.className = "diagram-lightbox-content";
panel.append(close, content);
lightbox.appendChild(panel);
document.body.appendChild(lightbox);
function closeLightbox() {
lightbox.classList.remove("open");
content.replaceChildren();
document.body.style.overflow = "";
}
function openLightbox(frame) {
const svg = frame.querySelector("svg");
const mermaidSource = frame.querySelector(".mermaid");
const clone = svg ? svg.cloneNode(true) : mermaidSource ? mermaidSource.cloneNode(true) : null;
if (!clone) return;
content.replaceChildren(clone);
lightbox.classList.add("open");
document.body.style.overflow = "hidden";
close.focus();
}
close.addEventListener("click", closeLightbox);
lightbox.addEventListener("click", (event) => {
if (event.target === lightbox) closeLightbox();
});
document.addEventListener("keydown", (event) => {
if (event.key === "Escape" && lightbox.classList.contains("open")) closeLightbox();
});
frames.forEach((frame) => {
if (frame.querySelector(".diagram-zoom-trigger")) return;
const button = document.createElement("button");
button.className = "diagram-zoom-trigger";
button.type = "button";
button.title = "Enlarge";
button.setAttribute("aria-label", "Enlarge diagram");
button.appendChild(lucideIcon("maximize2"));
button.addEventListener("click", () => openLightbox(frame));
frame.appendChild(button);
});
}
document.addEventListener("DOMContentLoaded", () => {
setupToc();
setupMermaid();
setupDiagramZoom();
setupCharts();
});
})();
File diff suppressed because one or more lines are too long