feat(reducer): 二级减速器有头创建工具包与初学者教学

- tools/reducer:目录/前置/单件/批量/装配/自测,复用 cad-ui-rebuild 引擎
- 教学控制台新增「二级减速器」分组:23 件逐件课 + 装配课 + 环境课(job kind reducer-part / reducer-assembly)
- web/teaching/reducer-toolkit.html 初学者配套页(生成物)+ Playwright 双视口门禁
- 首页补工具入口;工具手册随 npm 脚本变更重生成

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 07:31:24 +08:00
parent dd8ba17591
commit b876ad5742
19 changed files with 1790 additions and 15 deletions

View File

@@ -0,0 +1,254 @@
#!/usr/bin/env node
/**
* Generate web/teaching/reducer-toolkit.html — the beginner companion page for
* the headed reducer toolkit (tools/reducer/).
*
* Deterministic: reads the toolkit catalog and the per-part UI step files, no
* timestamps, so `--check` can byte-compare. Running anything still happens in
* the teaching console (console.html) or by copying a command; this page never
* executes tools itself.
*
* Usage:
* node web/tools/teaching-console/build-reducer-page.mjs
* node web/tools/teaching-console/build-reducer-page.mjs --check
* Exit: 0 written/identical, 1 stale (--check), 2 bad arguments.
*/
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { REPO_ROOT, PROJECT_DIR, groups, parts, stats } from "../../../tools/reducer/catalog.mjs";
const HERE = path.dirname(fileURLToPath(import.meta.url));
const DEFAULT_OUT = path.resolve(HERE, "../../teaching/reducer-toolkit.html");
/** Common driver step labels → Chinese, so a beginner knows what will be clicked. */
const LABEL_ZH = {
"gear profile": "齿轮轮廓(渐开线参数)",
pad: "拉伸成实体",
"cut profile": "挖切轮廓",
cut: "挖切",
revolution: "旋转成轴",
"shaft profile": "轴的外形轮廓",
"outer profile": "外形轮廓",
"outer pad": "外壳拉伸",
"bore profile": "轴承孔轮廓",
bores: "镗轴承孔",
profile: "轮廓草图",
hub: "轮毂",
"hub profile": "轮毂轮廓",
flange: "法兰",
"flange profile": "法兰轮廓",
bore: "内孔",
"bolt profile": "螺栓孔轮廓",
"bolt pocket": "螺栓沉孔",
"inspection profile": "观察孔轮廓",
"inspection opening": "开观察孔",
"lifting profile": "吊耳轮廓",
"lifting threads": "吊耳螺纹孔",
};
function zh(label) {
if (LABEL_ZH[label]) return LABEL_ZH[label];
// Part-specific labels ("CoverCavityBossLeft profile") get a mechanical suffix.
if (label.endsWith(" profile")) return `${label.slice(0, -8)} 草图`;
if (/involute/i.test(label)) return `${label.replace(/ involute/i, "")} 渐开线齿廓`;
if (/keyseat/i.test(label)) return `${label.replace(/ keyseat.*/i, "")} 键槽`;
if (/blank/i.test(label)) return `${label.replace(/ blank/i, "")} 毛坯`;
return label;
}
function readSteps(document) {
try {
const payload = JSON.parse(fs.readFileSync(path.join(PROJECT_DIR, "out/ui-steps", `${document}.json`), "utf8"));
return payload.steps ?? [];
} catch {
return [];
}
}
function esc(text) {
return String(text ?? "").replace(/[&<>"]/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" }[c]));
}
function volumeText(volume) {
return volume == null ? "—" : `${Math.round(volume).toLocaleString("en-US")} mm³`;
}
function partCard(part) {
const steps = readSteps(part.document);
const rows = steps.map((step) => `<li><code>${esc(step.label)}</code><span class="zh">${esc(zh(step.label))}</span></li>`).join("");
return `<article class="part" id="${esc(part.id)}">
<div class="head"><h3>${esc(part.id)} · ${esc(part.title)}</h3><span class="pill">${part.steps} 步</span></div>
<div class="meta"><code>${esc(part.document)}</code> · 记录体积 ${esc(volumeText(part.volume))}</div>
<ol class="steps">${rows}</ol>
<pre class="cmd">cd "${esc(REPO_ROOT)}" &amp;&amp; DISPLAY=:1 node tools/reducer/create-part.mjs ${esc(part.id)}</pre>
<div class="links">
<a href="console.html">在教学控制台运行</a>
<a href="reducer-parts-manual.html#${esc(part.id)}">图文教案</a>
<a href="cases/reducer-replay.html?doc=${esc(part.document)}">建模回放</a>
</div>
</article>`;
}
function render() {
const summary = stats();
const all = parts();
const sections = groups().map((group) => {
const members = all.filter((part) => part.group === group.id);
return `<section class="group" id="group-${esc(group.id)}">
<h2>${esc(group.label)} <span class="muted small">${members.length} 件</span></h2>
<div class="parts">${members.map(partCard).join("")}</div>
</section>`;
}).join("");
return `<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>二级减速器 · 有头创建工具(初学者)</title>
<style>
:root{--bg:#0f1419;--panel:#17212b;--panel2:#1b2733;--line:#2a3a45;--text:#dbe6ee;--muted:#93a6b3;--accent:#73c6d4;--ok:#7fc98b;--warn:#e0b15c;--bad:#e58a8a;color-scheme:dark}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--text);font:15px/1.65 system-ui,-apple-system,"Segoe UI","Noto Sans CJK SC","Microsoft YaHei",sans-serif;overflow-wrap:break-word}
a{color:var(--accent);text-decoration:none}a:hover{text-decoration:underline}
code,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
code{background:#0b1117;border:1px solid var(--line);border-radius:4px;padding:.1em .35em;font-size:.9em}
header.top{position:sticky;top:0;z-index:10;display:flex;gap:14px;align-items:center;padding:10px 18px;background:rgba(15,20,25,.94);border-bottom:1px solid var(--line);backdrop-filter:blur(6px)}
header.top .brand{font-weight:650}
header.top .spacer{flex:1}
main{max-width:1180px;margin:0 auto;padding:18px}
h1{font-size:22px;margin:6px 0}
h2{font-size:17px;margin:26px 0 10px;border-bottom:1px solid var(--line);padding-bottom:6px}
h3{font-size:15px;margin:0}
.lead{color:#c6d6e2}
.muted{color:var(--muted)}.small{font-size:12.5px}
.card{background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:14px 16px;margin:12px 0}
.pill{background:var(--panel2);border:1px solid var(--line);border-radius:999px;padding:1px 9px;font-size:12px;color:var(--muted)}
.parts{display:grid;grid-template-columns:repeat(auto-fill,minmax(330px,1fr));gap:12px}
.part{background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:12px 14px}
.part .head{display:flex;gap:8px;align-items:center;justify-content:space-between}
.part .meta{color:var(--muted);font-size:12.5px;margin:4px 0 8px}
.steps{margin:6px 0 10px 18px;padding:0;font-size:13px}
.steps li{margin:2px 0}
.steps .zh{color:var(--muted);margin-left:6px;font-size:12.5px}
pre.cmd{background:#0b1117;border:1px solid var(--line);border-radius:8px;padding:8px 10px;font-size:12px;overflow:auto;white-space:pre-wrap;word-break:break-all}
.links{display:flex;gap:12px;flex-wrap:wrap;font-size:13px;margin-top:8px}
table{border-collapse:collapse;width:100%;font-size:13.5px}
th,td{border-bottom:1px solid var(--line);padding:6px 8px;text-align:left;vertical-align:top}
th{color:var(--muted);font-weight:500}
.note{border-left:3px solid var(--warn);padding:8px 12px;background:#1d1a12;border-radius:0 8px 8px 0;margin:10px 0}
@media (max-width:700px){.parts{grid-template-columns:1fr}main{padding:12px}}
@media print{header.top,.links,pre.cmd{display:none!important}}
</style>
</head>
<body>
<header class="top"><span class="brand">二级减速器 · 有头创建工具</span><span class="spacer"></span>
<a href="index.html">教学中心</a><a href="console.html">教学控制台</a><a href="reducer-parts-manual.html">图文教案</a></header>
<main>
<h1>在真实界面里造一台二级减速器</h1>
<p class="lead">${summary.parts} 个零件,${summary.steps} 个界面步骤,一步一步点出来;最后装配成整机。每一步都是真实浏览器里的操作,建完由界面算出的体积与构建记录逐件对照。</p>
<div class="card">
<h2 style="margin-top:0">先做三件事</h2>
<ol>
<li>构建前端:<code>cd web &amp;&amp; npx vite build</code>(改过 <code>web/src</code> 之后必做)。</li>
<li>检查环境:<code>node tools/reducer/create-part.mjs P01 --dry</code> —— 只看前置,不启动浏览器。</li>
<li>建第一个零件:下面任意一张卡片里的命令,或直接打开<a href="console.html">教学控制台</a>点「开始」。</li>
</ol>
<p class="small muted">有头运行需要图形环境(<code>DISPLAY=:1</code>)与 Chrome。所有证据落在 <code>docs/current/reducer-toolkit/runs/</code>,截图落在 <code>web/tools/reducer-parts-course/ui-stills/</code>。</p>
</div>
<div class="note"><strong>判定怎么读:</strong>通过 = 每一步都点到、最终体积与记录一致;产品失败(exit 1)= 界面建出的体积不对;前置失败(exit 2)= dist/内核/Chrome/DISPLAY/步骤文件缺失,此时还没开始点,不算产品问题。</div>
${sections}
<section class="group" id="assembly">
<h2>装配 <span class="muted small">1 台</span></h2>
<article class="part">
<div class="head"><h3>SecondaryReducer · 23 件合成整机</h3><span class="pill">插入链接</span></div>
<div class="meta">新建装配文档,按构建记录的位置与旋转逐个插入并接地;插入数与期望比对。</div>
<pre class="cmd">cd "${esc(REPO_ROOT)}" &amp;&amp; DISPLAY=:1 node tools/reducer/create-assembly.mjs</pre>
<div class="links"><a href="console.html">在教学控制台运行</a><a href="reducer-manual.html">初学者手册(设计原理)</a><a href="cases/reducer-course.html">视频课程</a></div>
</article>
</section>
<section class="group" id="tools">
<h2>这套工具本身</h2>
<table>
<thead><tr><th>命令</th><th>作用</th></tr></thead>
<tbody>
<tr><td><code>node tools/reducer/list.mjs</code></td><td>列出 23 个零件、分组、步数与体积</td></tr>
<tr><td><code>node tools/reducer/create-part.mjs P06</code></td><td>有头重建一个零件(P 编号或 Document 名都行)</td></tr>
<tr><td><code>node tools/reducer/create-part.mjs P06 --dry</code></td><td>只做前置检查,不启动浏览器</td></tr>
<tr><td><code>node tools/reducer/create-part.mjs P06 --slow</code></td><td>放慢点击,适合边看边学</td></tr>
<tr><td><code>node tools/reducer/create-all.mjs --group bearings</code></td><td>按组串行重建</td></tr>
<tr><td><code>node tools/reducer/create-all.mjs --all --keep-going</code></td><td>全部 23 件,出错继续</td></tr>
<tr><td><code>node tools/reducer/create-assembly.mjs</code></td><td>真实界面装配</td></tr>
<tr><td><code>node tools/reducer/self-test.mjs</code></td><td>无浏览器自测(目录、分组、参数校验、前置)</td></tr>
</tbody>
</table>
<p class="small muted">工具只做编排与前置检查;每一步的点击由共享引擎 <code>web/tools/cad-ui-rebuild/</code> 执行,构建记录来自 <code>web/teaching/cases/secondary-reducer-pro/out/replay/</code>,界面步骤来自 <code>web/tools/reducer-parts-course/out/ui-steps/</code>。</p>
</section>
<section class="group" id="troubleshooting">
<h2>常见问题</h2>
<table>
<thead><tr><th>现象</th><th>原因与处理</th></tr></thead>
<tbody>
<tr><td>退出码 2,日志里有「前置缺失」</td><td>dist、内核产物、Chrome、DISPLAY 或步骤文件缺失。照提示修,或用 <code>--dry</code> 看全部检查项。</td></tr>
<tr><td>退出码 1,体积不一致</td><td>界面建出的几何与构建记录不同,是产品回归;报告里给出两边体积与相对误差。</td></tr>
<tr><td>看不到浏览器窗口</td><td>有头需要可用的 X 显示;在带图形界面的会话里用 <code>DISPLAY=:1</code> 启动。</td></tr>
<tr><td>页面打开是空白/旧版本</td><td>先 <code>cd web &amp;&amp; npx vite build</code>,工具会自动为构建好的 dist 起临时服务。</td></tr>
</tbody>
</table>
</section>
<p class="small muted" style="margin:26px 0 40px">本页由 <code>web/tools/teaching-console/build-reducer-page.mjs</code> 生成,请勿手改。</p>
</main>
</body>
</html>
`;
}
function main() {
const argv = process.argv.slice(2);
let check = false;
let out = DEFAULT_OUT;
for (let index = 0; index < argv.length; index += 1) {
const arg = argv[index];
if (arg === "--check") check = true;
else if (arg === "--out") out = path.resolve(argv[++index] ?? DEFAULT_OUT);
else if (arg === "--help" || arg === "-h") {
console.log("node web/tools/teaching-console/build-reducer-page.mjs [--check] [--out <file>]");
process.exit(0);
} else {
console.error(`未知参数:${arg}`);
process.exit(2);
}
}
const html = render();
if (check) {
let existing = "";
try {
existing = fs.readFileSync(out, "utf8");
} catch {
console.error(`FAIL --check:目标文件不存在 ${out}`);
process.exit(1);
}
if (existing === html) {
console.log("check: OK(reducer-toolkit.html 已是最新)");
return;
}
let offset = 0;
while (offset < existing.length && offset < html.length && existing[offset] === html[offset]) offset += 1;
console.error(`FAIL --check:不一致(首个差异偏移 ${offset})`);
process.exit(1);
}
fs.mkdirSync(path.dirname(out), { recursive: true });
fs.writeFileSync(out, html);
console.log(`written ${path.relative(REPO_ROOT, out)} (${(Buffer.byteLength(html) / 1024).toFixed(0)} KB)`);
}
main();

View File

@@ -194,6 +194,23 @@ async function checkLive(browser) {
await page.waitForFunction(() => /已取消/.test(document.getElementById("verdict").textContent), null, { timeout: 60000 });
console.log("live: cancel ok");
// Reducer lesson: runs tools/reducer/create-part.mjs P06 headed and maps
// the part report into the same verdict / results / evidence UI.
await page.fill("#search", "P06");
await page.click('#course-list button[data-id="lesson-reducer-p06"]');
await page.click("#run");
await page.waitForFunction(() => document.getElementById("terminal").textContent.includes("零件 P06"), null, { timeout: 120000 });
await page.waitForFunction(() => /通过|失败|运行失败|超时/.test(document.getElementById("verdict").textContent), null, { timeout: 360000 });
const reducer = await page.evaluate(() => ({
verdict: document.getElementById("verdict").textContent,
rows: document.querySelectorAll("#results tbody tr").length,
evidence: document.querySelectorAll("#evidence a").length,
}));
if (!/通过/.test(reducer.verdict)) note(`live reducer: 判定为「${reducer.verdict}」`);
if (reducer.rows < 1) note("live reducer: 结果表没有零件行");
if (reducer.evidence < 1) note("live reducer: 没有证据链接");
console.log(`live reducer: verdict=${reducer.verdict} rows=${reducer.rows} evidence=${reducer.evidence}`);
// Mobile layout on the same live server.
await page.setViewportSize({ width: 390, height: 844 });
await page.waitForTimeout(300);

View File

@@ -0,0 +1,97 @@
#!/usr/bin/env node
/**
* Browser gate for the beginner page web/teaching/reducer-toolkit.html.
*
* Opens the generated page over file:// (it must be self-contained and readable
* with no server) and asserts: 23 part cards, every group section present,
* copyable commands and links to the console / replay / parts manual, no
* template leakage, no pageerror/console/request failures, and zero horizontal
* overflow at 1440×900 and 390×844.
*
* Prerequisite: playwright resolvable from web/node_modules.
* Exit: 0 pass / 1 page problem / 2 prerequisite missing.
*
* Usage: node web/tools/teaching-console/check-reducer-page.mjs
*/
import path from "node:path";
import { pathToFileURL } from "node:url";
import { createRequire } from "node:module";
import { fileURLToPath } from "node:url";
const HERE = path.dirname(fileURLToPath(import.meta.url));
const REPO = path.resolve(HERE, "../../..");
const require = createRequire(path.join(REPO, "web/package.json"));
const PAGE = path.join(REPO, "web/teaching/reducer-toolkit.html");
const failures = [];
const note = (message) => { failures.push(message); console.error(`FAIL ${message}`); };
let chromium;
try {
({ chromium } = require("playwright"));
} catch {
console.error("前置缺失:web/node_modules 下没有 playwright");
process.exit(2);
}
const VIEWPORTS = [{ width: 1440, height: 900 }, { width: 390, height: 844 }];
const browser = await chromium.launch({ headless: true, args: ["--no-sandbox", "--disable-dev-shm-usage"] });
const page = await browser.newPage({ viewport: VIEWPORTS[0] });
const pageErrors = [];
const consoleErrors = [];
const failedRequests = [];
page.on("pageerror", (error) => pageErrors.push(String(error.message ?? error)));
page.on("console", (message) => { if (message.type() === "error") consoleErrors.push(message.text()); });
page.on("requestfailed", (request) => failedRequests.push(`${request.url()} ${request.failure()?.errorText ?? ""}`));
const response = await page.goto(pathToFileURL(PAGE).href, { waitUntil: "load" });
if (!response) note("file:// 打开页面失败(无 response)");
const dom = await page.evaluate(() => {
const text = document.body.innerText;
const partIds = [...document.querySelectorAll("article.part[id]")].map((node) => node.id);
const hrefs = [...document.querySelectorAll("a[href]")].map((node) => node.getAttribute("href"));
const commands = [...document.querySelectorAll("code")].map((node) => node.textContent).join("\n");
return {
partIds,
groups: document.querySelectorAll("section.group").length,
hrefs,
hasConsole: hrefs.some((href) => /console\.html/.test(href)),
hasReplay: hrefs.some((href) => /reducer-replay\.html\?doc=/.test(href)),
hasManual: hrefs.some((href) => /reducer-parts-manual\.html#P\d{2}/.test(href)),
hasIndex: hrefs.some((href) => /(^|\/)index\.html$/.test(href)),
command: /create-part\.mjs P\d{2}/.test(commands) && /create-assembly\.mjs/.test(commands),
leakage: ["[object Object]", "undefined", "NaN", "${"].filter((token) => text.includes(token)),
};
});
const expectedIds = Array.from({ length: 23 }, (_, index) => `P${String(index + 1).padStart(2, "0")}`);
const missing = expectedIds.filter((id) => !dom.partIds.includes(id));
if (dom.partIds.length !== 23) note(`零件卡片 ${dom.partIds.length} 张,应为 23 张`);
if (missing.length) note(`缺少零件卡片:${missing.join(", ")}`);
if (dom.groups < 10) note(`分组区仅 ${dom.groups} 个,应至少 10 个(7 组 + 装配/工具/排错)`);
if (!dom.hasConsole) note("没有跳转教学控制台的链接");
if (!dom.hasReplay) note("没有跳转建模回放的链接");
if (!dom.hasManual) note("没有跳转图文教案(reducer-parts-manual.html#P0x)的链接");
if (!dom.hasIndex) note("没有返回 index.html 的链接");
if (!dom.command) note("缺少可复制的 create-part / create-assembly 命令");
for (const token of dom.leakage) note(`模板泄漏标记:${token}`);
for (const error of pageErrors) note(`pageerror: ${error}`);
for (const error of consoleErrors) note(`console: ${error}`);
for (const error of failedRequests) note(`request: ${error}`);
for (const viewport of VIEWPORTS) {
await page.setViewportSize(viewport);
await page.waitForTimeout(120);
const overflow = await page.evaluate(() => Math.max(0, document.documentElement.scrollWidth - window.innerWidth));
if (overflow > 0) note(`${viewport.width}px: 横向溢出 ${overflow}px`);
console.log(`${viewport.width}x${viewport.height}: overflow=${overflow}`);
}
await browser.close();
if (failures.length) {
console.error(`\nreducer-toolkit.html 门禁失败:${failures.length} 项`);
process.exit(1);
}
console.log(`\nreducer-toolkit.html 门禁通过:23 张零件卡片 / ${dom.groups} 个分组区 / 双视口 0 溢出`);

View File

@@ -8,8 +8,11 @@
* against catalog.mjs and fails the build if one no longer exists.
*/
import { groups as reducerGroups, parts as reducerParts } from "../../../tools/reducer/catalog.mjs";
export const GROUPS = [
{ id: "basics", title: "准备:让环境可用", workbench: "系统", blurb: "先证明 dist、Chrome、显示和静态服务都就绪,再谈功能。" },
{ id: "reducer", title: "二级减速器:逐件建模", workbench: "Reducer", blurb: "23 个零件各自一课,在真实界面里从头建出来;最后是装配课。" },
{ id: "shell", title: "壳层与入口", workbench: "Shell", blurb: "COOP/COEP 隔离、工作台外壳、命令面板与偏好——所有功能的前提。" },
{ id: "part", title: "Part:参数化零件", workbench: "Part", blurb: "图元、布尔、任务面板;最直观的建模入口。" },
{ id: "partdesign", title: "PartDesign:实体特征", workbench: "PartDesign", blurb: "Body、草图、Pad 与边缘特征、Thickness。" },
@@ -258,8 +261,54 @@ function crosscutLessons(catalog) {
}));
}
function volumeText(volume) {
return volume == null ? "—" : `${Math.round(volume).toLocaleString("en-US")} mm³`;
}
/** The 23-part reducer curriculum comes from the toolkit catalog, not a copy. */
function reducerLessons() {
const parts = reducerParts();
const byGroup = new Map(reducerGroups().map((group) => [group.id, group.label]));
const intro = [
{
id: "lesson-reducer-environment",
groupId: "reducer",
title: "减速器 · 环境自检(不启动浏览器)",
level: "入门",
durationMin: 1,
summary: "23 个零件都有界面步骤与构建记录,但先要确认 dist、内核、Chrome、DISPLAY 就绪。本课用 dry run 只做前置检查。",
sees: ["八项前置检查的真实结果", "提示缺失项可直接执行的修复命令"],
expect: "前置全部满足;缺项时判定为「前置失败」,不启动浏览器。",
job: { kind: "reducer-part", partId: parts[0]?.id ?? "P01", dry: true },
},
];
const perPart = parts.map((part) => ({
id: `lesson-reducer-${part.id.toLowerCase()}`,
groupId: "reducer",
title: `${part.id} · ${part.title}`,
level: part.steps <= 2 ? "入门" : "进阶",
durationMin: Math.max(2, part.steps + 2),
summary: `在真实界面里重建 ${part.document}(${byGroup.get(part.group) ?? part.group}):共 ${part.steps} 步,完成后界面算出的体积应与构建记录 ${volumeText(part.volume)} 一致。`,
sees: ["有头 Chrome 打开 PartDesign 页面并逐步点击", "每步一张截图,最终体积与记录对比"],
expect: `create-part ${part.id} 判 pass(体积相对误差在引擎容差内)。`,
job: { kind: "reducer-part", partId: part.id },
}));
const assembly = {
id: "lesson-reducer-assembly",
groupId: "reducer",
title: "装配 · 23 件合成二级减速器",
level: "进阶",
durationMin: 15,
summary: "新建装配文档,按构建记录的位置与旋转逐个插入链接并接地。装配的输入就是前面 23 节课建出来的零件数据。",
sees: ["装配文档中出现全部零件链接", "插入数量与期望一致、无失配"],
expect: "create-assembly 判 pass;失配或插入不全判产品失败。",
job: { kind: "reducer-assembly" },
};
return [...intro, ...perPart, assembly];
}
export function buildLessons(catalog) {
const lessons = [...CORE_LESSONS, ...chapterLessons(catalog), ...moduleLessons(catalog), ...crosscutLessons(catalog)];
const lessons = [...CORE_LESSONS, ...reducerLessons(), ...chapterLessons(catalog), ...moduleLessons(catalog), ...crosscutLessons(catalog)];
const seen = new Set();
for (const lesson of lessons) {
if (seen.has(lesson.id)) throw new Error(`课程 id 重复:${lesson.id}`);

View File

@@ -372,6 +372,7 @@ summary{cursor:pointer;font-size:13.5px}
links.push('<a href="' + esc(base) + '/GAPS.md" target="_blank" rel="noopener">GAPS.md</a>');
}
if (job.kind === "probe") links.push('<a href="/api/console/artifacts/' + esc(job.jobId) + '/layout.json" target="_blank" rel="noopener">布局报告 JSON</a>');
if (job.kind === "reducer-part" || job.kind === "reducer-assembly") links.push('<a href="/api/console/artifacts/' + esc(job.jobId) + '/report.json" target="_blank" rel="noopener">零件/装配报告 JSON</a>');
if (job.origin) links.push('<span class="small muted">本次运行 origin:<code>' + esc(job.origin) + '</code></span>');
$("evidence").innerHTML = links.length ? links.map(function(x){ return '<div>' + x + '</div>'; }).join("") : '<p class="muted small">运行结束后可打开完整报告与截图。</p>';
}