feat: 完成分龄页开发

This commit is contained in:
R524809
2026-05-06 17:28:51 +08:00
parent 50394154f7
commit 9bdf850f20
54 changed files with 3499 additions and 1021 deletions
@@ -1,7 +1,8 @@
import type { DebugPublishMeta } from '../../utils/debugPublish';
import { inferGradeFromAge } from '../../utils/debugPublish';
interface MathDrawDefinition {
/** 本地 worksheet 元数据(与云库 `worksheets` 文档 `_id` 对齐,用于发布与批量同步脚本) */
interface MathWorksheetDefinition {
id: string;
title: string;
subtitle: string;
@@ -12,7 +13,7 @@ interface MathDrawDefinition {
sortOrder: number;
}
const MATH_DRAW_DEFINITIONS = [
export const MATH_WORKSHEET_DEFINITIONS = [
{
id: 'number-find',
title: '找数字,涂一涂',
@@ -28,8 +29,8 @@ const MATH_DRAW_DEFINITIONS = [
id: 'number-write',
title: '看数字,写一写',
subtitle: '按笔画顺序书写数字',
ageMin: 3,
ageMax: 5,
ageMin: 4,
ageMax: 6,
difficulty: 1,
tags: ['数学', '数字书写', '描红'],
sortOrder: 102,
@@ -68,8 +69,8 @@ const MATH_DRAW_DEFINITIONS = [
id: 'number-object-fill',
title: '数物填写',
subtitle: '数出数量,填写对应数字',
ageMin: 3,
ageMax: 5,
ageMin: 4,
ageMax: 6,
difficulty: 1,
tags: ['数学', '数物对应', '填写'],
sortOrder: 106,
@@ -88,8 +89,8 @@ const MATH_DRAW_DEFINITIONS = [
id: 'counting-fill',
title: '数一数,填一填',
subtitle: '数出物品数量,填写数字',
ageMin: 3,
ageMax: 5,
ageMin: 4,
ageMax: 6,
difficulty: 1,
tags: ['数学', '计数', '填写'],
sortOrder: 108,
@@ -128,8 +129,8 @@ const MATH_DRAW_DEFINITIONS = [
id: 'number-decompose',
title: '10以内数的分与合',
subtitle: '把数字分一分,合一合',
ageMin: 4,
ageMax: 6,
ageMin: 5,
ageMax: 7,
difficulty: 1,
tags: ['数学', '分与合', '10以内'],
sortOrder: 112,
@@ -158,8 +159,8 @@ const MATH_DRAW_DEFINITIONS = [
id: 'addition-5',
title: '5以内加法',
subtitle: '图形化展示5以内加法',
ageMin: 3,
ageMax: 5,
ageMin: 4,
ageMax: 6,
difficulty: 1,
tags: ['数学', '加法', '5以内', '计算题'],
sortOrder: 115,
@@ -178,8 +179,8 @@ const MATH_DRAW_DEFINITIONS = [
id: 'subtraction-10',
title: '10以内减法',
subtitle: '图形化展示10以内减法',
ageMin: 4,
ageMax: 6,
ageMin: 5,
ageMax: 7,
difficulty: 2,
tags: ['数学', '减法', '10以内', '计算题'],
sortOrder: 117,
@@ -238,7 +239,7 @@ const MATH_DRAW_DEFINITIONS = [
id: 'practice-addition',
title: '加法运算',
subtitle: '10/20/50/100 以内加法',
ageMin: 5,
ageMin: 6,
ageMax: 8,
difficulty: 3,
tags: ['数学', '口算', '加法', '计算题'],
@@ -248,7 +249,7 @@ const MATH_DRAW_DEFINITIONS = [
id: 'practice-subtraction',
title: '减法运算',
subtitle: '10/20/50/100以内减法',
ageMin: 5,
ageMin: 6,
ageMax: 8,
difficulty: 3,
tags: ['数学', '口算', '减法', '计算题'],
@@ -258,7 +259,7 @@ const MATH_DRAW_DEFINITIONS = [
id: 'practice-mixed',
title: '混合运算',
subtitle: '10/20/50/100以内加减法混合',
ageMin: 5,
ageMin: 6,
ageMax: 8,
difficulty: 3,
tags: ['数学', '口算', '加减法', '计算题'],
@@ -268,19 +269,19 @@ const MATH_DRAW_DEFINITIONS = [
id: 'multiplication-table',
title: '九九乘法表',
subtitle: '学习九九乘法口诀',
ageMin: 6,
ageMin: 7,
ageMax: 8,
difficulty: 3,
tags: ['数学', '乘法', '九九乘法表'],
sortOrder: 126,
},
] as const satisfies ReadonlyArray<MathDrawDefinition>;
] as const satisfies ReadonlyArray<MathWorksheetDefinition>;
type MathDrawDefinitionItem = (typeof MATH_DRAW_DEFINITIONS)[number];
type MathWorksheetDefinitionItem = (typeof MATH_WORKSHEET_DEFINITIONS)[number];
const MATH_DRAW_BY_ID = Object.fromEntries(
MATH_DRAW_DEFINITIONS.map((item) => [item.id, item]),
) as Record<string, MathDrawDefinitionItem>;
const MATH_WORKSHEET_BY_ID = Object.fromEntries(
MATH_WORKSHEET_DEFINITIONS.map((item) => [item.id, item]),
) as Record<string, MathWorksheetDefinitionItem>;
function resolveMathPublishId(
routeId: string,
@@ -295,7 +296,7 @@ function resolveMathPublishId(
return 'number-object-fill';
}
if (routeId in MATH_DRAW_BY_ID) {
if (routeId in MATH_WORKSHEET_BY_ID) {
return routeId;
}
@@ -308,7 +309,7 @@ export function getPublishMetaByMathState(
mode?: string,
): DebugPublishMeta | null {
const id = resolveMathPublishId(routeId, selectedTypeId, mode);
const item = MATH_DRAW_BY_ID[id];
const item = MATH_WORKSHEET_BY_ID[id];
if (!item) return null;
return {