feat: 更新内容管理方案
@@ -1,29 +1,21 @@
|
||||
import type { DifficultyLevel } from '../models/worksheet';
|
||||
import type { Difficulty } from '../models/worksheet';
|
||||
|
||||
/** 产品文档:难度 入门 / 基础 / 进阶 / 挑战 → 云库 difficulty 1–4 */
|
||||
export const DIFFICULTY_LEVEL_TO_STARS: Record<
|
||||
DifficultyLevel,
|
||||
1 | 2 | 3 | 4
|
||||
> = {
|
||||
export const DIFFICULTY_LEVEL_TO_STARS: Record<Difficulty, 1 | 2 | 3 | 4> = {
|
||||
beginner: 1,
|
||||
basic: 2,
|
||||
intermediate: 3,
|
||||
advanced: 4,
|
||||
};
|
||||
|
||||
export const STARS_TO_DIFFICULTY_LEVEL: Record<
|
||||
1 | 2 | 3 | 4,
|
||||
DifficultyLevel
|
||||
> = {
|
||||
export const STARS_TO_DIFFICULTY_LEVEL: Record<1 | 2 | 3 | 4, Difficulty> = {
|
||||
1: 'beginner',
|
||||
2: 'basic',
|
||||
3: 'intermediate',
|
||||
4: 'advanced',
|
||||
};
|
||||
|
||||
export function difficultyToStars(
|
||||
level?: DifficultyLevel,
|
||||
): 1 | 2 | 3 | 4 {
|
||||
export function difficultyToStars(level?: Difficulty): 1 | 2 | 3 | 4 {
|
||||
return level ? DIFFICULTY_LEVEL_TO_STARS[level] : 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ import { CategoryId } from './category';
|
||||
* 题型与模板引擎相关模型:对齐技术架构 §5.4 与云开发 worksheets 集合 §3.3
|
||||
*/
|
||||
|
||||
/** 难度等级文案键(用于前端展示与映射) */
|
||||
export type Difficulty = 'beginner' | 'basic' | 'intermediate' | 'advanced';
|
||||
|
||||
/** 与架构文档 WorksheetConfig 一致,供云端下发 / 本地内置 */
|
||||
export interface WorksheetConfig {
|
||||
id: string;
|
||||
|
||||
@@ -319,7 +319,7 @@ export function generateLetterTracing(
|
||||
|
||||
const letterImgPath = `/englishPages/shared/assets/letter/${key}.png`;
|
||||
|
||||
const wordImgPath = `/englishPages/shared/assets/letterImgs/Apple.png`;
|
||||
const wordImgPath = `/englishPages/shared/assets/letterImgs/${meta.word}.png`;
|
||||
|
||||
const teaching: TeachingBlock = {
|
||||
upper,
|
||||
|
||||
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 23 KiB |
@@ -16,7 +16,7 @@ export const ALPHABET_BY_LETTER: Record<string, AlphabetEntry> = {
|
||||
F: { word: 'Fish', emoji: '🐟' },
|
||||
G: { word: 'Girl', emoji: '👧' },
|
||||
H: { word: 'House', emoji: '🏠' },
|
||||
I: { word: 'Ice', emoji: '🧊' },
|
||||
I: { word: 'Icecream', emoji: '🍦' },
|
||||
J: { word: 'Juice', emoji: '🧃' },
|
||||
K: { word: 'Kite', emoji: '🪁' },
|
||||
L: { word: 'Lion', emoji: '🦁' },
|
||||
@@ -29,10 +29,10 @@ export const ALPHABET_BY_LETTER: Record<string, AlphabetEntry> = {
|
||||
S: { word: 'Sun', emoji: '☀️' },
|
||||
T: { word: 'Tree', emoji: '🌳' },
|
||||
U: { word: 'Umbrella', emoji: '☂️' },
|
||||
V: { word: 'Van', emoji: '🚐' },
|
||||
V: { word: 'Vegetable', emoji: '🥬' },
|
||||
W: { word: 'Water', emoji: '💧' },
|
||||
X: { word: 'X-ray', emoji: '🦴' },
|
||||
Y: { word: 'Yacht', emoji: '⛵' },
|
||||
X: { word: 'Xylophone', emoji: '�' },
|
||||
Y: { word: 'Yak', emoji: '⛵' },
|
||||
Z: { word: 'Zebra', emoji: '🦓' },
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,187 @@
|
||||
import type { DebugPublishMeta } from '../../utils/debugPublish';
|
||||
import { inferGradeFromAge } from '../../utils/debugPublish';
|
||||
|
||||
interface FocusDrawDefinition {
|
||||
id: string;
|
||||
title: string;
|
||||
subtitle: string;
|
||||
ageMin: number;
|
||||
ageMax: number;
|
||||
difficulty: 1 | 2 | 3 | 4;
|
||||
tags: string[];
|
||||
sortOrder: number;
|
||||
}
|
||||
|
||||
const FOCUS_DRAW_DEFINITIONS = [
|
||||
{
|
||||
id: 'color-shape-match',
|
||||
title: '根据颜色画图形',
|
||||
subtitle: '根据颜色画出对应图形',
|
||||
ageMin: 4,
|
||||
ageMax: 6,
|
||||
difficulty: 2,
|
||||
tags: ['专注力', '颜色', '图形'],
|
||||
sortOrder: 201,
|
||||
},
|
||||
{
|
||||
id: 'shape-symbol',
|
||||
title: '图形符号配对',
|
||||
subtitle: '根据图形画对应符号',
|
||||
ageMin: 4,
|
||||
ageMax: 6,
|
||||
difficulty: 2,
|
||||
tags: ['专注力', '图形', '符号'],
|
||||
sortOrder: 202,
|
||||
},
|
||||
{
|
||||
id: 'position-coloring',
|
||||
title: '方位涂涂乐',
|
||||
subtitle: '观察位置,在方格中涂色',
|
||||
ageMin: 4,
|
||||
ageMax: 6,
|
||||
difficulty: 2,
|
||||
tags: ['专注力', '方位', '涂色'],
|
||||
sortOrder: 203,
|
||||
},
|
||||
{
|
||||
id: 'color-pattern',
|
||||
title: '颜色找规律',
|
||||
subtitle: '观察颜色规律,在空白图形中涂色',
|
||||
ageMin: 4,
|
||||
ageMax: 6,
|
||||
difficulty: 2,
|
||||
tags: ['专注力', '颜色', '规律'],
|
||||
sortOrder: 204,
|
||||
},
|
||||
{
|
||||
id: 'match-connect',
|
||||
title: '连连看',
|
||||
subtitle: '根据物品连一连',
|
||||
ageMin: 3,
|
||||
ageMax: 6,
|
||||
difficulty: 1,
|
||||
tags: ['专注力', '连线', '匹配'],
|
||||
sortOrder: 205,
|
||||
},
|
||||
{
|
||||
id: 'line-recognition',
|
||||
title: '线条识别',
|
||||
subtitle: '认识不同线条,画出颜色对应的线条',
|
||||
ageMin: 3,
|
||||
ageMax: 5,
|
||||
difficulty: 1,
|
||||
tags: ['专注力', '线条', '识别', '控笔'],
|
||||
sortOrder: 206,
|
||||
},
|
||||
{
|
||||
id: 'grid-reasoning',
|
||||
title: '方格推理',
|
||||
subtitle: '推理出合并方格并连线',
|
||||
ageMin: 5,
|
||||
ageMax: 7,
|
||||
difficulty: 3,
|
||||
tags: ['专注力', '方格', '推理', '逻辑思维'],
|
||||
sortOrder: 207,
|
||||
},
|
||||
{
|
||||
id: 'code-connect',
|
||||
title: '译码连线',
|
||||
subtitle: '按数字顺序将数字对应颜色连线',
|
||||
ageMin: 5,
|
||||
ageMax: 7,
|
||||
difficulty: 3,
|
||||
tags: ['专注力', '译码', '连线', '逻辑思维'],
|
||||
sortOrder: 208,
|
||||
},
|
||||
{
|
||||
id: 'dot-connect',
|
||||
title: '数字点连线',
|
||||
subtitle: '按数字顺序连点成图',
|
||||
ageMin: 3,
|
||||
ageMax: 6,
|
||||
difficulty: 1,
|
||||
tags: ['专注力', '数字', '连线'],
|
||||
sortOrder: 209,
|
||||
},
|
||||
{
|
||||
id: 'grid-drawing-3x3',
|
||||
title: '格子仿画 3×3',
|
||||
subtitle: '简单有趣,培养专注力',
|
||||
ageMin: 3,
|
||||
ageMax: 5,
|
||||
difficulty: 1,
|
||||
tags: ['专注力', '格子仿画', '观察'],
|
||||
sortOrder: 210,
|
||||
},
|
||||
{
|
||||
id: 'grid-drawing-5x5',
|
||||
title: '格子仿画 5×5',
|
||||
subtitle: '创意挑战,提升观察力',
|
||||
ageMin: 4,
|
||||
ageMax: 6,
|
||||
difficulty: 2,
|
||||
tags: ['专注力', '格子仿画', '观察'],
|
||||
sortOrder: 211,
|
||||
},
|
||||
{
|
||||
id: 'grid-drawing-7x7',
|
||||
title: '格子仿画 7×7',
|
||||
subtitle: '大师挑战,锻炼耐心',
|
||||
ageMin: 5,
|
||||
ageMax: 8,
|
||||
difficulty: 3,
|
||||
tags: ['专注力', '格子仿画', '耐心'],
|
||||
sortOrder: 212,
|
||||
},
|
||||
] as const satisfies ReadonlyArray<FocusDrawDefinition>;
|
||||
|
||||
type FocusDrawDefinitionItem = (typeof FOCUS_DRAW_DEFINITIONS)[number];
|
||||
|
||||
const FOCUS_DRAW_BY_ID = Object.fromEntries(
|
||||
FOCUS_DRAW_DEFINITIONS.map((item) => [item.id, item]),
|
||||
) as Record<string, FocusDrawDefinitionItem>;
|
||||
|
||||
function resolveFocusPublishId(
|
||||
routeId: string,
|
||||
selectedTypeId: string,
|
||||
mode?: string,
|
||||
): string {
|
||||
if (selectedTypeId === 'grid-drawing') {
|
||||
return `grid-drawing-${mode || '3x3'}`;
|
||||
}
|
||||
|
||||
if (routeId in FOCUS_DRAW_BY_ID) {
|
||||
return routeId;
|
||||
}
|
||||
|
||||
return selectedTypeId;
|
||||
}
|
||||
|
||||
export function getPublishMetaByFocusState(
|
||||
routeId: string,
|
||||
selectedTypeId: string,
|
||||
mode?: string,
|
||||
): DebugPublishMeta | null {
|
||||
const id = resolveFocusPublishId(routeId, selectedTypeId, mode);
|
||||
const item = FOCUS_DRAW_BY_ID[id];
|
||||
if (!item) return null;
|
||||
|
||||
return {
|
||||
id: item.id,
|
||||
title: item.title,
|
||||
subtitle: item.subtitle,
|
||||
category: 'puzzle',
|
||||
subcategory: 'focus-draw',
|
||||
path: `/focusPages/focusDraw/focusDraw?id=${item.id}`,
|
||||
ageMin: item.ageMin,
|
||||
ageMax: item.ageMax,
|
||||
grade: inferGradeFromAge(item.ageMin, item.ageMax),
|
||||
difficulty: item.difficulty,
|
||||
previewImg: '',
|
||||
tags: [...item.tags],
|
||||
isNew: false,
|
||||
isHot: false,
|
||||
sortOrder: item.sortOrder,
|
||||
status: 'draft',
|
||||
};
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
"share-guide-popup": "../../components/share-guide-popup/share-guide-popup",
|
||||
"draw-ad": "../../components/draw-ad/draw-ad",
|
||||
"preview-footer-actions": "../../components3.0/preview-footer-actions/preview-footer-actions",
|
||||
"debug-publish-tools": "../../components3.0/debug-publish-tools/debug-publish-tools",
|
||||
"toy-icon": "../../toy/icon/icon",
|
||||
"preview-card": "../../components3.0/preview-card/preview-card"
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import {
|
||||
type FocusTypeConfig,
|
||||
type FocusTypeAction,
|
||||
} from './registry';
|
||||
import { getPublishMetaByFocusState } from './focusDraw.config';
|
||||
import type { DebugPublishMeta } from '../../utils/debugPublish';
|
||||
|
||||
const TYPE_LIST = FOCUS_TYPE_CONFIGS.map((t) => ({
|
||||
id: t.id,
|
||||
@@ -36,6 +38,10 @@ createFocusPage({
|
||||
currentActions: [] as FocusTypeAction[],
|
||||
currentMode: '',
|
||||
isPreviewFavorite: false,
|
||||
isDevEnv: false,
|
||||
debugPublishVisible: false,
|
||||
debugPublishLoading: false,
|
||||
debugPublishMeta: null as DebugPublishMeta | null,
|
||||
},
|
||||
|
||||
onLoad(options: { id?: string; mode?: string }) {
|
||||
@@ -43,6 +49,8 @@ createFocusPage({
|
||||
const result = findTypeByRouteId(routeId);
|
||||
if (!result) return;
|
||||
|
||||
this.syncDebugPublishEnv();
|
||||
|
||||
const { typeConfig, mode } = result;
|
||||
const initialMode =
|
||||
options.mode || mode || typeConfig.defaultMode || '';
|
||||
@@ -196,4 +204,16 @@ createFocusPage({
|
||||
icon: 'none',
|
||||
});
|
||||
},
|
||||
|
||||
getPublishMeta(): DebugPublishMeta {
|
||||
const meta = getPublishMetaByFocusState(
|
||||
this.data.functionId,
|
||||
this.data.selectedTypeId,
|
||||
this.data.currentMode,
|
||||
);
|
||||
if (!meta) {
|
||||
throw new Error('当前题型配置不存在');
|
||||
}
|
||||
return meta;
|
||||
},
|
||||
});
|
||||
|
||||
@@ -75,6 +75,16 @@
|
||||
bind:primary="exportToPrint"
|
||||
bind:secondary="onShare" />
|
||||
|
||||
<debug-publish-tools
|
||||
wx:if="{{isDevEnv && hasContent}}"
|
||||
id="debugPublishTools"
|
||||
visible="{{debugPublishVisible}}"
|
||||
loading="{{debugPublishLoading}}"
|
||||
meta="{{debugPublishMeta}}"
|
||||
bind:open="onOpenDebugPublish"
|
||||
bind:close="onCloseDebugPublish"
|
||||
bind:confirm="onConfirmDebugPublish" />
|
||||
|
||||
<!-- 分享引导弹窗 -->
|
||||
<share-guide-popup
|
||||
show="{{showShareDialog}}"
|
||||
|
||||
@@ -0,0 +1,331 @@
|
||||
import type { DebugPublishMeta } from '../../utils/debugPublish';
|
||||
import { inferGradeFromAge } from '../../utils/debugPublish';
|
||||
|
||||
interface MathDrawDefinition {
|
||||
id: string;
|
||||
title: string;
|
||||
subtitle: string;
|
||||
ageMin: number;
|
||||
ageMax: number;
|
||||
difficulty: 1 | 2 | 3 | 4;
|
||||
tags: string[];
|
||||
sortOrder: number;
|
||||
}
|
||||
|
||||
const MATH_DRAW_DEFINITIONS = [
|
||||
{
|
||||
id: 'number-find',
|
||||
title: '找数字,涂一涂',
|
||||
subtitle: '在数字方阵中找出目标数字并涂色',
|
||||
ageMin: 3,
|
||||
ageMax: 5,
|
||||
difficulty: 1,
|
||||
tags: ['数学', '数字认知', '涂色'],
|
||||
sortOrder: 101,
|
||||
},
|
||||
{
|
||||
id: 'number-write',
|
||||
title: '看数字,写一写',
|
||||
subtitle: '按笔画顺序练习书写数字',
|
||||
ageMin: 3,
|
||||
ageMax: 5,
|
||||
difficulty: 1,
|
||||
tags: ['数学', '数字书写', '描红'],
|
||||
sortOrder: 102,
|
||||
},
|
||||
{
|
||||
id: 'number-coloring',
|
||||
title: '按数字,涂颜色',
|
||||
subtitle: '按指定数字给对应圆圈涂色',
|
||||
ageMin: 3,
|
||||
ageMax: 5,
|
||||
difficulty: 1,
|
||||
tags: ['数学', '数字认知', '涂色'],
|
||||
sortOrder: 103,
|
||||
},
|
||||
{
|
||||
id: 'counting-matching',
|
||||
title: '数一数,连一连',
|
||||
subtitle: '连线配对数字和对应数量图形',
|
||||
ageMin: 3,
|
||||
ageMax: 5,
|
||||
difficulty: 1,
|
||||
tags: ['数学', '计数', '连线'],
|
||||
sortOrder: 104,
|
||||
},
|
||||
{
|
||||
id: 'number-object-match',
|
||||
title: '数物连线',
|
||||
subtitle: '连线相同数量的物品和数字',
|
||||
ageMin: 3,
|
||||
ageMax: 5,
|
||||
difficulty: 1,
|
||||
tags: ['数学', '数物对应', '连线'],
|
||||
sortOrder: 105,
|
||||
},
|
||||
{
|
||||
id: 'number-object-fill',
|
||||
title: '数物填写',
|
||||
subtitle: '数物品数量,填写对应数字',
|
||||
ageMin: 3,
|
||||
ageMax: 5,
|
||||
difficulty: 1,
|
||||
tags: ['数学', '数物对应', '填写'],
|
||||
sortOrder: 106,
|
||||
},
|
||||
{
|
||||
id: 'counting-select',
|
||||
title: '数一数,选一选',
|
||||
subtitle: '数出物品数量,圈出正确答案',
|
||||
ageMin: 3,
|
||||
ageMax: 5,
|
||||
difficulty: 1,
|
||||
tags: ['数学', '计数', '选择'],
|
||||
sortOrder: 107,
|
||||
},
|
||||
{
|
||||
id: 'counting-fill',
|
||||
title: '数一数,填一填',
|
||||
subtitle: '数出物品数量,填写数字',
|
||||
ageMin: 3,
|
||||
ageMax: 5,
|
||||
difficulty: 1,
|
||||
tags: ['数学', '计数', '填写'],
|
||||
sortOrder: 108,
|
||||
},
|
||||
{
|
||||
id: 'compare',
|
||||
title: '数一数,比大小',
|
||||
subtitle: '比较数量,填入 ><=',
|
||||
ageMin: 4,
|
||||
ageMax: 6,
|
||||
difficulty: 2,
|
||||
tags: ['数学', '比较', '数量'],
|
||||
sortOrder: 109,
|
||||
},
|
||||
{
|
||||
id: 'number-sort',
|
||||
title: '数字排序',
|
||||
subtitle: '写出正确的数字顺序',
|
||||
ageMin: 4,
|
||||
ageMax: 6,
|
||||
difficulty: 2,
|
||||
tags: ['数学', '数字排序', '序列'],
|
||||
sortOrder: 110,
|
||||
},
|
||||
{
|
||||
id: 'missing-number',
|
||||
title: '填上缺少的数字',
|
||||
subtitle: '在数列中找出并填写缺失数字',
|
||||
ageMin: 4,
|
||||
ageMax: 6,
|
||||
difficulty: 2,
|
||||
tags: ['数学', '数字序列', '填写'],
|
||||
sortOrder: 111,
|
||||
},
|
||||
{
|
||||
id: 'number-decompose',
|
||||
title: '10以内数的分与合',
|
||||
subtitle: '把数字分一分,合一合',
|
||||
ageMin: 4,
|
||||
ageMax: 6,
|
||||
difficulty: 1,
|
||||
tags: ['数学', '分与合', '10以内'],
|
||||
sortOrder: 112,
|
||||
},
|
||||
{
|
||||
id: 'number-decompose-20',
|
||||
title: '20以内数的分与合',
|
||||
subtitle: '把数字分一分,合一合',
|
||||
ageMin: 5,
|
||||
ageMax: 7,
|
||||
difficulty: 2,
|
||||
tags: ['数学', '分与合', '20以内'],
|
||||
sortOrder: 113,
|
||||
},
|
||||
{
|
||||
id: 'one-digit-addition',
|
||||
title: '一位数加法',
|
||||
subtitle: '通过圆点学习一位数加法运算',
|
||||
ageMin: 4,
|
||||
ageMax: 6,
|
||||
difficulty: 2,
|
||||
tags: ['数学', '加法', '一位数'],
|
||||
sortOrder: 114,
|
||||
},
|
||||
{
|
||||
id: 'addition-5',
|
||||
title: '5以内加法',
|
||||
subtitle: '图形化展示 5 以内加法',
|
||||
ageMin: 3,
|
||||
ageMax: 5,
|
||||
difficulty: 1,
|
||||
tags: ['数学', '加法', '5以内', '计算题'],
|
||||
sortOrder: 115,
|
||||
},
|
||||
{
|
||||
id: 'addition-10',
|
||||
title: '10以内加法',
|
||||
subtitle: '图形化展示 10 以内加法',
|
||||
ageMin: 4,
|
||||
ageMax: 6,
|
||||
difficulty: 2,
|
||||
tags: ['数学', '加法', '10以内', '计算题'],
|
||||
sortOrder: 116,
|
||||
},
|
||||
{
|
||||
id: 'subtraction-10',
|
||||
title: '10以内减法',
|
||||
subtitle: '图形化展示 10 以内减法',
|
||||
ageMin: 4,
|
||||
ageMax: 6,
|
||||
difficulty: 2,
|
||||
tags: ['数学', '减法', '10以内', '计算题'],
|
||||
sortOrder: 117,
|
||||
},
|
||||
{
|
||||
id: 'addition-subtraction-10',
|
||||
title: '10以内加减法',
|
||||
subtitle: '加减法混合运算',
|
||||
ageMin: 5,
|
||||
ageMax: 7,
|
||||
difficulty: 2,
|
||||
tags: ['数学', '加减法', '10以内', '计算题'],
|
||||
sortOrder: 118,
|
||||
},
|
||||
{
|
||||
id: 'make-ten',
|
||||
title: '凑十法练习',
|
||||
subtitle: '20 以内进位加法',
|
||||
ageMin: 5,
|
||||
ageMax: 7,
|
||||
difficulty: 3,
|
||||
tags: ['数学', '凑十法', '进位加法', '计算题'],
|
||||
sortOrder: 119,
|
||||
},
|
||||
{
|
||||
id: 'break-ten',
|
||||
title: '破十法练习',
|
||||
subtitle: '20 以内退位减法',
|
||||
ageMin: 5,
|
||||
ageMax: 7,
|
||||
difficulty: 3,
|
||||
tags: ['数学', '破十法', '退位减法', '计算题'],
|
||||
sortOrder: 120,
|
||||
},
|
||||
{
|
||||
id: 'flat-ten',
|
||||
title: '平十法练习',
|
||||
subtitle: '20 以内退位减法',
|
||||
ageMin: 5,
|
||||
ageMax: 7,
|
||||
difficulty: 3,
|
||||
tags: ['数学', '平十法', '退位减法', '计算题'],
|
||||
sortOrder: 121,
|
||||
},
|
||||
{
|
||||
id: 'borrow-ten',
|
||||
title: '借十法练习',
|
||||
subtitle: '20 以上退位减法',
|
||||
ageMin: 6,
|
||||
ageMax: 8,
|
||||
difficulty: 4,
|
||||
tags: ['数学', '借十法', '退位减法', '计算题'],
|
||||
sortOrder: 122,
|
||||
},
|
||||
{
|
||||
id: 'practice-addition',
|
||||
title: '加法运算',
|
||||
subtitle: '10/20/50/100 以内加法',
|
||||
ageMin: 5,
|
||||
ageMax: 8,
|
||||
difficulty: 3,
|
||||
tags: ['数学', '口算', '加法', '计算题'],
|
||||
sortOrder: 123,
|
||||
},
|
||||
{
|
||||
id: 'practice-subtraction',
|
||||
title: '减法运算',
|
||||
subtitle: '10/20/50/100 以内减法',
|
||||
ageMin: 5,
|
||||
ageMax: 8,
|
||||
difficulty: 3,
|
||||
tags: ['数学', '口算', '减法', '计算题'],
|
||||
sortOrder: 124,
|
||||
},
|
||||
{
|
||||
id: 'practice-mixed',
|
||||
title: '混合运算',
|
||||
subtitle: '10/20/50/100 以内加减法混合',
|
||||
ageMin: 5,
|
||||
ageMax: 8,
|
||||
difficulty: 3,
|
||||
tags: ['数学', '口算', '加减法', '计算题'],
|
||||
sortOrder: 125,
|
||||
},
|
||||
{
|
||||
id: 'multiplication-table',
|
||||
title: '九九乘法表',
|
||||
subtitle: '学习九九乘法口诀',
|
||||
ageMin: 6,
|
||||
ageMax: 8,
|
||||
difficulty: 3,
|
||||
tags: ['数学', '乘法', '九九乘法表'],
|
||||
sortOrder: 126,
|
||||
},
|
||||
] as const satisfies ReadonlyArray<MathDrawDefinition>;
|
||||
|
||||
type MathDrawDefinitionItem = (typeof MATH_DRAW_DEFINITIONS)[number];
|
||||
|
||||
const MATH_DRAW_BY_ID = Object.fromEntries(
|
||||
MATH_DRAW_DEFINITIONS.map((item) => [item.id, item]),
|
||||
) as Record<string, MathDrawDefinitionItem>;
|
||||
|
||||
function resolveMathPublishId(
|
||||
routeId: string,
|
||||
selectedTypeId: string,
|
||||
mode?: string,
|
||||
): string {
|
||||
if (selectedTypeId === 'addition') {
|
||||
return mode || 'addition-5';
|
||||
}
|
||||
|
||||
if (selectedTypeId === 'number-object-match' && mode === 'fill') {
|
||||
return 'number-object-fill';
|
||||
}
|
||||
|
||||
if (routeId in MATH_DRAW_BY_ID) {
|
||||
return routeId;
|
||||
}
|
||||
|
||||
return selectedTypeId;
|
||||
}
|
||||
|
||||
export function getPublishMetaByMathState(
|
||||
routeId: string,
|
||||
selectedTypeId: string,
|
||||
mode?: string,
|
||||
): DebugPublishMeta | null {
|
||||
const id = resolveMathPublishId(routeId, selectedTypeId, mode);
|
||||
const item = MATH_DRAW_BY_ID[id];
|
||||
if (!item) return null;
|
||||
|
||||
return {
|
||||
id: item.id,
|
||||
title: item.title,
|
||||
subtitle: item.subtitle,
|
||||
category: 'math',
|
||||
subcategory: 'math-draw',
|
||||
path: `/mathPages/mathDraw/mathDraw?id=${item.id}`,
|
||||
ageMin: item.ageMin,
|
||||
ageMax: item.ageMax,
|
||||
grade: inferGradeFromAge(item.ageMin, item.ageMax),
|
||||
difficulty: item.difficulty,
|
||||
previewImg: '',
|
||||
tags: [...item.tags],
|
||||
isNew: false,
|
||||
isHot: false,
|
||||
sortOrder: item.sortOrder,
|
||||
status: 'draft',
|
||||
};
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
"share-guide-popup": "../../components/share-guide-popup/share-guide-popup",
|
||||
"draw-ad": "../../components/draw-ad/draw-ad",
|
||||
"preview-footer-actions": "../../components3.0/preview-footer-actions/preview-footer-actions",
|
||||
"debug-publish-tools": "../../components3.0/debug-publish-tools/debug-publish-tools",
|
||||
"toy-icon": "../../toy/icon/icon",
|
||||
"preview-card": "../../components3.0/preview-card/preview-card"
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import {
|
||||
type MathTypeConfig,
|
||||
type MathTypeAction,
|
||||
} from './registry';
|
||||
import { getPublishMetaByMathState } from './mathDraw.config';
|
||||
import type { DebugPublishMeta } from '../../utils/debugPublish';
|
||||
|
||||
const TYPE_LIST = MATH_TYPE_CONFIGS.map((t) => ({
|
||||
id: t.id,
|
||||
@@ -40,6 +42,10 @@ createMathPage({
|
||||
numberList: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||
selectedNumber: 0,
|
||||
isPreviewFavorite: false,
|
||||
isDevEnv: false,
|
||||
debugPublishVisible: false,
|
||||
debugPublishLoading: false,
|
||||
debugPublishMeta: null as DebugPublishMeta | null,
|
||||
},
|
||||
|
||||
onLoad(options: { id?: string; mode?: string }) {
|
||||
@@ -47,6 +53,8 @@ createMathPage({
|
||||
const result = findTypeByRouteId(routeId);
|
||||
if (!result) return;
|
||||
|
||||
this.syncDebugPublishEnv();
|
||||
|
||||
const { typeConfig, mode, extra } = result;
|
||||
const initialMode =
|
||||
options.mode || mode || typeConfig.defaultMode || '';
|
||||
@@ -260,4 +268,16 @@ createMathPage({
|
||||
icon: 'none',
|
||||
});
|
||||
},
|
||||
|
||||
getPublishMeta(): DebugPublishMeta {
|
||||
const meta = getPublishMetaByMathState(
|
||||
this.data.functionId,
|
||||
this.data.selectedTypeId,
|
||||
this.data.currentMode,
|
||||
);
|
||||
if (!meta) {
|
||||
throw new Error('当前题型配置不存在');
|
||||
}
|
||||
return meta;
|
||||
},
|
||||
});
|
||||
|
||||
@@ -94,6 +94,16 @@
|
||||
bind:primary="exportToPrint"
|
||||
bind:secondary="onShare" />
|
||||
|
||||
<debug-publish-tools
|
||||
wx:if="{{isDevEnv && hasContent}}"
|
||||
id="debugPublishTools"
|
||||
visible="{{debugPublishVisible}}"
|
||||
loading="{{debugPublishLoading}}"
|
||||
meta="{{debugPublishMeta}}"
|
||||
bind:open="onOpenDebugPublish"
|
||||
bind:close="onCloseDebugPublish"
|
||||
bind:confirm="onConfirmDebugPublish" />
|
||||
|
||||
<!-- 分享引导弹窗 -->
|
||||
<share-guide-popup
|
||||
show="{{showShareDialog}}"
|
||||
|
||||