liuyu
3 小时以前 82a74ba0402ab546ba524d23ce62198c4d00d2f7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/** 自我检测:题目数量(0 / 5 / 10 / 15 …) */
export const COUNT_OPTIONS = Array.from({ length: 11 }, (_, i) => {
  const n = i * 5;
  return { id: n, fullName: `${n}条` };
});
 
/** 自我检测难度(与老系统一致,带颜色) */
export type SelfTestDifficulty = 'veryEasy' | 'easier' | 'normal' | 'harder' | 'veryHard';
 
export const SELF_TEST_DIFFICULTY_OPTIONS: {
  id: SelfTestDifficulty;
  fullName: string;
  color: string;
}[] = [
  { id: 'veryEasy', fullName: '很容易', color: '#52c41a' },
  { id: 'easier', fullName: '较容易', color: '#1890ff' },
  { id: 'normal', fullName: '一般', color: '#000000' },
  { id: 'harder', fullName: '较难', color: '#fa8c16' },
  { id: 'veryHard', fullName: '非常难', color: '#f5222d' },
];
 
/** 自我检测难度 → 试题 difficulty 字典值(easy/normal/hard) */
export const SELF_TEST_DIFFICULTY_TO_QUESTION: Record<SelfTestDifficulty, string[]> = {
  veryEasy: ['easy', 'veryEasy'],
  easier: ['easy', 'easier'],
  normal: ['normal'],
  harder: ['hard', 'harder'],
  veryHard: ['hard', 'veryHard'],
};
 
export function colorOfSelfTestDifficulty(v?: string) {
  return SELF_TEST_DIFFICULTY_OPTIONS.find((x) => x.id === v)?.color ?? '#000';
}
 
export function labelOfSelfTestDifficulty(v?: string) {
  return SELF_TEST_DIFFICULTY_OPTIONS.find((x) => x.id === v)?.fullName ?? v ?? '-';
}