fill.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { stemTypeList, questionNumberTypeList, scoreTypeList, switchOption } 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[0].value, // 题干类型
  32. question_number: '1', // 题号
  33. is_enable_description: switchOption[1].value, // 描述
  34. score: 1, // 分值
  35. score_type: scoreTypeList[0].value, // 分值类型
  36. },
  37. // 其他属性
  38. other: {
  39. question_number_type: questionNumberTypeList[1].value, // 题号类型
  40. },
  41. };