judge.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { optionTypeList, stemTypeList, questionNumberTypeList, scoreTypeList, switchOption } from './common';
  2. import { getRandomNumber } from '@/utils/index';
  3. // 选项类型列表
  4. export const option_type_list = [
  5. { value: 'right', label: '是' },
  6. { value: 'error', label: '非' },
  7. { value: 'incertitude', label: '不确定' },
  8. ];
  9. export const option_type_value_list = option_type_list.map(({ value }) => value);
  10. export function getOption(content = '') {
  11. return { content, mark: getRandomNumber() };
  12. }
  13. /**
  14. * 获取判断题数据模板(防止 mark 重复)
  15. * @returns {object} 判断题数据模板
  16. */
  17. export function getJudgeData() {
  18. return {
  19. type: 'judge', // 题型
  20. stem: '', // 题干
  21. option_number_show_mode: optionTypeList[0].value, // 选项类型
  22. option_list: [getOption(), getOption(), getOption()], // 选项
  23. file_id_list: [], // 文件 id 列表
  24. answer: { answer_list: [], score: 1, score_type: scoreTypeList[0].value }, // 答案
  25. // 题型属性
  26. property: {
  27. stem_type: stemTypeList[1].value, // 题干类型
  28. question_number: '1', // 题号
  29. option_type_list: [option_type_list[0].value, option_type_list[1].value], // 选项类型列表
  30. score: 1, // 分值
  31. score_type: scoreTypeList[0].value, // 分值类型
  32. },
  33. // 其他属性
  34. other: {
  35. question_number_type: questionNumberTypeList[1].value, // 题号类型
  36. },
  37. };
  38. }