feat: 更新内容管理方案

This commit is contained in:
R524809
2026-04-29 17:47:14 +08:00
parent 63fa08ff1a
commit 2cb9ec55d6
44 changed files with 1181 additions and 625 deletions
+4 -12
View File
@@ -1,29 +1,21 @@
import type { DifficultyLevel } from '../models/worksheet';
import type { Difficulty } from '../models/worksheet';
/** 产品文档:难度 入门 / 基础 / 进阶 / 挑战 → 云库 difficulty 14 */
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
View File
@@ -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;