|
|
@@ -10,7 +10,7 @@
|
|
|
<el-option :value="2" label="多选题"/>
|
|
|
<el-option :value="3" label="填空题"/>
|
|
|
<el-option :value="4" label="简答题"/>
|
|
|
- <el-option :value="5" label="代码题"/>
|
|
|
+<!-- <el-option :value="5" label="代码题"/>-->
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item v-if="form.type === 1 || form.type === 2" label="选项">
|
|
|
@@ -23,7 +23,17 @@
|
|
|
</el-input>
|
|
|
<el-button circle icon="el-icon-plus" @click="addQuestionOption"/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="答案">
|
|
|
+ <el-form-item v-if="form.type === 3" label="选项">
|
|
|
+ <el-input v-for="(option, index) in form.options" v-model="option.content" class="option"
|
|
|
+ placeholder="请输入选项内容">
|
|
|
+ <template #prepend>{{ option.label }}</template>
|
|
|
+ <template #append>
|
|
|
+ <el-button icon="el-icon-close" @click="handleBlankCloseClick(index)"></el-button>
|
|
|
+ </template>
|
|
|
+ </el-input>
|
|
|
+ <el-button circle icon="el-icon-plus" @click="addBlankOption"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="form.type !== 3" label="答案">
|
|
|
<el-radio v-for="(option) in form.options" v-if="form.type===1" v-model="form.answer" :label="option.label"
|
|
|
border>
|
|
|
{{ option.label }}
|
|
|
@@ -33,7 +43,7 @@
|
|
|
{{ option.label }}
|
|
|
</el-checkbox>
|
|
|
</el-checkbox-group>
|
|
|
- <el-input v-if="!(form.type === 1 || form.type === 2)" v-model="form.answer" placeholder="请输入题目答案"></el-input>
|
|
|
+ <el-input v-if="form.type === 4" v-model="form.answer" placeholder="请输入题目答案"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="解析">
|
|
|
<el-input v-model="form.analysis" placeholder="请输入题目解析"></el-input>
|
|
|
@@ -97,18 +107,9 @@ export default {
|
|
|
stem: "",
|
|
|
type: 1,
|
|
|
options: [
|
|
|
- {
|
|
|
- label: "A",
|
|
|
- content: "",
|
|
|
- },
|
|
|
- {
|
|
|
- label: "B",
|
|
|
- content: "",
|
|
|
- },
|
|
|
- {
|
|
|
- label: "C",
|
|
|
- content: "",
|
|
|
- }
|
|
|
+ {label: "A", content: ""},
|
|
|
+ {label: "B", content: ""},
|
|
|
+ {label: "C", content: ""}
|
|
|
],
|
|
|
answer: null,
|
|
|
multi_answer: [],
|
|
|
@@ -145,7 +146,17 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
+ addBlankOption() {
|
|
|
+ let labels = ["__1__", "__2__", "__3__", "__4__", "__5__", "__6__", "__7__"];
|
|
|
+ if (this.form.options.length === 7) {
|
|
|
|
|
|
+ } else {
|
|
|
+ this.form.options.push({
|
|
|
+ label: labels[this.form.options.length],
|
|
|
+ value: "",
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
async handleAckButtonClick() {
|
|
|
if (this.checkFormCompletion()) {
|
|
|
let questionVO = this.formatQuestionVO2backend();
|
|
|
@@ -164,18 +175,9 @@ export default {
|
|
|
stem: "",
|
|
|
type: 1,
|
|
|
options: [
|
|
|
- {
|
|
|
- label: "A",
|
|
|
- content: "",
|
|
|
- },
|
|
|
- {
|
|
|
- label: "B",
|
|
|
- content: "",
|
|
|
- },
|
|
|
- {
|
|
|
- label: "C",
|
|
|
- content: "",
|
|
|
- }
|
|
|
+ {label: "A", content: ""},
|
|
|
+ {label: "B", content: ""},
|
|
|
+ {label: "C", content: ""}
|
|
|
],
|
|
|
answer: null,
|
|
|
multi_answer: [],
|
|
|
@@ -307,25 +309,22 @@ export default {
|
|
|
this.form.options[i].label = labels[i];
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
+ handleBlankCloseClick(index) {
|
|
|
+ let labels = ["__1__", "__2__", "__3__", "__4__", "__5__", "__6__", "__7__"];
|
|
|
+ this.form.options.splice(index, 1)
|
|
|
+ for (let i = 0; i < this.form.options.length; i++) {
|
|
|
+ this.form.options[i].label = labels[i];
|
|
|
+ }
|
|
|
+ },
|
|
|
initSingleQuestionCreator() {
|
|
|
this.form = {
|
|
|
id: null,
|
|
|
stem: "",
|
|
|
type: 1,
|
|
|
options: [
|
|
|
- {
|
|
|
- label: "A",
|
|
|
- content: "",
|
|
|
- },
|
|
|
- {
|
|
|
- label: "B",
|
|
|
- content: "",
|
|
|
- },
|
|
|
- {
|
|
|
- label: "C",
|
|
|
- content: "",
|
|
|
- }
|
|
|
+ {label: "A", content: ""},
|
|
|
+ {label: "B", content: ""},
|
|
|
+ {label: "C", content: ""}
|
|
|
],
|
|
|
answer: null,
|
|
|
multi_answer: [],
|
|
|
@@ -453,7 +452,26 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
- computed: {},
|
|
|
+ watch: {
|
|
|
+ 'form.type': function (){
|
|
|
+ if(this.form.type !== 3){
|
|
|
+ this.form.options = [
|
|
|
+ {label: "A", content: ""},
|
|
|
+ {label: "B", content: ""},
|
|
|
+ {label: "C", content: ""}
|
|
|
+ ];
|
|
|
+ this.form.answer = "";
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this.form.options = [
|
|
|
+ {label: "__1__", content: ""},
|
|
|
+ {label: "__2__", content: ""},
|
|
|
+ {label: "__3__", content: ""}
|
|
|
+ ];
|
|
|
+ this.form.answer = "空";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
emits: ["acknowledge"],
|
|
|
}
|
|
|
</script>
|