| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- import { stemTypeList, scoreTypeList, questionNumberTypeList, switchOption, fontSizeList } from './common';
- import { getRandomNumber } from '@/utils/index';
- export function getOption(content = '') {
- return [
- { content, mark: getRandomNumber() },
- { content, mark: getRandomNumber() },
- { content, mark: getRandomNumber() },
- { content, mark: getRandomNumber() },
- ];
- }
- /**
- * 解析智能识别数据
- * @param {array} arr 智能识别数据
- * @returns object
- */
- export function analysisRecognitionReplaceAnswerData(arr) {
- let option_list = [];
- let column_count = 0;
- arr.forEach((item) => {
- let item_arr = item.split(' ');
- if (item_arr.length > column_count) {
- column_count = item_arr.length;
- }
- });
- for (let i = 0; i < arr.length; i++) {
- let table_item = [];
- let item_arr = arr[i].split(' ');
- for (let j = 0; j < column_count; j++) {
- table_item.push({ content: item_arr[j] ? item_arr[j] : '', mark: getRandomNumber() });
- }
- option_list.push(table_item);
- }
- return {
- 'data.option_list': option_list,
- 'data.property.row_count': arr.length,
- 'data.property.column_count': column_count,
- };
- }
- // 替换练习数据模板
- export const replaceAnswerData = {
- type: 'replace_answer', // 题型
- stem: '', // 题干
- description: '', // 描述
- analysis: '', // 解析,富文本
- option_list: [getOption(), getOption(), getOption(), getOption()], // 选项
- file_id_list: [], // 文件 id 列表
- answer: { score: 1, score_type: scoreTypeList[0].value }, // 答案
- reference_answer: '', // 参考答案
- // 题型属性
- property: {
- stem_type: stemTypeList[1].value, // 题干类型
- question_number: '1', // 题号
- stem_question_number_font_size: fontSizeList[6], // 题干题号
- is_enable_description: switchOption[1].value, // 描述
- is_enable_reference_answer: switchOption[0].value, // 是否开启参考答案
- is_enable_analysis: switchOption[1].value, // 是否开启解析
- score: 1, // 分值
- score_type: scoreTypeList[0].value, // 分值类型
- row_count: 4,
- column_count: 4,
- },
- // 其他属性
- other: {
- question_number_type: questionNumberTypeList[1].value, // 题号类型
- },
- };
|