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

@@ -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}`);