fill.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { stemTypeList, questionNumberTypeList, scoreTypeList, switchOption, fontSizeList } from './common';
  2. export function handleToneValue(valItem) {
  3. let numList = [];
  4. if (/[A-Za-zü]+\d/g.test(valItem)) {
  5. valItem.split('').forEach((item, i) => {
  6. if (/\d/.test(item)) {
  7. let numIndex = numList.length === 0 ? 0 : numList[numList.length - 1].index;
  8. let con = valItem.substring(numIndex, i).replace(/\d/g, '');
  9. numList.push({
  10. number: item,
  11. con,
  12. });
  13. }
  14. });
  15. } else {
  16. numList = [];
  17. }
  18. return numList.length === 0 ? [{ con: valItem }] : numList;
  19. }
  20. // 填空题数据模板
  21. export const fillData = {
  22. type: 'fill', // 题型
  23. stem: '', // 题干
  24. file_id_list: [], // 文件 id 列表
  25. description: '', // 描述
  26. article: '', // 文章
  27. model_essay: [], // 文章解析后的数据
  28. answer: { score: 1, score_type: scoreTypeList[0].value, answer_list: [] }, // 答案
  29. // 题型属性
  30. property: {
  31. stem_type: stemTypeList[1].value, // 题干类型
  32. question_number: '1', // 题号
  33. stem_question_number: fontSizeList[5], // 题干题号
  34. is_enable_description: switchOption[0].value, // 描述
  35. score: 1, // 分值
  36. score_type: scoreTypeList[0].value, // 分值类型
  37. },
  38. // 其他属性
  39. other: {
  40. question_number_type: questionNumberTypeList[1].value, // 题号类型
  41. },
  42. };