select.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import {
  2. optionTypeList,
  3. stemTypeList,
  4. selectTypeList,
  5. scoreTypeList,
  6. questionNumberTypeList,
  7. switchOption,
  8. } from './common';
  9. import { getRandomNumber } from '@/utils/index';
  10. export function getOption(content = '') {
  11. return { content, mark: getRandomNumber() };
  12. }
  13. /**
  14. * 获取选择题数据模板(防止 mark 重复)
  15. */
  16. export function getSelectData() {
  17. return {
  18. type: 'select', // 题型
  19. stem: '', // 题干
  20. option_number_show_mode: optionTypeList[0].value, // 选项类型
  21. description: '', // 描述
  22. option_list: [
  23. { content: '', mark: getRandomNumber() },
  24. { content: '', mark: getRandomNumber() },
  25. { content: '', mark: getRandomNumber() },
  26. ], // 选项
  27. file_id_list: [], // 文件 id 列表
  28. answer: { answer_list: [], score: 1, score_type: scoreTypeList[0].value }, // 答案
  29. // 题型属性
  30. property: {
  31. stem_type: stemTypeList[1].value, // 题干类型
  32. question_number: '1', // 题号
  33. is_enable_description: switchOption[1].value, // 描述
  34. select_type: selectTypeList[0].value, // 选择类型
  35. score: 1, // 分值
  36. score_type: scoreTypeList[0].value, // 分值类型
  37. },
  38. // 其他属性
  39. other: {
  40. question_number_type: questionNumberTypeList[1].value, // 题号类型
  41. },
  42. };
  43. }