|
|
@ -2,184 +2,188 @@ |
|
|
|
<div class="page h-full"> |
|
|
|
<div class="page h-full"> |
|
|
|
<Breadcrumb v-if="!paperType" :data="crumbs" /> |
|
|
|
<Breadcrumb v-if="!paperType" :data="crumbs" /> |
|
|
|
<p class="page-name mb">试题</p> |
|
|
|
<p class="page-name mb">试题</p> |
|
|
|
<el-form :model="form" :rules="rules" :class="['input-form model', { paper: paperType }]" ref="form" |
|
|
|
<div v-loading="loading"> |
|
|
|
label-width="110px" :disabled="detailType === 2"> |
|
|
|
<el-form :model="form" :rules="rules" :class="['input-form model', { paper: paperType }]" ref="form" |
|
|
|
<div class="item-line"> |
|
|
|
label-width="110px" :disabled="detailType === 2"> |
|
|
|
<template v-if="paperType === 1"> |
|
|
|
<div class="item-line"> |
|
|
|
<el-form-item prop="questionBankTypeId" label="题库分类"> |
|
|
|
<template v-if="paperType === 1"> |
|
|
|
<el-cascader placeholder="请选择题库分类" v-model="form.questionBankTypeId" :options="questionBankTypes" |
|
|
|
<el-form-item prop="questionBankTypeId" label="题库分类"> |
|
|
|
:props="{ value: 'id', label: 'name', checkStrictly: true }" clearable |
|
|
|
<el-cascader placeholder="请选择题库分类" v-model="form.questionBankTypeId" :options="questionBankTypes" |
|
|
|
@change="getQuesBank"></el-cascader> |
|
|
|
:props="{ value: 'id', label: 'name', checkStrictly: true }" clearable |
|
|
|
</el-form-item> |
|
|
|
@change="getQuesBank"></el-cascader> |
|
|
|
<el-form-item prop="questionBankId" label="题库"> |
|
|
|
</el-form-item> |
|
|
|
<el-select v-model="form.questionBankId" filterable placeholder="请选择题库" @change="getKnowledge"> |
|
|
|
<el-form-item prop="questionBankId" label="题库"> |
|
|
|
<el-option v-for="(item, i) in questionBanks" :key="i" :label="item.questionBankName" |
|
|
|
<el-select v-model="form.questionBankId" filterable placeholder="请选择题库" @change="getKnowledge"> |
|
|
|
:value="item.id"></el-option> |
|
|
|
<el-option v-for="(item, i) in questionBanks" :key="i" :label="item.questionBankName" |
|
|
|
|
|
|
|
:value="item.id"></el-option> |
|
|
|
|
|
|
|
</el-select> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
<template v-else> |
|
|
|
|
|
|
|
<el-form-item label="题库分类"> |
|
|
|
|
|
|
|
<el-input v-model="questionBankCategory" disabled /> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="题库"> |
|
|
|
|
|
|
|
<el-input v-model="questionBankName" disabled /> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="item-line"> |
|
|
|
|
|
|
|
<el-form-item prop="specialtyIds" label="所属专业"> |
|
|
|
|
|
|
|
<el-select v-model="form.specialtyIds" clearable multiple filterable placeholder="请选择所属专业"> |
|
|
|
|
|
|
|
<el-option v-for="(item, i) in professionals" :key="i" :label="item.professionalName" |
|
|
|
|
|
|
|
:value="item.professionalId"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
</template> |
|
|
|
<el-form-item prop="knowledgePointIds" label="所属知识点"> |
|
|
|
<template v-else> |
|
|
|
<el-cascader placeholder="请选择所属知识点" v-model="form.knowledgePointIds" :options="knowledges" |
|
|
|
<el-form-item label="题库分类"> |
|
|
|
:props="{ value: 'id', label: 'name', multiple: true, checkStrictly: true }" :show-all-levels="false" |
|
|
|
<el-input v-model="questionBankCategory" disabled /> |
|
|
|
filterable clearable></el-cascader> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="题库"> |
|
|
|
</div> |
|
|
|
<el-input v-model="questionBankName" disabled /> |
|
|
|
<div class="item-line"> |
|
|
|
|
|
|
|
<el-form-item prop="givenYear" label="年份"> |
|
|
|
|
|
|
|
<el-date-picker v-model="form.givenYear" type="year" placeholder="请选择年份" format="yyyy" value-format="yyyy"> |
|
|
|
|
|
|
|
</el-date-picker> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
</template> |
|
|
|
<el-form-item prop="difficulty" label="难度"> |
|
|
|
</div> |
|
|
|
<el-select v-model="form.difficulty" clearable placeholder="请选择试卷难度"> |
|
|
|
<div class="item-line"> |
|
|
|
<el-option v-for="(item, i) in difficults" :key="i" :label="item.name" :value="item.id"></el-option> |
|
|
|
<el-form-item prop="specialtyIds" label="所属专业"> |
|
|
|
</el-select> |
|
|
|
<el-select v-model="form.specialtyIds" clearable multiple filterable placeholder="请选择所属专业"> |
|
|
|
</el-form-item> |
|
|
|
<el-option v-for="(item, i) in professionals" :key="i" :label="item.professionalName" |
|
|
|
</div> |
|
|
|
:value="item.professionalId"></el-option> |
|
|
|
<el-form-item prop="questionType" label="题型"> |
|
|
|
</el-select> |
|
|
|
<el-radio-group v-model="form.questionType" @change="questionTypeChange"> |
|
|
|
</el-form-item> |
|
|
|
<el-radio v-for="(item, i) in questionTypes" :key="i" :label="item.id">{{ item.name }}</el-radio> |
|
|
|
<el-form-item prop="knowledgePointIds" label="所属知识点"> |
|
|
|
</el-radio-group> |
|
|
|
<el-cascader placeholder="请选择所属知识点" v-model="form.knowledgePointIds" :options="knowledges" |
|
|
|
|
|
|
|
:props="{ value: 'id', label: 'name', multiple: true, checkStrictly: true }" :show-all-levels="false" |
|
|
|
|
|
|
|
filterable clearable></el-cascader> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="item-line"> |
|
|
|
|
|
|
|
<el-form-item prop="givenYear" label="年份"> |
|
|
|
|
|
|
|
<el-date-picker v-model="form.givenYear" type="year" placeholder="请选择年份" format="yyyy" value-format="yyyy"> |
|
|
|
|
|
|
|
</el-date-picker> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item prop="difficulty" label="难度"> |
|
|
|
|
|
|
|
<el-select v-model="form.difficulty" clearable placeholder="请选择试卷难度"> |
|
|
|
|
|
|
|
<el-option v-for="(item, i) in difficults" :key="i" :label="item.name" :value="item.id"></el-option> |
|
|
|
|
|
|
|
</el-select> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
</div> |
|
|
|
<el-form-item class="is-required" prop="stem" label="题干"> |
|
|
|
<el-form-item prop="questionType" label="题型"> |
|
|
|
<UeditorPlus ref="stem" :config="editorConfig" @ready="stemReady" v-model="form.stem" /> |
|
|
|
<el-radio-group v-model="form.questionType" @change="questionTypeChange"> |
|
|
|
|
|
|
|
<el-radio v-for="(item, i) in questionTypes" :key="i" :label="item.id">{{ item.name }}</el-radio> |
|
|
|
<Upload v-if="form.questionType === 'essay'" class="m-t-10" |
|
|
|
</el-radio-group> |
|
|
|
accept=".csv,.xlsx,.xls,.docx,.doc,.pdf,.jpg,.png,.zip,.rar,.7z" :max-size="50" :file-list="uploadList" |
|
|
|
</el-form-item> |
|
|
|
:on-remove="handleRemove" @onSuccess="uploadSuccess"> |
|
|
|
<el-form-item class="is-required" prop="stem" label="题干"> |
|
|
|
<div slot="trigger"> |
|
|
|
<UeditorPlus ref="stem" :config="editorConfig" @ready="stemReady" v-model="form.stem" /> |
|
|
|
<el-button type="primary">上传题干文件</el-button> |
|
|
|
|
|
|
|
|
|
|
|
<Upload v-if="form.questionType === 'essay'" class="m-t-10" |
|
|
|
|
|
|
|
accept=".csv,.xlsx,.xls,.docx,.doc,.pdf,.jpg,.png,.zip,.rar,.7z" :max-size="50" :file-list="uploadList" |
|
|
|
|
|
|
|
:on-remove="handleRemove" @onSuccess="uploadSuccess"> |
|
|
|
|
|
|
|
<div slot="trigger"> |
|
|
|
|
|
|
|
<el-button type="primary">上传题干文件</el-button> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<template slot="tip"> |
|
|
|
|
|
|
|
<p>支持.csv;.xlsx; .docx; .pdf; .jpg; .zip 等常见文件格式;上传文件大小不能超过50MB</p> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
</Upload> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 单选、多选、判断特有 --> |
|
|
|
|
|
|
|
<el-form-item v-if="form.questionType !== 'fill_blank' && form.questionType !== 'essay'" |
|
|
|
|
|
|
|
prop="questionAnswerVersions" label="正确答案"> |
|
|
|
|
|
|
|
<div class="opts"> |
|
|
|
|
|
|
|
<div v-for="(item, i) in form.questionAnswerVersions" :key="i" class="opt"> |
|
|
|
|
|
|
|
<el-checkbox v-if="form.questionType === 'multiple_choice'" class="correct-check" |
|
|
|
|
|
|
|
v-model="item.answerIsCorrect" :true-label="1">选项{{ numToLetter(i) }}</el-checkbox> |
|
|
|
|
|
|
|
<el-radio v-else v-model="item.answerIsCorrect" :true-label="1" :label="1" @change="correctChange(i)">选项{{ |
|
|
|
|
|
|
|
numToLetter(i) |
|
|
|
|
|
|
|
}}</el-radio> |
|
|
|
|
|
|
|
<div v-if="!item.focus" class="opt-input" @click="optFocus(item)"> |
|
|
|
|
|
|
|
<div v-if="item.optionText" v-html="item.optionText"></div> |
|
|
|
|
|
|
|
<p v-else class="default">请输入</p> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<UeditorPlus v-else class="opt-editor" :ref="'opt' + item.optionNumber" :config="editorConfig" |
|
|
|
<template slot="tip"> |
|
|
|
v-model="item.optionText" @ready="editor => optReady(editor, item)" /> |
|
|
|
<p>支持.csv;.xlsx; .docx; .pdf; .jpg; .zip 等常见文件格式;上传文件大小不能超过50MB</p> |
|
|
|
<template v-if="form.questionType !== 'judgement'"> |
|
|
|
|
|
|
|
<i class="icon el-icon-circle-plus-outline m-t-8" @click="addOpt(i)"></i> |
|
|
|
|
|
|
|
<i v-if="form.questionAnswerVersions.length > 2" class="icon el-icon-remove-outline m-t-8" |
|
|
|
|
|
|
|
@click="delOpt(i)"></i> |
|
|
|
|
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</div> |
|
|
|
</Upload> |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 填空题特有 --> |
|
|
|
|
|
|
|
<template v-if="form.questionType === 'fill_blank'"> |
|
|
|
|
|
|
|
<el-form-item label="正确答案" required> |
|
|
|
|
|
|
|
<div class="opts fill-blanks"> |
|
|
|
|
|
|
|
<div v-for="(item, i) in fillBlanks" :key="i" class="opt j-between"> |
|
|
|
|
|
|
|
<div class="fills"> |
|
|
|
|
|
|
|
<span>填空{{ i + 1 }}:</span> |
|
|
|
|
|
|
|
<div v-if="item.fills" class="fill-items"> |
|
|
|
|
|
|
|
<div v-for="(fill, j) in item.fills" :key="j" class="fill-item"> |
|
|
|
|
|
|
|
<el-input type="textarea" autosize resize="none" placeholder="请输入" v-model="fill.val" /> |
|
|
|
|
|
|
|
<span v-if="j !== item.fills.length - 1" class="m-r-8">或</span> |
|
|
|
|
|
|
|
<i v-if="j" class="action-icon el-icon-remove-outline" @click="item.fills.splice(j, 1)"></i> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-button class="add-fill" type="primary" size="small" @click="addFill(item)">新增答案</el-button> |
|
|
|
<!-- 单选、多选、判断特有 --> |
|
|
|
</div> |
|
|
|
<el-form-item v-if="form.questionType !== 'fill_blank' && form.questionType !== 'essay'" |
|
|
|
<div class="score-wrap"> |
|
|
|
prop="questionAnswerVersions" label="正确答案"> |
|
|
|
<span>分值占比</span> |
|
|
|
<div class="opts"> |
|
|
|
<el-input class="score" placeholder="请输入" size="small" v-model="item.scoreProportion" /> |
|
|
|
<div v-for="(item, i) in form.questionAnswerVersions" :key="i" class="opt"> |
|
|
|
<span>%</span> |
|
|
|
<el-checkbox v-if="form.questionType === 'multiple_choice'" class="correct-check" |
|
|
|
|
|
|
|
v-model="item.answerIsCorrect" :true-label="1">选项{{ numToLetter(i) }}</el-checkbox> |
|
|
|
|
|
|
|
<el-radio v-else v-model="item.answerIsCorrect" :true-label="1" :label="1" @change="correctChange(i)">选项{{ |
|
|
|
|
|
|
|
numToLetter(i) |
|
|
|
|
|
|
|
}}</el-radio> |
|
|
|
|
|
|
|
<div v-if="!item.focus" class="opt-input" @click="optFocus(item)"> |
|
|
|
|
|
|
|
<div v-if="item.optionText" v-html="item.optionText"></div> |
|
|
|
|
|
|
|
<p v-else class="default">请输入</p> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<UeditorPlus v-else class="opt-editor" :ref="'opt' + item.optionNumber" :config="editorConfig" |
|
|
|
|
|
|
|
v-model="item.optionText" @ready="editor => optReady(editor, item)" /> |
|
|
|
|
|
|
|
<template v-if="form.questionType !== 'judgement'"> |
|
|
|
|
|
|
|
<i class="icon el-icon-circle-plus-outline m-t-8" @click="addOpt(i)"></i> |
|
|
|
|
|
|
|
<i v-if="form.questionAnswerVersions.length > 2" class="icon el-icon-remove-outline m-t-8" |
|
|
|
|
|
|
|
@click="delOpt(i)"></i> |
|
|
|
|
|
|
|
</template> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="判分标准" class="is-required"> |
|
|
|
|
|
|
|
<el-select :value="form.questionAnswerVersions[0].gradingStandard" placeholder="请选择判分标准" disabled> |
|
|
|
<!-- 填空题特有 --> |
|
|
|
<el-option label="完全一致" value="exact_match"></el-option> |
|
|
|
<template v-if="form.questionType === 'fill_blank'"> |
|
|
|
</el-select> |
|
|
|
<el-form-item label="正确答案" required> |
|
|
|
</el-form-item> |
|
|
|
<div class="opts fill-blanks"> |
|
|
|
<el-form-item label="判分规则"> |
|
|
|
<div v-for="(item, i) in fillBlanks" :key="i" class="opt j-between"> |
|
|
|
<div> |
|
|
|
<div class="fills"> |
|
|
|
<el-switch disabled active-text="判分时忽略答案中的字母大小写"></el-switch> |
|
|
|
<span>填空{{ i + 1 }}:</span> |
|
|
|
</div> |
|
|
|
<div v-if="item.fills" class="fill-items"> |
|
|
|
<div> |
|
|
|
<div v-for="(fill, j) in item.fills" :key="j" class="fill-item"> |
|
|
|
<el-switch disabled active-text="判分时忽略答案中的空格"></el-switch> |
|
|
|
<el-input type="textarea" autosize resize="none" placeholder="请输入" v-model="fill.val" /> |
|
|
|
</div> |
|
|
|
<span v-if="j !== item.fills.length - 1" class="m-r-8">或</span> |
|
|
|
<div> |
|
|
|
<i v-if="j" class="action-icon el-icon-remove-outline" @click="item.fills.splice(j, 1)"></i> |
|
|
|
<el-switch disabled active-text="允许学生每个填空的答案与正确答案的顺序不一致"></el-switch> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
|
|
|
|
<el-switch disabled active-text="判分时允许数值相等"></el-switch> |
|
|
|
<el-button class="add-fill" type="primary" size="small" @click="addFill(item)">新增答案</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
<div class="score-wrap"> |
|
|
|
</template> |
|
|
|
<span>分值占比</span> |
|
|
|
|
|
|
|
<el-input class="score" placeholder="请输入" size="small" v-model="item.scoreProportion" /> |
|
|
|
<!-- 问答题特有 --> |
|
|
|
<span>%</span> |
|
|
|
<template v-if="form.questionType === 'essay'"> |
|
|
|
</div> |
|
|
|
<el-form-item prop="allowAttachment" label="支持学生上传附件" label-width="140px"> |
|
|
|
</div> |
|
|
|
<el-radio-group v-model="form.allowAttachment"> |
|
|
|
</div> |
|
|
|
<el-radio :label="0">否</el-radio> |
|
|
|
</el-form-item> |
|
|
|
<el-radio :label="1">是</el-radio> |
|
|
|
<el-form-item label="判分标准" class="is-required"> |
|
|
|
</el-radio-group> |
|
|
|
<el-select :value="form.questionAnswerVersions[0].gradingStandard" placeholder="请选择判分标准" disabled> |
|
|
|
</el-form-item> |
|
|
|
<el-option label="完全一致" value="exact_match"></el-option> |
|
|
|
<el-form-item v-if="form.allowAttachment" prop="uploadInstructions" label="上传要求说明"> |
|
|
|
</el-select> |
|
|
|
<UeditorPlus ref="uploadInstructions" :config="editorConfig" @ready="uploadInstructionsReady" |
|
|
|
</el-form-item> |
|
|
|
v-model="form.uploadInstructions" /> |
|
|
|
<el-form-item label="判分规则"> |
|
|
|
</el-form-item> |
|
|
|
<div> |
|
|
|
<el-form-item label="判分标准" class="is-required"> |
|
|
|
<el-switch disabled active-text="判分时忽略答案中的字母大小写"></el-switch> |
|
|
|
<el-select :value="form.questionAnswerVersions[0].gradingStandard" placeholder="请选择判分标准" disabled> |
|
|
|
</div> |
|
|
|
<el-option label="人工判分" value="manual"></el-option> |
|
|
|
<div> |
|
|
|
</el-select> |
|
|
|
<el-switch disabled active-text="判分时忽略答案中的空格"></el-switch> |
|
|
|
</el-form-item> |
|
|
|
</div> |
|
|
|
<el-form-item prop="referenceAnswer" label="参考答案"> |
|
|
|
<div> |
|
|
|
<UeditorPlus ref="referenceAnswer" :config="editorConfig" @ready="referenceAnswerReady" |
|
|
|
<el-switch disabled active-text="允许学生每个填空的答案与正确答案的顺序不一致"></el-switch> |
|
|
|
v-model="form.questionAnswerVersions[0].referenceAnswer" /> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div> |
|
|
|
|
|
|
|
<el-switch disabled active-text="判分时允许数值相等"></el-switch> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 问答题特有 --> |
|
|
|
|
|
|
|
<template v-if="form.questionType === 'essay'"> |
|
|
|
|
|
|
|
<el-form-item prop="allowAttachment" label="支持学生上传附件" label-width="140px"> |
|
|
|
|
|
|
|
<el-radio-group v-model="form.allowAttachment"> |
|
|
|
|
|
|
|
<el-radio :label="0">否</el-radio> |
|
|
|
|
|
|
|
<el-radio :label="1">是</el-radio> |
|
|
|
|
|
|
|
</el-radio-group> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item v-if="form.allowAttachment" prop="uploadInstructions" label="上传要求说明"> |
|
|
|
|
|
|
|
<UeditorPlus ref="uploadInstructions" :config="editorConfig" @ready="uploadInstructionsReady" |
|
|
|
|
|
|
|
v-model="form.uploadInstructions" /> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="判分标准" class="is-required"> |
|
|
|
|
|
|
|
<el-select :value="form.questionAnswerVersions[0].gradingStandard" placeholder="请选择判分标准" disabled> |
|
|
|
|
|
|
|
<el-option label="人工判分" value="manual"></el-option> |
|
|
|
|
|
|
|
</el-select> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item prop="referenceAnswer" label="参考答案"> |
|
|
|
|
|
|
|
<UeditorPlus ref="referenceAnswer" :config="editorConfig" @ready="referenceAnswerReady" |
|
|
|
|
|
|
|
v-model="form.questionAnswerVersions[0].referenceAnswer" /> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item prop="answerAnalysis" label="解析"> |
|
|
|
|
|
|
|
<UeditorPlus ref="answerAnalysis" :config="editorConfig" @ready="answerAnalysisReady" |
|
|
|
|
|
|
|
v-model="answerAnalysis" /> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
</template> |
|
|
|
</el-form> |
|
|
|
|
|
|
|
<div class="btns"> |
|
|
|
<el-form-item prop="answerAnalysis" label="解析"> |
|
|
|
<template v-if="detailType !== 2"> |
|
|
|
<UeditorPlus ref="answerAnalysis" :config="editorConfig" @ready="answerAnalysisReady" |
|
|
|
<el-button v-if="detailType === 1" type="primary" :loading="submiting && keep === 0" |
|
|
|
v-model="answerAnalysis" /> |
|
|
|
@click="submit(1)">保存</el-button> |
|
|
|
</el-form-item> |
|
|
|
<template v-else> |
|
|
|
</el-form> |
|
|
|
<el-button type="primary" :loading="submiting && keep === 0" @click="submit(0)">保存</el-button> |
|
|
|
<div v-if="detailType !== 2" class="btns"> |
|
|
|
<el-button type="primary" :loading="submiting && keep === 1" @click="submit(1)">{{ questionId ? '保存并同步更新相似题' |
|
|
|
<el-button v-if="detailType === 1" type="primary" :loading="submiting && keep === 0" |
|
|
|
: |
|
|
|
@click="submit(1)">保存</el-button> |
|
|
|
'保存并继续新增' }}</el-button> |
|
|
|
<template v-else> |
|
|
|
</template> |
|
|
|
<el-button type="primary" :loading="submiting && keep === 0" @click="submit(0)">保存</el-button> |
|
|
|
</template> |
|
|
|
<el-button type="primary" :loading="submiting && keep === 1" @click="submit(1)">{{ questionId ? '保存并同步更新相似题' |
|
|
|
<el-button @click="back">{{ detailType !== 2 ? '取消' : '返回' }}</el-button> |
|
|
|
: |
|
|
|
</div> |
|
|
|
'保存并继续新增' }}</el-button> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
<el-button @click="back">取消</el-button> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<el-dialog title="提示" :visible.sync="repeatVisible" width="800px" :close-on-click-modal="false"> |
|
|
|
<el-dialog title="提示" :visible.sync="repeatVisible" width="800px" :close-on-click-modal="false"> |
|
|
@ -216,6 +220,7 @@ import Oss from '@/components/upload/upload.js' |
|
|
|
import dayjs from 'dayjs' |
|
|
|
import dayjs from 'dayjs' |
|
|
|
import _ from 'lodash' |
|
|
|
import _ from 'lodash' |
|
|
|
import Const from '@/const/ques' |
|
|
|
import Const from '@/const/ques' |
|
|
|
|
|
|
|
import Decimal from 'decimal.js' |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
props: ['paperType', 'curQues'], // 会接收父组件传值的场景都是组卷里新增或者编辑试题进来的 |
|
|
|
props: ['paperType', 'curQues'], // 会接收父组件传值的场景都是组卷里新增或者编辑试题进来的 |
|
|
|
components: { Breadcrumb, UeditorPlus, Upload }, |
|
|
|
components: { Breadcrumb, UeditorPlus, Upload }, |
|
|
@ -229,6 +234,7 @@ export default { |
|
|
|
questionBankCategory: this.$route.query.questionBankCategory, |
|
|
|
questionBankCategory: this.$route.query.questionBankCategory, |
|
|
|
detailType: +this.$route.query.detailType, |
|
|
|
detailType: +this.$route.query.detailType, |
|
|
|
numToLetter: Util.numToLetter, |
|
|
|
numToLetter: Util.numToLetter, |
|
|
|
|
|
|
|
loading: false, |
|
|
|
questionBankTypes: [], |
|
|
|
questionBankTypes: [], |
|
|
|
questionBanks: [], |
|
|
|
questionBanks: [], |
|
|
|
professionals: [], |
|
|
|
professionals: [], |
|
|
@ -328,6 +334,7 @@ export default { |
|
|
|
} else if (this.curQues) { |
|
|
|
} else if (this.curQues) { |
|
|
|
this.questionId = this.curQues.questionId |
|
|
|
this.questionId = this.curQues.questionId |
|
|
|
this.version = this.curQues.version |
|
|
|
this.version = this.curQues.version |
|
|
|
|
|
|
|
if (this.paperType === 3) this.detailType = 2 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.editorConfig = this.paperType ? { |
|
|
|
this.editorConfig = this.paperType ? { |
|
|
@ -342,6 +349,7 @@ export default { |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
// 初始化 |
|
|
|
// 初始化 |
|
|
|
init (v) { |
|
|
|
init (v) { |
|
|
|
|
|
|
|
this.loading = true |
|
|
|
this.form = _.cloneDeep(this.originForm) |
|
|
|
this.form = _.cloneDeep(this.originForm) |
|
|
|
|
|
|
|
|
|
|
|
const type = this.detailType |
|
|
|
const type = this.detailType |
|
|
@ -419,16 +427,19 @@ export default { |
|
|
|
}] |
|
|
|
}] |
|
|
|
} |
|
|
|
} |
|
|
|
// 试卷里点击编辑试题进来的 |
|
|
|
// 试卷里点击编辑试题进来的 |
|
|
|
if (this.paperType === 2) { |
|
|
|
if (this.paperType > 1) { |
|
|
|
this.questionBankName = r.questionBankName |
|
|
|
this.questionBankName = r.questionBankName |
|
|
|
console.log("🚀 ~ getKnowledge ~ id:", this.form) |
|
|
|
|
|
|
|
// this.questionBankCategory = r.questionBankCategory |
|
|
|
// this.questionBankCategory = r.questionBankCategory |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$nextTick(() => { |
|
|
|
this.getKnowledge() |
|
|
|
this.getKnowledge() |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.loading = false |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e) { } |
|
|
|
} finally { |
|
|
|
|
|
|
|
this.loading = false |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 获取知识点 |
|
|
|
// 获取知识点 |
|
|
|
async getKnowledge () { |
|
|
|
async getKnowledge () { |
|
|
@ -595,9 +606,10 @@ export default { |
|
|
|
let gapfillingItems = content.match(spanRegex) |
|
|
|
let gapfillingItems = content.match(spanRegex) |
|
|
|
if (gapfillingItems !== null) { |
|
|
|
if (gapfillingItems !== null) { |
|
|
|
gapfillingItems.forEach(function (span, index) { |
|
|
|
gapfillingItems.forEach(function (span, index) { |
|
|
|
const pairRegex = /<span class="gapfilling-span" (.*?)">(.*?)______(.*?)<\/span>/ |
|
|
|
let pairRegex = /<span class="gapfilling-span" data-id="(.*?)">(.*?)______(.*?)<\/span>/ |
|
|
|
|
|
|
|
if (span.includes('data-id')) pairRegex = /<span class="gapfilling-span" (.*?)">(.*?)______(.*?)<\/span>/ |
|
|
|
pairRegex.test(span) |
|
|
|
pairRegex.test(span) |
|
|
|
newFormItem.push({ fills: [{ val: '' }], uuid: RegExp.$1, scoreProportion: '0' }) |
|
|
|
newFormItem.push({ fills: [{ val: '' }], uuid: RegExp.$1, scoreProportion: '' }) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
newFormItem.forEach(e => { |
|
|
|
newFormItem.forEach(e => { |
|
|
@ -650,13 +662,17 @@ export default { |
|
|
|
if (invalid) return false |
|
|
|
if (invalid) return false |
|
|
|
if (!opt.find(e => e.answerIsCorrect)) return Util.warningMsg('请设置正确答案') |
|
|
|
if (!opt.find(e => e.answerIsCorrect)) return Util.warningMsg('请设置正确答案') |
|
|
|
} else if (form.questionType === 'fill_blank') { |
|
|
|
} else if (form.questionType === 'fill_blank') { |
|
|
|
|
|
|
|
let scorePro = 0 |
|
|
|
for (const e of blanks) { |
|
|
|
for (const e of blanks) { |
|
|
|
if (e.fills.every(n => !n.val)) { |
|
|
|
if (e.fills.every(n => !n.val)) { |
|
|
|
Util.warningMsg('请输入填空项正确答案') |
|
|
|
Util.warningMsg('请输入填空项正确答案') |
|
|
|
invalid = 1 |
|
|
|
invalid = 1 |
|
|
|
break |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const pro = e.scoreProportion |
|
|
|
|
|
|
|
if (pro && !isNaN(pro)) scorePro = Decimal(scorePro).add(pro || 0).toNumber() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (scorePro && scorePro !== 100) return Util.warningMsg('分值占比不满100,请重新调整') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.submiting = true |
|
|
|
this.submiting = true |
|
|
|