feat: 更新内容管理方案
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user