import { deepCopy } from "@/plugins/utils"; export const selectQuestion = { questionType: "SINGLE_ANSWER_QUESTION", // 2多选 quesBody: null, quesOptions: [ { number: 1, optionBody: null, }, { number: 2, optionBody: null, }, { number: 3, optionBody: null, }, { number: 4, optionBody: null, }, ], quesAnswer: null, comment: null, }; export const booleanQuestion = { questionType: "BOOL_ANSWER_QUESTION", quesBody: null, quesAnswer: null, comment: null, }; export const fillBlankQuestion = { questionType: "FILL_BLANK_QUESTION", quesBody: null, quesAnswer: [ // { // index: 1, // sections: [{ blocks: [{ type: "text", value: "" }] }], // }, ], comment: null, }; export const textAnswerQuestion = { questionType: "TEXT_ANSWER_QUESTION", quesBody: null, // only one quesAnswer: [ // { // index: 1, // sections: [{ blocks: [{ type: "text", value: "" }] }], // }, ], comment: null, }; // 完型填空/听力/阅读理解 export const readingComprehensionQuestion = { questionType: "READING_COMPREHENSION", quesBody: null, comment: null, subQuestions: [], }; // 段落匹配/选词填空 export const bankedClozeQuestion = { questionType: "BANKED_CLOZE", quesBody: null, comment: null, subQuestions: [ // { // number: 1, // quesAnswer: null, // difficulty: "易", // quesProperties: [], // }, ], quesOptions: [ { number: 1, optionBody: null, }, { number: 2, optionBody: null, }, ], param: { matchingMode: 1, matchingType: 1 }, // 段落匹配: "param": { "matchingMode": 2, "matchingType": 2 }, // quesAnswer: [{ number: 1, answer: [8] }], }; const models = { SINGLE_ANSWER_QUESTION: selectQuestion, MULTIPLE_ANSWER_QUESTION: Object.assign({}, selectQuestion, { questionType: "MULTIPLE_ANSWER_QUESTION", }), BOOL_ANSWER_QUESTION: booleanQuestion, FILL_BLANK_QUESTION: fillBlankQuestion, TEXT_ANSWER_QUESTION: textAnswerQuestion, READING_COMPREHENSION: readingComprehensionQuestion, LISTENING_QUESTION: Object.assign({}, readingComprehensionQuestion, { questionType: "LISTENING_QUESTION", }), CLOZE: Object.assign({}, readingComprehensionQuestion, { questionType: "CLOZE", }), PARAGRAPH_MATCHING: Object.assign({}, bankedClozeQuestion, { questionType: "PARAGRAPH_MATCHING", param: { matchingMode: 2, matchingType: 2 }, }), BANKED_CLOZE: bankedClozeQuestion, }; export const getInitQuestionModel = (qtype) => { return { id: null, sourceDetailId: "", courseId: "", difficulty: "易", quesProperties: [], ...deepCopy(models[qtype]), }; }; export const getMatchQuestionModel = () => { let matchQuestionModel = getInitQuestionModel("SINGLE_ANSWER_QUESTION"); matchQuestionModel.quesOptions = null; return matchQuestionModel; }; export const STRUCT_TYPE_COMP_DICT = { SINGLE_ANSWER_QUESTION: "select-question", MULTIPLE_ANSWER_QUESTION: "select-question", BOOL_ANSWER_QUESTION: "boolean-question", FILL_BLANK_QUESTION: "fill-blank-question", TEXT_ANSWER_QUESTION: "text-answer-question", READING_COMPREHENSION: "nested-question", LISTENING_QUESTION: "nested-question", CLOZE: "nested-question", PARAGRAPH_MATCHING: "banked-cloze-question", BANKED_CLOZE: "banked-cloze-question", };