12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import {
- optionTypeList,
- stemTypeList,
- selectTypeList,
- scoreTypeList,
- questionNumberTypeList,
- switchOption,
- fontSizeList,
- } from './common';
- import { getRandomNumber } from '@/utils/index';
- export function getOption(content = '') {
- return { content, mark: getRandomNumber() };
- }
- /**
- * 获取选项细分数据项
- * @param {number} number 选项数
- */
- export function getSubdivisionOption(number = 2) {
- return {
- mark: getRandomNumber(),
- data_list: Array.from({ length: number }, () => getOption()),
- };
- }
- /**
- * 获取选择题数据模板(防止 mark 重复)
- */
- export function getSelectData() {
- return {
- type: 'select', // 题型
- stem: '', // 题干
- option_number_show_mode: optionTypeList[0].value, // 选项类型
- description: '', // 描述
- option_list: [
- { content: '', mark: getRandomNumber() },
- { content: '', mark: getRandomNumber() },
- { content: '', mark: getRandomNumber() },
- ], // 选项
- file_id_list: [], // 文件 id 列表
- answer: { answer_list: [], score: 1, score_type: scoreTypeList[0].value }, // 答案
- // 题型属性
- property: {
- stem_type: stemTypeList[1].value, // 题干类型
- question_number: '1', // 题号
- stem_question_number_font_size: fontSizeList[6], // 题干题号
- option_question_number_font_size: fontSizeList[5], // 选项题号
- is_enable_description: switchOption[1].value, // 描述
- select_type: selectTypeList[0].value, // 选择类型
- is_option_subdivision: switchOption[1].value, // 选项细分
- option_number: 2, // 选项数
- score: 1, // 分值
- score_type: scoreTypeList[0].value, // 分值类型
- },
- // 其他属性
- other: {
- question_number_type: questionNumberTypeList[1].value, // 题号类型
- },
- };
- }
|