|
@@ -1,10 +1,10 @@
|
|
|
<!-- 选择题 -->
|
|
|
<template>
|
|
|
- <QuestionBase :type="selectType">
|
|
|
+ <QuestionBase>
|
|
|
<template #content>
|
|
|
<div class="stem">
|
|
|
<el-input
|
|
|
- v-if="data.setting.stem_type === stemTypeList[0].value"
|
|
|
+ v-if="data.property.stem_type === stemTypeList[0].value"
|
|
|
v-model="data.stem"
|
|
|
rows="3"
|
|
|
resize="none"
|
|
@@ -12,11 +12,11 @@
|
|
|
placeholder="输入题干"
|
|
|
/>
|
|
|
|
|
|
- <RichText v-if="data.setting.stem_type === stemTypeList[1].value" v-model="data.stem" placeholder="输入题干" />
|
|
|
+ <RichText v-if="data.property.stem_type === stemTypeList[1].value" v-model="data.stem" placeholder="输入题干" />
|
|
|
|
|
|
<el-input
|
|
|
- v-show="data.setting.is_describe"
|
|
|
- v-model="data.describe"
|
|
|
+ v-show="data.property.is_enable_description"
|
|
|
+ v-model="data.description"
|
|
|
rows="3"
|
|
|
resize="none"
|
|
|
type="textarea"
|
|
@@ -24,19 +24,21 @@
|
|
|
/>
|
|
|
|
|
|
<UploadAudio
|
|
|
- v-show="data.setting.is_hear"
|
|
|
+ v-show="data.property.is_enable_listening"
|
|
|
:file-id="data.file_id_list?.[0]"
|
|
|
@upload="upload"
|
|
|
@deleteFile="deleteFile"
|
|
|
/>
|
|
|
</div>
|
|
|
+
|
|
|
<div class="content">
|
|
|
<ul>
|
|
|
- <li v-for="(item, i) in data.options" :key="i" class="content-item">
|
|
|
- <span class="question-number">{{ computedQuestionNumber(i) }}.</span>
|
|
|
+ <li v-for="(item, i) in data.option_list" :key="i" class="content-item">
|
|
|
+ <span class="question-number" @dblclick="changeOptionType(data)">
|
|
|
+ {{ computedQuestionNumber(i, data.option_number_show_mode) }}.
|
|
|
+ </span>
|
|
|
<div class="option-content">
|
|
|
<span :class="['checkbox', { active: isAnswer(item.mark) }]" @click="selectAnswer(item.mark)"></span>
|
|
|
- <!-- <el-input v-model="item.content" placeholder="输入内容" /> -->
|
|
|
<RichText v-model="item.content" placeholder="输入内容" :inline="true" />
|
|
|
</div>
|
|
|
<SvgIcon icon-class="delete" class="delete pointer" @click="deleteOption(i)" />
|
|
@@ -51,26 +53,26 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
- <template #setting>
|
|
|
- <el-form :model="data.setting">
|
|
|
+ <template #property>
|
|
|
+ <el-form :model="data.property">
|
|
|
<el-form-item label="题干">
|
|
|
<el-radio
|
|
|
v-for="{ value, label } in stemTypeList"
|
|
|
:key="value"
|
|
|
- v-model="data.setting.stem_type"
|
|
|
+ v-model="data.property.stem_type"
|
|
|
:label="value"
|
|
|
>
|
|
|
{{ label }}
|
|
|
</el-radio>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="题号">
|
|
|
- <el-input v-model="data.setting.question_number" />
|
|
|
+ <el-input v-model="data.property.question_number" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label-width="45px">
|
|
|
<el-radio
|
|
|
v-for="{ value, label } in questionNumberTypeList"
|
|
|
:key="value"
|
|
|
- v-model="data.setting.question_number_type"
|
|
|
+ v-model="data.other.question_number_type"
|
|
|
:label="value"
|
|
|
>
|
|
|
{{ label }}
|
|
@@ -80,7 +82,7 @@
|
|
|
<el-radio
|
|
|
v-for="{ value, label } in switchOption"
|
|
|
:key="value"
|
|
|
- v-model="data.setting.is_describe"
|
|
|
+ v-model="data.property.is_enable_description"
|
|
|
:label="value"
|
|
|
>
|
|
|
{{ label }}
|
|
@@ -90,7 +92,7 @@
|
|
|
<el-radio
|
|
|
v-for="{ value, label } in selectTypeList"
|
|
|
:key="value"
|
|
|
- v-model="data.setting.select_type"
|
|
|
+ v-model="data.property.select_type"
|
|
|
:label="value"
|
|
|
@input="changeSelectType"
|
|
|
>
|
|
@@ -98,7 +100,12 @@
|
|
|
</el-radio>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="听力">
|
|
|
- <el-radio v-for="{ value, label } in switchOption" :key="value" v-model="data.setting.is_hear" :label="value">
|
|
|
+ <el-radio
|
|
|
+ v-for="{ value, label } in switchOption"
|
|
|
+ :key="value"
|
|
|
+ v-model="data.property.is_enable_listening"
|
|
|
+ :label="value"
|
|
|
+ >
|
|
|
{{ label }}
|
|
|
</el-radio>
|
|
|
</el-form-item>
|
|
@@ -106,14 +113,15 @@
|
|
|
<el-radio
|
|
|
v-for="{ value, label } in scoreTypeList"
|
|
|
:key="value"
|
|
|
- v-model="data.setting.score_type"
|
|
|
+ v-model="data.property.score_type"
|
|
|
:label="value"
|
|
|
+ :disabled="scoreTypeList[1].value === value && data.property.select_type === selectTypeList[0].value"
|
|
|
>
|
|
|
{{ label }}
|
|
|
</el-radio>
|
|
|
</el-form-item>
|
|
|
<el-form-item label-width="45px">
|
|
|
- <el-input v-model="data.setting.score" type="number" />
|
|
|
+ <el-input v-model="data.property.score" type="number" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</template>
|
|
@@ -130,11 +138,11 @@ import {
|
|
|
selectTypeList,
|
|
|
switchOption,
|
|
|
scoreTypeList,
|
|
|
- computeOptionMethods,
|
|
|
+ computedQuestionNumber,
|
|
|
+ changeOptionType,
|
|
|
questionNumberTypeList,
|
|
|
} from '@/views/exercise_questions/data/common';
|
|
|
-import { selectData, selectType } from '@/views/exercise_questions/data/select';
|
|
|
-import { GetQuestion } from '@/api/exercise';
|
|
|
+import { selectData } from '@/views/exercise_questions/data/select';
|
|
|
import { getRandomNumber } from '@/utils/index';
|
|
|
|
|
|
export default {
|
|
@@ -152,18 +160,16 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- selectType,
|
|
|
stemTypeList,
|
|
|
selectTypeList,
|
|
|
switchOption,
|
|
|
scoreTypeList,
|
|
|
questionNumberTypeList,
|
|
|
+ changeOptionType,
|
|
|
+ computedQuestionNumber,
|
|
|
data: JSON.parse(JSON.stringify(selectData)),
|
|
|
};
|
|
|
},
|
|
|
- created() {
|
|
|
- this.getQuestion();
|
|
|
- },
|
|
|
methods: {
|
|
|
upload(file_id) {
|
|
|
this.data.file_id_list.push(file_id);
|
|
@@ -186,7 +192,7 @@ export default {
|
|
|
|
|
|
if (arr.length > 0) {
|
|
|
this.data.stem = arr[0];
|
|
|
- this.data.options = arr.slice(1).map((content) => {
|
|
|
+ this.data.option_list = arr.slice(1).map((content) => {
|
|
|
return {
|
|
|
mark: getRandomNumber(),
|
|
|
content,
|
|
@@ -194,36 +200,35 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
- getQuestion() {
|
|
|
- GetQuestion({ question_id: this.questionId })
|
|
|
- .then(({ file_list, question }) => {
|
|
|
- if (question.content) {
|
|
|
- this.data = JSON.parse(question.content);
|
|
|
- }
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- console.log(err);
|
|
|
- });
|
|
|
+ /**
|
|
|
+ * 设置题目内容
|
|
|
+ * @param {object} param
|
|
|
+ * @param {string} param.content 题目内容
|
|
|
+ */
|
|
|
+ setQuestion({ content }) {
|
|
|
+ this.data = JSON.parse(content);
|
|
|
},
|
|
|
deleteOption(i) {
|
|
|
- this.data.options.splice(i, 1);
|
|
|
+ this.data.option_list.splice(i, 1);
|
|
|
},
|
|
|
changeSelectType(val) {
|
|
|
- console.log(val);
|
|
|
- if (this.data.setting.select_type === selectTypeList[0].value && this.data.answer.select_list.length > 1) {
|
|
|
+ if (val === selectTypeList[0].value && this.data.answer.select_list.length > 1) {
|
|
|
this.data.answer.select_list = [this.data.answer.select_list[0]];
|
|
|
}
|
|
|
+ // 当多选题切换到单选题时,分值类型切换为总分
|
|
|
+ if (val === selectTypeList[0].value && this.data.property.score_type === scoreTypeList[1].value) {
|
|
|
+ this.data.property.score_type = scoreTypeList[0].value;
|
|
|
+ }
|
|
|
},
|
|
|
isAnswer(mark) {
|
|
|
return this.data.answer.select_list.indexOf(mark) !== -1;
|
|
|
},
|
|
|
selectAnswer(mark) {
|
|
|
let index = this.data.answer.select_list.indexOf(mark);
|
|
|
- if (this.data.setting.select_type === selectTypeList[0].value) {
|
|
|
+ if (this.data.property.select_type === selectTypeList[0].value) {
|
|
|
this.data.answer.select_list = [mark];
|
|
|
}
|
|
|
- if (this.data.setting.select_type === selectTypeList[1].value) {
|
|
|
+ if (this.data.property.select_type === selectTypeList[1].value) {
|
|
|
if (index === -1) {
|
|
|
this.data.answer.select_list.push(mark);
|
|
|
} else {
|
|
@@ -232,129 +237,40 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
addOption() {
|
|
|
- this.data.options.push({
|
|
|
+ this.data.option_list.push({
|
|
|
mark: getRandomNumber(),
|
|
|
content: '',
|
|
|
});
|
|
|
},
|
|
|
- computedQuestionNumber(i) {
|
|
|
- const computationMethod = computeOptionMethods[this.data.option_type];
|
|
|
- if (computationMethod) {
|
|
|
- return computationMethod(i);
|
|
|
- }
|
|
|
- return '';
|
|
|
- },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-.stem {
|
|
|
- padding-bottom: 8px;
|
|
|
- margin-bottom: 8px;
|
|
|
- border-bottom: 1px solid $border-color;
|
|
|
-
|
|
|
- .el-textarea {
|
|
|
- margin-top: 8px;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
.content {
|
|
|
- > ul {
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- row-gap: 8px;
|
|
|
- width: 100%;
|
|
|
-
|
|
|
- .content-item {
|
|
|
- display: flex;
|
|
|
- column-gap: 4px;
|
|
|
+ .option-content {
|
|
|
+ .checkbox {
|
|
|
+ display: inline-flex;
|
|
|
align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ width: 16px;
|
|
|
+ height: 16px;
|
|
|
+ margin-right: 8px;
|
|
|
+ cursor: pointer;
|
|
|
+ border: 1px solid #333;
|
|
|
+ border-radius: 50%;
|
|
|
|
|
|
- .question-number {
|
|
|
- min-width: 40px;
|
|
|
- height: 32px;
|
|
|
- padding: 4px 8px;
|
|
|
- color: $text-color;
|
|
|
- background-color: $fill-color;
|
|
|
- border-radius: 2px;
|
|
|
- }
|
|
|
-
|
|
|
- .option-content {
|
|
|
- display: flex;
|
|
|
- flex: 1;
|
|
|
- align-items: center;
|
|
|
- padding-left: 16px;
|
|
|
- background-color: $fill-color;
|
|
|
-
|
|
|
- .checkbox {
|
|
|
- display: inline-flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- width: 16px;
|
|
|
- height: 16px;
|
|
|
- margin-right: 8px;
|
|
|
- cursor: pointer;
|
|
|
- border: 1px solid #333;
|
|
|
+ &.active {
|
|
|
+ &::before {
|
|
|
+ display: inline-block;
|
|
|
+ width: 6px;
|
|
|
+ height: 6px;
|
|
|
+ content: '';
|
|
|
+ background-color: #333;
|
|
|
border-radius: 50%;
|
|
|
-
|
|
|
- &.active {
|
|
|
- &::before {
|
|
|
- display: inline-block;
|
|
|
- width: 6px;
|
|
|
- height: 6px;
|
|
|
- content: '';
|
|
|
- background-color: #333;
|
|
|
- border-radius: 50%;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .rich-text {
|
|
|
- flex: 1;
|
|
|
- min-height: 32px;
|
|
|
-
|
|
|
- :deep &.mce-content-body {
|
|
|
- padding-top: 4px;
|
|
|
- }
|
|
|
-
|
|
|
- :deep &:not(.mce-edit-focus) {
|
|
|
- p {
|
|
|
- margin: 0;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- :deep &.mce-content-body[data-mce-placeholder]:not(.mce-visualblocks)::before {
|
|
|
- top: 6px;
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- .delete {
|
|
|
- margin-left: 12px;
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-.footer {
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
- margin-top: 12px;
|
|
|
- color: $main-color;
|
|
|
-
|
|
|
- .add-option {
|
|
|
- display: flex;
|
|
|
- column-gap: 8px;
|
|
|
- align-items: center;
|
|
|
- font-size: 14px;
|
|
|
- cursor: pointer;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-.el-form {
|
|
|
- .el-input {
|
|
|
- width: 250px;
|
|
|
- }
|
|
|
-}
|
|
|
</style>
|