dialogue.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { getRandomNumber } from '@/utils';
  2. import { stemTypeList, questionNumberTypeList, scoreTypeList, switchOption, fontSizeList } from './common';
  3. export const roleDefaultColorList = ['#306EFF', '#3ABD38', '#FC8E3D', '#FC493D', '#BF3DFC']; // 角色默认颜色
  4. /**
  5. * 获取角色对象
  6. * @param {number} index 序号
  7. */
  8. export function getRole(index) {
  9. return {
  10. name: `角色${index + 1}`,
  11. mark: getRandomNumber(),
  12. color: roleDefaultColorList[index],
  13. };
  14. }
  15. // 对话题数据模板
  16. export function getDialogueData() {
  17. return {
  18. type: 'dialogue', // 题型
  19. stem: '', // 题干
  20. description: '', // 描述
  21. option_list: [], // 选项列表
  22. file_id_list: [], // 文件 id 列表
  23. answer: { score: 1, score_type: scoreTypeList[0].value, answer_list: [] }, // 答案
  24. // 题型属性
  25. property: {
  26. stem_type: stemTypeList[1].value, // 题干类型
  27. question_number: '1', // 题号
  28. stem_question_number: fontSizeList[5], // 题干题号
  29. score: 1, // 分值
  30. is_enable_description: switchOption[0].value, // 描述
  31. is_enable_voice_answer: switchOption[0].value, // 语音作答
  32. score_type: scoreTypeList[0].value, // 分值类型
  33. role_number: 2, // 角色数 2 - 5
  34. role_list: [getRole(0), getRole(1)], // 角色列表
  35. },
  36. // 其他属性
  37. other: {
  38. question_number_type: questionNumberTypeList[1].value, // 题号类型
  39. },
  40. };
  41. }