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 ?? '-';
|
}
|