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
38
39
40
41
42
43
44
45
import type { Difficulty, QuestionStatus, QuestionType, SourceType } from './types';
 
export const QUESTION_TYPE_OPTIONS: { id: QuestionType; fullName: string }[] = [
  { id: 'single', fullName: '单选题' },
  { id: 'multi', fullName: '多选题' },
  { id: 'judge', fullName: '判断题' },
  { id: 'blank', fullName: '填空题' },
  { id: 'essay', fullName: '问答题' },
];
 
export const DIFFICULTY_OPTIONS: { id: Difficulty; fullName: string }[] = [
  { id: 'easy', fullName: '简单' },
  { id: 'normal', fullName: '一般' },
  { id: 'hard', fullName: '困难' },
];
 
export const SOURCE_OPTIONS: { id: SourceType; fullName: string }[] = [
  { id: 'self', fullName: '自主命题' },
  { id: 'import', fullName: '导入' },
  { id: 'external', fullName: '外购' },
];
 
export const STATUS_OPTIONS: { id: QuestionStatus; fullName: string; tip?: string; tipColor?: string }[] = [
  { id: 'open', fullName: '开放', tip: '学生可以模拟', tipColor: 'green' },
  { id: 'closed', fullName: '不开放', tip: '学生不能模拟', tipColor: 'red' },
  { id: 'invalid', fullName: '废弃' },
];
 
export const OPTION_LABELS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
 
export function labelOfType(type?: string) {
  return QUESTION_TYPE_OPTIONS.find((x) => x.id === type)?.fullName ?? type ?? '-';
}
 
export function labelOfStatus(status?: string) {
  return STATUS_OPTIONS.find((x) => x.id === status)?.fullName ?? status ?? '-';
}
 
export function labelOfDifficulty(v?: string) {
  return DIFFICULTY_OPTIONS.find((x) => x.id === v)?.fullName ?? v ?? '-';
}
 
export function labelOfSource(v?: string) {
  return SOURCE_OPTIONS.find((x) => x.id === v)?.fullName ?? v ?? '-';
}