Commit fc15b75f authored by 黄奎's avatar 黄奎

新增插件

parent a234574b
...@@ -54,11 +54,11 @@ export function CreateQuestion(questionKey) { ...@@ -54,11 +54,11 @@ export function CreateQuestion(questionKey) {
case "judge": case "judge":
AnswerList.push({ AnswerList.push({
Name: "A", Name: "A",
Content: "", Content: "",
IsAnswer: true IsAnswer: true
}, { }, {
Name: "B", Name: "B",
Content: "", Content: "",
IsAnswer: false IsAnswer: false
}) })
break; break;
...@@ -128,7 +128,7 @@ export function CreateQuestion(questionKey) { ...@@ -128,7 +128,7 @@ export function CreateQuestion(questionKey) {
var tempArray = optionListConfig(); var tempArray = optionListConfig();
AnswerList.push(tempArray); AnswerList.push(tempArray);
break; break;
//阅读理解 //阅读理解
case "reading-comprehensio": case "reading-comprehensio":
AnswerList.push({ AnswerList.push({
QuestionType: 1, QuestionType: 1,
...@@ -138,6 +138,20 @@ export function CreateQuestion(questionKey) { ...@@ -138,6 +138,20 @@ export function CreateQuestion(questionKey) {
SubAnwser: optionListConfig() SubAnwser: optionListConfig()
}); });
break; break;
//听力题
case "listening":
AnswerList.push({
QuestionType: 1,
QuestionKey: "single",
QuestionName: "单选题",
SubTitle: "", //题目内容
SubAnwser: optionListConfig()
});
break;
//共用选择题
case "sharing-choose":
break;
} }
return AnswerList; return AnswerList;
} }
...@@ -44,9 +44,9 @@ ...@@ -44,9 +44,9 @@
:setOption="objOption"></fill-in> :setOption="objOption"></fill-in>
<!--判断题--> <!--判断题-->
<judge v-if="questionObj.Key=='judge'" :questionData="AnswerList" @getChild="getChildData"></judge> <judge v-if="questionObj.Key=='judge'" :questionData="AnswerList" @getChild="getChildData"></judge>
<!--简答题、名词解释、论述题、计算题--> <!--简答题、名词解释、论述题、计算题、口语题、其它-->
<short-answer v-if="questionObj.Key=='short-answer'||questionObj.Key=='noun-explanation'||questionObj.Key=='essay-question' <short-answer v-if="questionObj.Key=='short-answer'||questionObj.Key=='noun-explanation'||questionObj.Key=='essay-question'
||questionObj.Key=='calculation' ||questionObj.Key=='calculation' || questionObj.Key=='spoken'|| questionObj.Key=='other'
" :setOption="objOption"> </short-answer> " :setOption="objOption"> </short-answer>
<!--分录题、资料题--> <!--分录题、资料题-->
<entry-problem v-if="questionObj.Key=='entry-problem'|| questionObj.Key=='data-question'" <entry-problem v-if="questionObj.Key=='entry-problem'|| questionObj.Key=='data-question'"
...@@ -59,9 +59,9 @@ ...@@ -59,9 +59,9 @@
@getChild="getChildData"></sorting-problem> @getChild="getChildData"></sorting-problem>
<!--完型填空--> <!--完型填空-->
<cloze v-if="questionObj.Key=='cloze'" :questionData="AnswerList" @getChild="getChildData"></cloze> <cloze v-if="questionObj.Key=='cloze'" :questionData="AnswerList" @getChild="getChildData"></cloze>
<!--阅读理解--> <!--阅读理解、听力题-->
<reading-comprehensio v-if="questionObj.Key=='reading-comprehensio'" :questionData="AnswerList" <reading-comprehensio v-if="questionObj.Key=='reading-comprehensio'||questionObj.Key=='listening'"
@getChild="getChildData"></reading-comprehensio> :questionData="AnswerList" @getChild="getChildData"></reading-comprehensio>
<br /> <br />
<div class="col-12"> <div class="col-12">
答案解析<UeEditor v-model="objOption.AnswerParse" :config="config" ref="AnswerParse"></UeEditor> 答案解析<UeEditor v-model="objOption.AnswerParse" :config="config" ref="AnswerParse"></UeEditor>
...@@ -235,6 +235,7 @@ ...@@ -235,6 +235,7 @@
this.objOption.QuestionTypeKey = item.Key; this.objOption.QuestionTypeKey = item.Key;
var obj = CreateQuestion(item.Key); var obj = CreateQuestion(item.Key);
this.AnswerList = obj; this.AnswerList = obj;
console.log("this.AnswerList ", this.AnswerList);
}, },
//获取题型列表 //获取题型列表
getQuestionType() { getQuestionType() {
......
...@@ -5,17 +5,93 @@ ...@@ -5,17 +5,93 @@
<template> <template>
<div class="readingComprehensioQuestion"> <div class="readingComprehensioQuestion">
<template v-if="data&&data.length>0" v-for="(item,index) in data"> <template v-if="data&&data.length>0" v-for="(item,index) in data">
<div> <table>
<span>{{index+1}} 题 ({{item.QuestionName}})</span> <thead>
<UeEditor v-model="item.SubTitle" :config="config"></UeEditor> <tr>
<th colspan="3" style="text-align:left;">
<span style="display:block" v-for="(subItem,subIndex) in item.SubAnwser"> {{index+1}} 题 ({{item.QuestionName}})
<el-checkbox v-model="subItem.IsAnswer" @change="ChangeItem(item,subItem)">{{subItem.Name}}</el-checkbox> </th>
<UeEditor v-model="subItem.Content" :config="config"></UeEditor> </tr>
<a style="cursor:pointer;" @click="deleteOpion(item,subIndex)">删除</a> <tr>
</span> <th colspan="3">
</div> <UeEditor v-model="item.SubTitle" :config="config"></UeEditor>
<a style="cursor:pointer;" @click="addOption(item)">添加选项</a> </th>
</tr>
</thead>
<tbody>
<!--选择题-->
<template v-if="item.QuestionKey=='single' ||item.QuestionKey=='multiple'">
<tr v-for="(subItem,subIndex) in item.SubAnwser">
<td>
<template v-if="item.QuestionKey=='single'">
<el-checkbox v-model="subItem.IsAnswer" @change="ChangeItem(item,subItem)">{{subItem.Name}}
</el-checkbox>
</template>
<template v-else-if="item.QuestionKey=='multiple'">
<el-checkbox v-model="subItem.IsAnswer">{{subItem.Name}}
</el-checkbox>
</template>
</td>
<td>
<UeEditor v-model="subItem.Content" :config="config"></UeEditor>
</td>
<td>
<a style="cursor:pointer;" @click="deleteOpion(item,subIndex)">删除</a>
</td>
</tr>
</template>
<!--填空题-->
<template v-if="item.QuestionKey=='fill-in'">
<tr v-for="(subItem,subIndex) in item.SubAnwser">
<td>
{{subIndex+1}}
</td>
<td>
<UeEditor v-model="subItem.Content" :config="config"></UeEditor>
</td>
<td>
<a style="cursor:pointer;" @click="deleteOpion(item,subIndex)">删除</a>
</td>
</tr>
</template>
<!--判断题-->
<template v-if="item.QuestionKey=='judge'">
<tr v-for="(subItem,subIndex) in item.SubAnwser">
<td>
<el-checkbox v-model="subItem.IsAnswer" @change="ChangeItem(item,subItem)">{{subItem.Name}}
</el-checkbox>
</td>
<td colspan="2" style="text-align:left;">
{{subItem.Content}}
</td>
</tr>
</template>
<!--简答题-->
<template v-if="item.QuestionKey=='short-answer'">
<tr v-for="(subItem,subIndex) in item.SubAnwser">
<td colspan="3">
<UeEditor v-model="subItem.Content" :config="config"></UeEditor>
</td>
</tr>
</template>
</tbody>
<tfoot>
<tr>
<td colspan="3">
<!--选择题-->
<template v-if="item.QuestionKey=='single' ||item.QuestionKey=='multiple'">
<a style="cursor:pointer;" @click="addOption(item)">添加选项</a>
</template>
<!--填空题-->
<template v-if="item.QuestionKey=='fill-in'">
<a style="cursor:pointer;" @click="addFillIn(item)">添加更多</a>
</template>
&nbsp;
<a style="cursor:pointer;" @click="deleteQuestion(index)">删除问题</a>
</td>
</tr>
</tfoot>
</table>
</template> </template>
<br /> <br />
<q-btn-dropdown color="primary" label="添加小题" style="margin-left:5px;"> <q-btn-dropdown color="primary" label="添加小题" style="margin-left:5px;">
...@@ -34,6 +110,7 @@ ...@@ -34,6 +110,7 @@
import { import {
getOptionList, //获取选择标签【A,B,C,D....】 getOptionList, //获取选择标签【A,B,C,D....】
optionListConfig, optionListConfig,
CreateQuestion
} from '../../api/question/questionconfig' } from '../../api/question/questionconfig'
import { import {
queryQuestionTypeList, queryQuestionTypeList,
...@@ -62,7 +139,6 @@ ...@@ -62,7 +139,6 @@
created() { created() {
this.initConfig(); this.initConfig();
this.getQuestionType(); this.getQuestionType();
console.log("questionData", this.questionData);
}, },
methods: { methods: {
//获取题型列表 //获取题型列表
...@@ -79,6 +155,10 @@ ...@@ -79,6 +155,10 @@
initConfig() { initConfig() {
this.optionTitleList = getOptionList(); this.optionTitleList = getOptionList();
}, },
//删除小题
deleteQuestion(index) {
this.data.splice(index, 1);
},
//添加小题 //添加小题
onItemClick(item) { onItemClick(item) {
var qObj = { var qObj = {
...@@ -88,7 +168,14 @@ ...@@ -88,7 +168,14 @@
SubTitle: "", //题目内容 SubTitle: "", //题目内容
SubAnwser: "" SubAnwser: ""
}; };
qObj.SubAnwser = CreateQuestion(item.Key); if (item.Key == "short-answer") {
qObj.SubAnwser = [];
qObj.SubAnwser.push({
Content: ""
})
} else {
qObj.SubAnwser = CreateQuestion(item.Key);
}
this.data.push(qObj); this.data.push(qObj);
}, },
//删除选项 //删除选项
...@@ -104,7 +191,7 @@ ...@@ -104,7 +191,7 @@
Content: "", Content: "",
IsAnswer: false IsAnswer: false
}); });
this.calcOptionTitle() this.calcOptionTitle();
} else { } else {
this.$q.notify({ this.$q.notify({
type: 'warning', type: 'warning',
...@@ -115,6 +202,12 @@ ...@@ -115,6 +202,12 @@
return return
} }
}, },
//添加填空
addFillIn(item) {
item.SubAnwser.push({
Content: "",
});
},
//添加小题 //添加小题
addQuestion() { addQuestion() {
this.data.push(optionListConfig()); this.data.push(optionListConfig());
...@@ -124,7 +217,7 @@ ...@@ -124,7 +217,7 @@
if (this.data && this.data.length > 0) { if (this.data && this.data.length > 0) {
this.data.forEach((item, index) => { this.data.forEach((item, index) => {
if (item.QuestionKey == "single" || item.QuestionKey == "multiple") if (item.QuestionKey == "single" || item.QuestionKey == "multiple")
item.forEach((subItem, subIndex) => { item.SubAnwser.forEach((subItem, subIndex) => {
subItem.Name = this.optionTitleList[subIndex]; subItem.Name = this.optionTitleList[subIndex];
}) })
}) })
...@@ -134,9 +227,10 @@ ...@@ -134,9 +227,10 @@
returnDataToParent() { returnDataToParent() {
this.$emit('getChild', this.data); this.$emit('getChild', this.data);
}, },
//单选
ChangeItem(item, subItem) { ChangeItem(item, subItem) {
if (item && item.length > 0) { if (item.SubAnwser && item.SubAnwser.length > 0) {
item.forEach(childItem => { item.SubAnwser.forEach(childItem => {
childItem.IsAnswer = false; childItem.IsAnswer = false;
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment