123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import { optionTypeList, stemTypeList, scoreTypeList, questionNumberTypeList, switchOption } from './common';
- import { getRandomNumber } from '@/utils/index';
- // 连线类型列表
- export const columnNumberList = [
- { value: 2, label: '2列' },
- { value: 3, label: '3列' },
- ];
- export function getOption(content = '') {
- return { content, mark: getRandomNumber() };
- }
- /**
- * 获取连线题数据模板
- * 因为 option_list 和 answer.column_list 中的数据是一一对应的,所以需要函数生成来保持一致
- */
- export function getMatchingDataTemplate() {
- let option_list = Array.from({ length: 3 }, () =>
- Array.from({ length: columnNumberList[0].value }, () => getOption()),
- );
- let column_list = option_list.map((item) => item.map(({ mark }) => mark));
- return {
- type: 'matching', // 题型
- stem: '', // 题干
- option_number_show_mode: optionTypeList[0].value, // 选项类型
- description: '', // 描述
- option_list, // 选项
- answer: { column_list, score: 0, score_type: scoreTypeList[0].value }, // 答案
- // 题型属性
- property: {
- stem_type: stemTypeList[0].value, // 题干类型
- question_number: '1', // 题号
- column_number: columnNumberList[0].value, // 列数
- is_enable_description: switchOption[1].value, // 描述
- score: 1, // 分值
- score_type: scoreTypeList[0].value, // 分值类型
- },
- // 其他属性
- other: {
- question_number_type: questionNumberTypeList[0].value, // 题号类型
- },
- };
- }
|