Files
doodle-mini/miniprogram/core/data/difficulty.ts
T
2026-04-29 17:47:14 +08:00

32 lines
1.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { Difficulty } from '../models/worksheet';
/** 产品文档:难度 入门 / 基础 / 进阶 / 挑战 → 云库 difficulty 14 */
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, Difficulty> = {
1: 'beginner',
2: 'basic',
3: 'intermediate',
4: 'advanced',
};
export function difficultyToStars(level?: Difficulty): 1 | 2 | 3 | 4 {
return level ? DIFFICULTY_LEVEL_TO_STARS[level] : 2;
}
/** 分龄 Tab / 筛选(现有功能清单 + 产品设计 3-8 岁) */
export const AGE_BANDS = [
{ key: '3-4', minAge: 3, maxAge: 4, label: '3-4 岁' },
{ key: '4-5', minAge: 4, maxAge: 5, label: '4-5 岁' },
{ key: '5-6', minAge: 5, maxAge: 6, label: '5-6 岁' },
{ key: '6-7', minAge: 6, maxAge: 7, label: '6-7 岁' },
{ key: '7-8', minAge: 7, maxAge: 8, label: '7-8 岁' },
] as const;
export type AgeBandKey = (typeof AGE_BANDS)[number]['key'];