Commit 31dc42c0 authored by 黄奎's avatar 黄奎

yemxiug

parent cccf7fe7
...@@ -26,13 +26,13 @@ ...@@ -26,13 +26,13 @@
.vClozeQuestion .clozeTest_question_tit i { .vClozeQuestion .clozeTest_question_tit i {
color: #acbfd9; color: #acbfd9;
cursor: pointer; cursor: pointer;
} }
</style> </style>
<template> <template>
<div class="vClozeQuestion"> <div class="vClozeQuestion">
<template v-if="data&&data.length>0" v-for="(item,index) in data"> <template v-if="data&&data.QuestionContentObj&&data.QuestionContentObj.length>0">
<table class="common_TiTable"> <table class="common_TiTable" v-for="(item,index) in data.QuestionContentObj" :key="index">
<thead> <thead>
<tr> <tr>
<th colspan="2"> <th colspan="2">
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
<tbody class="contant"> <tbody class="contant">
<tr v-for="(subItem,subIndex) in item"> <tr v-for="(subItem,subIndex) in item">
<td style="width:40px;text-align:center;"> <td style="width:40px;text-align:center;">
<div class="Answer_List2" :class="{'Is_Answer':subItem.IsAnswer}"> <div class="Answer_List2">
{{subItem.Name}} {{subItem.Name}}
</div> </div>
</td> </td>
...@@ -58,62 +58,46 @@ ...@@ -58,62 +58,46 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<table class="common_TiTable" v-if="isShowAnswer">
<tfoot>
<tr>
<td colspan="2">答案:{{data.Answer}}</td>
</tr>
<tr>
<td colspan="2">解析:<span v-html="data.AnswerParse"></span></td>
</tr>
</tfoot>
</table>
</template> </template>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
props: { props: {
questionData: { questionObj: {
type: Array,
},
setOption: {
type: Object, type: Object,
},
//是否显示答案和解析
isShowAnswer: {
type: Boolean,
default: false,
} }
},
components: {
}, },
data() { data() {
return { return {
data: this.questionData, data: this.questionObj,
}; };
},
created() {
}, },
methods: { methods: {
//返回数据到父组件
returnDataToParent() {
this.getAnswer();
this.$emit('getChild', this.data);
},
//获取答案
getAnswer() {
this.setOption.Answer = "";
if (this.data && this.data.length > 0) {
var answer = "";
this.data.forEach((item) => {
item.forEach((subItem) => {
if (subItem.IsAnswer) {
answer += "," + subItem.Name;
}
})
})
if (answer != "") {
answer = answer.substring(1);
}
this.setOption.Answer = answer;
}
},
}, },
mounted() { mounted() {
}, },
watch: { watch: {
data: { isShowAnswer: {
handler(newValue) { handler(newValue) {
this.returnDataToParent();
}, },
deep: true deep: true
}, },
......
<!--分录题--> <!--分录题-->
<style> <style>
.entryProblemQuestion { .v_entryProblemQuestion {
width: 100%; width: 100%;
} }
.entrytk_info {
color: #A8A8B3;
font-size: 12px;
line-height: 24px;
cursor: default;
}
</style> </style>
<template> <template>
<div class="entryProblemQuestion"> <div class="v_entryProblemQuestion">
<table v-if="data&&data.length>0" class="common_TiTable"> <table v-if="data&&data.QuestionContentObj&&data.QuestionContentObj.length>0" class="common_TiTable">
<tr v-for="(item,index) in data"> <tbody v-if="isShowAnswer" v-for="(item,index) in data.QuestionContentObj" :key="index">
<td style="width:40px;text-align:center;padding-top:8px;"> <tr>
{{index+1}}</el-checkbox> <td style="width:40px;text-align:center;padding-top:8px;">
</td> {{index+1}}</el-checkbox>
<td> </td>
<div class="InpDIV" style="border:0;margin-top:-2px;" v-html="item.Content"></div> <td>
</td> <div class="InpDIV" style="border:0;margin-top:-2px;" v-html="item.Content"></div>
<td style="width:40px;text-align:center;"> </td>
</td> </tr>
</tr> </tbody>
<tbody>
<tr>
<td colspan="2"><span v-if="data&&data.IsMutex==1" style="font-size:13px;">答案顺序打乱也判正确</span></td>
</tr>
<tr>
<td colspan="2">1. 一个空有多种答案时请用";"隔开。如:水;H2O</td>
</tr>
<tr>
<td colspan="2">2. 若试题答案是数字,可设置范围,两个数字之间用"-"。如:1-9,学生填写1到9之间的数字都算正确(包括1和9)</td>
</tr>
</tbody>
<tfoot v-if="isShowAnswer">
<tr>
<td colspan="2">解析:<span v-html="data.AnswerParse"></span></td>
</tr>
</tfoot>
</table> </table>
<br />
<span v-if="setOption.IsMutex==1" style="font-size:13px;">答案顺序打乱也判正确</span>
<br />
<br />
<div class="entrytk_info">
1. 一个空有多种答案时请用";"隔开。如:水;H2O
<br />
2. 若试题答案是数字,可设置范围,两个数字之间用"-"。如:1-9,学生填写1到9之间的数字都算正确(包括1和9)
</div>
</div> </div>
</template> </template>
<script> <script>
import UeEditor from '../editor/UeEditor'
export default { export default {
props: { props: {
questionData: { questionObj: {
type: Array,
},
setOption: {
type: Object, type: Object,
},
//是否显示答案和解析
isShowAnswer: {
type: Boolean,
default: false,
} }
}, },
components: {
UeEditor
},
data() { data() {
return { return {
data: this.questionData, data: this.questionObj,
config: {
initialFrameWidth: null,
initialFrameHeight: 80,
},
commonIndex: -1,
}; };
}, },
created() {}, created() {},
methods: { methods: {
//删除选项
deleteOpion(index) {
this.$q.dialog({
title: "删除小题",
message: "确实要删除该选项吗?",
persistent: true,
cancel: {
label: "取消",
flat: true
},
ok: {
label: "确认",
flat: true,
focus: true
}
}).onOk(() => {
this.data.splice(index, 1);
this.commonIndex = -1;
});
},
//新增选项
addOption() {
this.data.push({
Content: "",
});
},
//获取答案
getAnswer() {
if (this.data && this.data.length > 0) {
var answer = "";
this.data.forEach(item => {
answer += "★" + item.Content;
})
if (answer != "") {
answer = answer.substring(1);
}
this.setOption.Answer = answer;
}
},
//返回数据到父组件
returnDataToParent() {
this.getAnswer();
this.$emit('getChild', this.data);
},
}, },
mounted() { mounted() {
}, },
watch: { watch: {
data: { isShowAnswer: {
handler(newValue) { handler(newValue) {
this.returnDataToParent();
}, },
deep: true deep: true
}, },
......
<!--填空题--> <!--填空题-->
<style> <style>
.fillInQuestion { .v_fillInQuestion {
width: 100%; width: 100%;
} }
.tk_info {
color: #A8A8B3;
font-size: 12px;
line-height: 24px;
cursor: default;
margin-top: 20px;
}
</style> </style>
<template> <template>
<div class="fillInQuestion"> <div class="v_fillInQuestion">
<table v-if="data&&data.length>0" class="common_TiTable"> <table v-if="data&&data.QuestionContentObj&&data.QuestionContentObj.length>0" class="common_TiTable">
<tr v-for="(item,index) in data"> <tbody v-if="isShowAnswer" v-for="(item,index) in data.QuestionContentObj" :key="index">
<td style="width:50px;text-align:center;padding-top:8px;"> <tr>
{{index+1}}</el-checkbox> <td style="width:50px;text-align:center;padding-top:8px;">
</td> {{index+1}}</el-checkbox>
<td> </td>
<div class="InpDIV" style="border:0;margin-top:-2px;" v-html="item.Content"></div> <td>
</td> <div class="InpDIV" style="border:0;margin-top:-2px;" v-html="item.Content"></div>
</tr> </td>
</tr>
</tbody>
<tbody>
<tr>
<td colspan="2"><span v-if="data&&data.IsMutex==1" style="font-size:13px;">答案顺序打乱也判正确</span></td>
</tr>
<tr>
<td colspan="2">1. 一个空有多种答案时请用";"隔开。如:水;H2O</td>
</tr>
<tr>
<td colspan="2">2. 若试题答案是数字,可设置范围,两个数字之间用"-"。如:1-9,学生填写1到9之间的数字都算正确(包括1和9)</td>
</tr>
</tbody>
<tfoot v-if="isShowAnswer">
<tr>
<td colspan="2">解析:<span v-html="data.AnswerParse"></span></td>
</tr>
</tfoot>
</table> </table>
<br />
<span v-if="setOption.IsMutex==1" style="font-size:13px;">答案顺序打乱也判正确</span>
<br />
<div class="tk_info">
1. 一个空有多种答案时请用";"隔开。如:水;H2O
</br>
2. 若试题答案是数字,可设置范围,两个数字之间用"-"。如:1-9,学生填写1到9之间的数字都算正确(包括1和9)
</div>
</div> </div>
</template> </template>
<script> <script>
import UeEditor from '../editor/UeEditor'
export default { export default {
props: { props: {
questionData: { questionObj: {
type: Array,
},
setOption: {
type: Object, type: Object,
},
//是否显示答案和解析
isShowAnswer: {
type: Boolean,
default: false,
} }
}, },
components: {
UeEditor
},
data() { data() {
return { return {
data: this.questionData, data: this.questionObj,
}; };
}, },
created() {}, created() {},
methods: { methods: {
//返回数据到父组件
returnDataToParent() {
if (this.data && this.data.length > 0) {
var answer = "";
this.data.forEach(item => {
answer += "★" + item.Content;
})
if (answer != "") {
answer = answer.substring(1);
}
this.setOption.Answer = answer;
}
this.$emit('getChild', this.data);
},
}, },
mounted() { mounted() {
}, },
watch: { watch: {
data: { isShowAnswer: {
handler(newValue) { handler(newValue) {
this.returnDataToParent();
}, },
deep: true deep: true
}, },
......
<!--判断题--> <!--判断题-->
<style> <style>
.judgeQuestion { .v_judgeQuestion {
width: 100%; width: 100%;
} }
</style> </style>
<template> <template>
<div class="judgeQuestion"> <div class="v_judgeQuestion">
<table v-if="data&&data.length>0" class="common_TiTable"> <table v-if="data&&data.QuestionContentObj&&data.QuestionContentObj.length>0" class="common_TiTable">
<tr v-for="(item,index) in data"> <tbody v-for="(item,index) in data.QuestionContentObj" :key="index">
<td style="width:50px;text-align:center;"> <tr>
<div class="Answer_List2" :class="{'Is_Answer':item.IsAnswer}"> <td style="width:50px;text-align:center;">
{{item.Name}} <div class="Answer_List2">
</div> {{item.Name}}
</td> </div>
<td style="vertical-align:middle;"> </td>
<span v-if="index==0"></span> <td style="vertical-align:middle;">
<span v-if="index==1"></span> <span v-if="index==0"></span>
</td> <span v-if="index==1"></span>
</tr> </td>
</tr>
</tbody>
<tfoot v-if="isShowAnswer">
<tr>
<td colspan="2">正确答案:{{data.Answer}}</td>
</tr>
<tr>
<td colspan="2">解析:<span v-html="data.AnswerParse"></span></td>
</tr>
</tfoot>
</table> </table>
</div> </div>
</template> </template>
<script> <script>
import UeEditor from '../editor/UeEditor'
export default { export default {
props: { props: {
questionData: { questionObj: {
type: Array,
},
setOption: {
type: Object, type: Object,
},
//是否显示答案和解析
isShowAnswer: {
type: Boolean,
default: false,
} }
}, },
components: {
UeEditor
},
data() { data() {
return { return {
data: this.questionData, data: this.questionObj,
config: {
initialFrameWidth: null,
initialFrameHeight: 80,
},
}; };
}, },
created() {}, created() {},
methods: { methods: {
//返回数据到父组件
returnDataToParent() {
this.getAnswer();
this.$emit('getChild', this.data);
},
//获取正确答案
getAnswer() {
this.setOption.Answer = "";
if (this.data && this.data.length > 0) {
this.data.forEach(item => {
if (item.IsAnswer) {
this.setOption.Answer = item.Name;
}
})
}
},
}, },
mounted() { mounted() {
}, },
watch: { watch: {
data: { isShowAnswer: {
handler(newValue) { handler(newValue) {
this.returnDataToParent();
}, },
deep: true deep: true
}, },
......
<!--连线题--> <!--连线题-->
<style> <style>
.matchingQuestion { .v_matchingQuestion {
width: 100%; width: 100%;
} }
...@@ -20,34 +20,17 @@ ...@@ -20,34 +20,17 @@
margin: 13px 12px 0 0; margin: 13px 12px 0 0;
} }
.selectBox2 {
display: inline-block;
vertical-align: top;
text-align: left;
position: relative;
cursor: pointer;
width: 58px;
line-height: 24px;
height: 24px;
background: #FFFFFF;
border: 1px solid #E1E1E5;
border-radius: 4px;
font-size: 12px;
color: #181E33;
outline: none;
}
</style> </style>
<template> <template>
<div class="matchingQuestion"> <div class="v_matchingQuestion">
<table v-if="data&&data.length>0" class="common_TiTable"> <table v-if="data&&data.QuestionContentObj&&data.QuestionContentObj.length>0" class="common_TiTable">
<thead> <thead>
<tr> <tr>
<th colspan="2">第一组</th> <th colspan="2">第一组</th>
<th colspan="2">第二组</th> <th colspan="2">第二组</th>
</tr> </tr>
</thead> </thead>
<tr v-for="(item,index) in data[0]"> <tr v-for="(item,index) in data.QuestionContentObj[0]">
<td style="width:40px;text-align:center;padding-top:10px;"> <td style="width:40px;text-align:center;padding-top:10px;">
{{item.Name}} {{item.Name}}
</td> </td>
...@@ -55,23 +38,17 @@ ...@@ -55,23 +38,17 @@
<div class="InpDIV" style="width:100%;border:0;" v-html="item.Content"></div> <div class="InpDIV" style="width:100%;border:0;" v-html="item.Content"></div>
</td> </td>
<td style="width:40px;text-align:center;padding-top:10px;"> <td style="width:40px;text-align:center;padding-top:10px;">
{{data[1][index].Name}} {{data.QuestionContentObj[1][index].Name}}
</td> </td>
<td> <td>
<div class="InpDIV" style="width:100%;border:0;" v-html="data[1][index].Content"></div> <div class="InpDIV" style="width:100%;border:0;" v-html="data.QuestionContentObj[1][index].Content"></div>
</td> </td>
</tr> </tr>
<tfoot>
<tr>
<td colspan="3">
</td>
</tr>
</tfoot>
</table> </table>
<span class="team_tit" v-if="isShowAnswer">答案</span>
<span class="team_tit">答案</span> <table v-if="isShowAnswer&&data&&data.QuestionContentObj&&data.QuestionContentObj.length>2"
<table v-if="data&&data.length>2" style="padding-left:13px;"> style="padding-left:13px;">
<tr v-for="(item,index) in data[0]"> <tr v-for="(item,index) in data.QuestionContentObj[0]">
<td style="width:30px;"> <td style="width:30px;">
{{item.Name}} {{item.Name}}
</td> </td>
...@@ -79,62 +56,44 @@ ...@@ -79,62 +56,44 @@
<span class="line_center"></span> <span class="line_center"></span>
</td> </td>
<td> <td>
{{data[2][index].Content}} {{data.QuestionContentObj[2][index].Content}}
</td> </td>
</tr> </tr>
<tfoot>
<tr>
<td colspan="3">
解析:<span v-html="data.AnswerParse"></span>
</td>
</tr>
</tfoot>
</table> </table>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
props: { props: {
questionData: { questionObj: {
type: Array,
},
setOption: {
type: Object, type: Object,
},
//是否显示答案和解析
isShowAnswer: {
type: Boolean,
default: false,
} }
},
components: {
}, },
data() { data() {
return { return {
data: this.questionData, data: this.questionObj,
}; };
},
computed: {
},
created() {
}, },
methods: { methods: {
//返回数据到父组件
returnDataToParent() {
this.getAnswer();
this.$emit('getChild', this.data);
},
//获取正确答案
getAnswer() {
this.setOption.Answer = "";
if (this.data && this.data.length > 0) {
var answer = "";
this.data[2].forEach(item => {
answer += "," + item.Content;
})
if (answer != "") {
answer = answer.substring(1);
}
this.setOption.Answer = answer;
}
},
}, },
mounted() {}, mounted() {},
watch: { watch: {
data: { isShowAnswer: {
handler(newValue) { handler(newValue) {
this.returnDataToParent();
}, },
deep: true deep: true
}, },
......
<!--多选题--> <!--多选题查看-->
<style> <style>
.multipleQuestion { .v_multipleQuestion {
width: 100%; width: 100%;
} }
</style> </style>
<template> <template>
<div class="multipleQuestion"> <div class="v_multipleQuestion">
<table v-if="data&&data.length>0" class="common_TiTable"> <table v-if="data&&data.QuestionContentObj&&data.QuestionContentObj.length>0" class="common_TiTable">
<tr v-for="(item,index) in data"> <tbody v-for="(item,index) in data.QuestionContentObj" :key="index">
<td style="width:40px;text-align:center;"> <tr>
<div class="num_option_dx2" :class="{'Is_Answer':item.IsAnswer}"> <td style="width:40px;text-align:center;">
{{item.Name}} <div class="num_option_dx2">
</div> {{item.Name}}
</td> </div>
<td> </td>
<div class="InpDIV" style="border:0;" v-html="item.Content"></div> <td>
</td> <div class="InpDIV" style="border:0;" v-html="item.Content"></div>
<td style="width:40px;text-align:center;"> </td>
</td> </tr>
</tr> </tbody>
<tfoot v-if="isShowAnswer">
<tr>
<td colspan="2">正确答案:{{data.Answer}}</td>
</tr>
<tr>
<td colspan="2">解析:<span v-html="data.AnswerParse"></span></td>
</tr>
</tfoot>
</table> </table>
</div> </div>
</template> </template>
<script> <script>
import {
getOptionList, //获取选择标签【A,B,C,D....】
} from '../../api/question/questionconfig'
import UeEditor from '../editor/UeEditor'
export default { export default {
props: { props: {
questionData: { questionObj: {
type: Array,
},
setOption: {
type: Object, type: Object,
},
//是否显示答案和解析
isShowAnswer: {
type: Boolean,
default: false,
} }
}, },
components: {
UeEditor
},
data() { data() {
return { return {
data: this.questionData, data: this.questionObj,
config: {
initialFrameWidth: null,
initialFrameHeight: 80,
},
optionTitleList: [],
commonIndex: -1,
}; };
}, },
created() {
this.initConfig();
},
methods: { methods: {
initConfig() {
this.optionTitleList = getOptionList();
},
//删除选项
deleteOpion(index) {
this.$q.dialog({
title: '提示信息',
message: '是否确定删除?',
cancel: true,
persistent: true,
ok: "确定",
cancel: "取消",
}).onOk(() => {
this.data.splice(index, 1);
this.commonIndex = -1;
this.calcOptionTitle();
}).onCancel(() => {
});
},
//新增选项
addOption() {
if (this.data.length < 7) {
this.data.push({
Name: "",
Content: "",
IsAnswer: false
});
this.calcOptionTitle()
} else {
this.$q.notify({
type: 'warning',
position: 'center',
timeout: 1500,
message: `最多只能添加7个选项`
})
return
}
},
//重新计算选择Title[A,B,C,D....]
calcOptionTitle() {
if (this.data && this.data.length > 0) {
this.data.forEach((item, index) => {
item.Name = this.optionTitleList[index];
})
}
},
//返回数据到父组件
returnDataToParent() {
if (this.data && this.data.length > 0) {
var answer = "";
this.data.forEach(item => {
if (item.IsAnswer) {
answer += "," + item.Name;
}
})
if (answer != "") {
answer = answer.substring(1);
}
this.setOption.Answer = answer;
}
this.$emit('getChild', this.data);
},
}, },
mounted() { mounted() {
}, },
watch: { watch: {
data: { isShowAnswer: {
handler(newValue) { handler(newValue) {
this.returnDataToParent();
}, },
deep: true deep: true
}, },
......
...@@ -29,7 +29,8 @@ ...@@ -29,7 +29,8 @@
</style> </style>
<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.QuestionContentObj&&data.QuestionContentObj.length>0" v-for="(item,index) in data.QuestionContentObj">
<table class="common_TiTable"> <table class="common_TiTable">
<thead> <thead>
<tr> <tr>
...@@ -43,11 +44,6 @@ ...@@ -43,11 +44,6 @@
</div> </div>
</th> </th>
</tr> </tr>
<!-- <tr>
<th colspan="3">
<UeEditor v-model="item.SubTitle" :config="config"></UeEditor>
</th>
</tr> -->
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
...@@ -62,12 +58,12 @@ ...@@ -62,12 +58,12 @@
<td style="width:40px;text-align:center;"> <td style="width:40px;text-align:center;">
<template <template
v-if="item.QuestionKey=='single'||item.QuestionKey=='multiple'|| item.QuestionKey=='single-number'"> v-if="item.QuestionKey=='single'||item.QuestionKey=='multiple'|| item.QuestionKey=='single-number'">
<div class="Answer_List2" :class="{'Is_Answer':subItem.IsAnswer}"> <div class="Answer_List2" :class="{'Is_Answer':subItem.IsAnswer&&isShowAnswer}">
{{subItem.Name}} {{subItem.Name}}
</div> </div>
</template> </template>
<template v-else-if="item.QuestionKey=='multiple'"> <template v-else-if="item.QuestionKey=='multiple'">
<div class="Answer_List" :class="{'Is_Answer':subItem.IsAnswer}"> <div class="Answer_List" :class="{'Is_Answer':subItem.IsAnswer&&isShowAnswer}">
{{subItem.Name}} {{subItem.Name}}
</div> </div>
</template> </template>
...@@ -87,7 +83,8 @@ ...@@ -87,7 +83,8 @@
{{subIndex+1}} {{subIndex+1}}
</td> </td>
<td> <td>
<div class="InpDIV" v-html="subItem.Content" style="border:0;margin-top:-2px;" @click="changeEdit(subIndex)"> <div class="InpDIV" v-html="subItem.Content" style="border:0;margin-top:-2px;"
@click="changeEdit(subIndex)">
</div> </div>
</td> </td>
<td style="width:30px;text-align:center;"> <td style="width:30px;text-align:center;">
...@@ -98,7 +95,7 @@ ...@@ -98,7 +95,7 @@
<template v-if="item.QuestionKey=='judge'"> <template v-if="item.QuestionKey=='judge'">
<tr v-for="(subItem,subIndex) in item.SubAnwser"> <tr v-for="(subItem,subIndex) in item.SubAnwser">
<td style="width:50px;"> <td style="width:50px;">
<div class="Answer_List2" @click="ChangeItem(item,subItem)" :class="{'Is_Answer':subItem.IsAnswer}"> <div class="Answer_List2" @click="ChangeItem(item,subItem)" :class="{'Is_Answer':subItem.IsAnswer&&isShowAnswer}">
{{subItem.Name}} {{subItem.Name}}
</div> </div>
</td> </td>
...@@ -121,194 +118,33 @@ ...@@ -121,194 +118,33 @@
</div> </div>
</template> </template>
<script> <script>
import {
getOptionList, //获取选择标签【A,B,C,D....】
optionListConfig,
CreateQuestion
} from '../../api/question/questionconfig'
import {
queryQuestionTypeList,
} from '../../api/question/question'
import UeEditor from '../editor/UeEditor'
export default { export default {
props: { props: {
questionData: { questionObj: {
type: Array, type: Object,
},
//是否显示答案和解析
isShowAnswer: {
type: Boolean,
default: false,
} }
}, },
components: {
UeEditor
},
data() { data() {
return { return {
data: this.questionData, data: this.questionObj,
config: {
initialFrameWidth: null,
initialFrameHeight: 80,
},
optionTitleList: [],
firstTypeList: [], //问题类型
commonIndex: -1,
isShow: true,
commonIndex2: -2,
childIndex: -1,
}; };
}, },
created() {
this.initConfig();
this.getQuestionType();
},
methods: {
//获取题型列表
getQuestionType() {
queryQuestionTypeList({}).then(res => {
if (res.Code == 1) {
var tempArray = res.Data;
if (tempArray && tempArray.length > 0) {
this.firstTypeList = tempArray.slice(0, 5);
}
}
});
},
initConfig() {
this.optionTitleList = getOptionList();
},
//删除小题
deleteQuestion(index) {
this.$q.dialog({
title: '提示信息',
message: '是否确定删除?',
cancel: true,
persistent: true,
ok: "确定",
cancel: "取消",
}).onOk(() => {
this.data.splice(index, 1);
}).onCancel(() => {
}); methods: {
},
//添加小题
onItemClick(item) {
var qObj = {
QuestionType: item.QId,
QuestionKey: item.Key,
QuestionName: item.Name,
SubTitle: "", //题目内容
SubAnwser: ""
};
if (item.Key == "short-answer") {
qObj.SubAnwser = [];
qObj.SubAnwser.push({
Content: ""
})
} else {
qObj.SubAnwser = CreateQuestion(item.Key);
}
this.data.push(qObj);
},
//删除选项
deleteOpion(item, index) {
this.$q.dialog({
title: '提示信息',
message: '是否确定删除?',
cancel: true,
persistent: true,
ok: "确定",
cancel: "取消",
}).onOk(() => {
item.SubAnwser.splice(index, 1);
this.childIndex = -1;
this.calcOptionTitle();
}).onCancel(() => {
});
},
//新增选项
addOption(item) {
if (item.SubAnwser.length < 7) {
item.SubAnwser.push({
Name: "",
Content: "",
IsAnswer: false
});
this.calcOptionTitle();
} else {
this.$q.notify({
type: 'warning',
position: 'center',
timeout: 1500,
message: `最多只能添加7个选项`
})
return
}
},
//添加填空
addFillIn(item) {
item.SubAnwser.push({
Content: "",
});
},
//添加小题
addQuestion() {
this.data.push(optionListConfig());
},
//重新计算选择Title[A,B,C,D....]
calcOptionTitle() {
if (this.data && this.data.length > 0) {
this.data.forEach((item, index) => {
if (item.QuestionKey == "single" || item.QuestionKey == "multiple") {
item.SubAnwser.forEach((subItem, subIndex) => {
subItem.Name = this.optionTitleList[subIndex];
})
} else {
item.SubAnwser.forEach((subItem, subIndex) => {
subItem.Name = subIndex + 1;
})
}
})
}
},
//返回数据到父组件
returnDataToParent() {
this.$emit('getChild', this.data);
},
//单选
ChangeItem(item, subItem) {
if (item.SubAnwser && item.SubAnwser.length > 0) {
item.SubAnwser.forEach(childItem => {
childItem.IsAnswer = false;
})
}
subItem.IsAnswer = true;
},
//多选题
changeMutile(subItem) {
subItem.IsAnswer = !subItem.IsAnswer;
},
//点击切换输入
changeEdit(index) {
this.childIndex = index;
},
// //点击展开收起
showNav(index) {
if (this.commonIndex2 == index) {
this.commonIndex = index;
this.isShow = !this.isShow;
} else {
this.commonIndex = index;
this.isShow = false;
this.commonIndex2 = index;
}
},
}, },
mounted() { mounted() {
}, },
watch: { watch: {
data: { isShowAnswer: {
handler(newValue) { handler(newValue) {
this.returnDataToParent();
}, },
deep: true deep: true
}, },
......
...@@ -14,17 +14,17 @@ ...@@ -14,17 +14,17 @@
</style> </style>
<template> <template>
<div class="sharingChooseQuestion"> <div class="sharingChooseQuestion">
<table v-if="data&&data.length>0" class="common_TiTable"> <table v-if="data.QuestionContentObj&&data.QuestionContentObj.length>0" class="common_TiTable">
<thead> <thead>
<tr> <tr>
<th colspan="2" style="text-align:left;"> <th colspan="2" style="text-align:left;">
<template v-if="data[1]&& data[1].length>0"> <template v-if="data.QuestionContentObj[1]&& data.QuestionContentObj[1].length>0">
(1)-({{data[1].length}})题共用备选答案: (1)-({{data.QuestionContentObj[1].length}})题共用备选答案:
</template> </template>
</th> </th>
</tr> </tr>
</thead> </thead>
<tr v-for="(item,index) in data[0]"> <tr v-for="(item,index) in data.QuestionContentObj[0]" :key="index">
<td style="width:40px;text-align:center; "> <td style="width:40px;text-align:center; ">
{{item.Name}} {{item.Name}}
</td> </td>
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
</td> </td>
</tr> </tr>
</table> </table>
<table v-if="data&&data.length>0" class="common_TiTable"> <table v-if="data.QuestionContentObj&&data.QuestionContentObj.length>0" class="common_TiTable">
<tbody v-for="(item,index) in data[1]"> <tbody v-for="(item,index) in data.QuestionContentObj[1]" :key="index">
<tr> <tr>
<td style="width:40px;text-align:center;"> <td style="width:40px;text-align:center;">
({{index+1}}) ({{index+1}})
...@@ -46,8 +46,8 @@ ...@@ -46,8 +46,8 @@
<tr> <tr>
<td> <td>
</td> </td>
<td> <td v-if="isShowAnswer">
答案: {{data[1][index].Name}} 答案: {{data.QuestionContentObj[1][index].Name}}
</td> </td>
</tr> </tr>
</tbody> </tbody>
...@@ -57,11 +57,13 @@ ...@@ -57,11 +57,13 @@
<script> <script>
export default { export default {
props: { props: {
questionData: { questionObj: {
type: Array, type: Object,
}, },
setOption: { //是否显示答案和解析
type: Object isShowAnswer: {
type: Boolean,
default: false,
} }
}, },
components: { components: {
...@@ -69,43 +71,22 @@ ...@@ -69,43 +71,22 @@
}, },
data() { data() {
return { return {
data: this.questionData, data: this.questionObj,
}; };
},
created() {
}, },
methods: { methods: {
//返回数据到父组件
returnDataToParent() {
this.$emit('getChild', this.data);
},
getAnswer() {
this.setOption.Answer = "";
if (this.data && this.data.length > 1) {
var answer = "";
this.data[1].forEach(item => {
answer += "," + item.Name;
})
if (answer != "") {
answer = answer.substring(1);
}
this.setOption.Answer = answer;
}
},
}, },
mounted() { mounted() {
}, },
watch: { watch: {
data: { isShowAnswer: {
handler(newValue) { handler(newValue) {
this.setOption.Title = this.data[1][0].Content;
this.returnDataToParent();
}, },
deep: true deep: true
}, },
} }
}; };
</script>
</script> \ No newline at end of file
<!--简答题--> <!--简答题-->
<style> <style>
.shortAnswerQuestion { .v_shortAnswerQuestion {
width: 100%; width: 100%;
margin-bottom: 20px; margin-bottom: 20px;
} }
</style> </style>
<template> <template>
<div class="shortAnswerQuestion"> <div class="v_shortAnswerQuestion" >
<div style="display:flex;"> <div style="display:flex;" v-if="isShowAnswer">
<div style="font-weight:bold;">答案:</div> <div style="font-weight:bold;">答案:</div>
<div v-html="setOption.Answer"></div> <div v-html="data.Answer"></div>
</div>
<div style="display:flex;" v-if="isShowAnswer">
<div style="font-weight:bold;">解析:</div>
<div v-html="data.AnswerParse"></div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import UeEditor from '../editor/UeEditor'
export default { export default {
props: { props: {
setOption: { questionObj: {
type: Object, type: Object,
},
//是否显示答案和解析
isShowAnswer: {
type: Boolean,
default: false,
} }
}, },
components: {
UeEditor
},
data() { data() {
return { return {
config: { data: this.questionObj,
initialFrameWidth: null,
initialFrameHeight: 80,
},
}; };
}, },
created() {},
methods: { methods: {
}, },
mounted() { mounted() {
}, },
watch: {
isShowAnswer: {
handler(newValue) {
},
deep: true
},
}
}; };
</script> </script>
<style> <style>
.singleQuestion { .v_singleQuestion {
width: 100%; width: 100%;
} }
</style> </style>
<!--单选题--> <!--单选题查看-->
<template> <template>
<div class="singleQuestion"> <div class="v_singleQuestion">
<table v-if="data&&data.length>0"> <table v-if="data&&data.QuestionContentObj&&data.QuestionContentObj.length>0">
<tr v-for="(item,index) in data"> <tbody v-for="(item,index) in data.QuestionContentObj" :key="index">
<td style="width:40px;text-align:center;"> <tr>
<div class="Answer_List2" :class="{'Is_Answer':item.IsAnswer}"> <td style="width:40px;text-align:center;">
{{item.Name}} <div class="Answer_List2">
</div> {{item.Name}}
</td> </div>
<td> </td>
<div class="InpDIV" style="border:0;" v-html="item.Content"></div> <td>
</td> <div class="InpDIV" style="border:0;" v-html="item.Content"></div>
</tr> </td>
</tr>
</tbody>
<tfoot v-if="isShowAnswer">
<tr>
<td colspan="2">正确答案:{{data.Answer}}</td>
</tr>
<tr>
<td colspan="2">解析:<span v-html="data.AnswerParse"></span></td>
</tr>
</tfoot>
</table> </table>
</div> </div>
</template> </template>
<script> <script>
import {
getOptionList, //获取选择标签【A,B,C,D....】
} from '../../api/question/questionconfig'
import UeEditor from '../editor/UeEditor'
export default { export default {
props: { props: {
questionData: { questionObj: {
type: Array,
},
setOption: {
type: Object, type: Object,
},
//是否显示答案和解析
isShowAnswer: {
type: Boolean,
default: false,
} }
}, },
components: {
UeEditor
},
data() { data() {
return { return {
data: this.questionData, data: this.questionObj,
config: {
initialFrameWidth: null,
initialFrameHeight: 90,
},
optionTitleList: [],
commonIndex: -1,
}; };
}, },
created() {
this.initConfig();
},
mounted() {}, mounted() {},
methods: { methods: {
initConfig() {
this.optionTitleList = getOptionList();
},
//删除选项
deleteOpion(index) {
this.$q.dialog({
title: '提示信息',
message: '是否确定删除?',
cancel: true,
persistent: true,
ok: "确定",
cancel: "取消",
}).onOk(() => {
this.data.splice(index, 1);
this.commonIndex = -1;
this.calcOptionTitle();
}).onCancel(() => {
});
},
//新增选项
addOption() {
if (this.data.length < 7) {
this.data.push({
Name: "",
Content: "",
IsAnswer: false
});
this.calcOptionTitle()
} else {
this.$q.notify({
type: 'warning',
position: 'center',
timeout: 1500,
message: `最多只能添加7个选项`
})
return
}
},
//重新计算选择Title[A,B,C,D....]
calcOptionTitle() {
if (this.data && this.data.length > 0) {
this.data.forEach((item, index) => {
if (this.setOption.QuestionTypeKey == "single-number") {
item.Name = index + 1;
} else {
item.Name = this.optionTitleList[index];
}
})
}
},
//返回数据到父组件
returnDataToParent() {
this.getAnswer();
this.$emit('getChild', this.data);
},
ChangeItem(item) {
if (this.data && this.data.length > 0) {
this.data.forEach(item => {
item.IsAnswer = false;
})
}
item.IsAnswer = true;
},
//获取正确答案
getAnswer() {
this.setOption.Answer = "";
if (this.data && this.data.length > 0) {
this.data.forEach(item => {
if (item.IsAnswer) {
this.setOption.Answer = item.Name;
}
})
}
},
//点击切换输入
changeEdit(index) {
this.commonIndex = index;
}
},
mounted() {
}, },
watch: { watch: {
data: { isShowAnswer: {
handler(newValue) { handler(newValue) {
this.returnDataToParent();
}, },
deep: true deep: true
}, },
......
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
</style> </style>
<template> <template>
<div class="sortingProblemQuestion"> <div class="sortingProblemQuestion">
<table v-if="data&&data.length>0"> <table v-if="data&&data.QuestionContentObj&&data.QuestionContentObj.length>0">
<tr v-for="(item,index) in data[0]"> <tr v-for="(item,index) in data.QuestionContentObj[0]">
<td style="width:40px;text-align:center;"> <td style="width:40px;text-align:center;">
{{item.Name}} {{item.Name}}
</td> </td>
...@@ -48,133 +48,50 @@ ...@@ -48,133 +48,50 @@
</tr> </tr>
</table> </table>
<br /> <br />
<table v-if="data&&data.length>0"> <table v-if="isShowAnswer&&data&&data.QuestionContentObj&&data.QuestionContentObj.length>0">
<tr> <tr>
<td> <td>
<span style="font-weight:bold;">答案:</span> <span style="font-weight:bold;">答案:</span>
<span v-for="(cItem,cIndex) in data[0]"> <span v-for="(cItem,cIndex) in data.QuestionContentObj[0]">
{{cItem.Name}} {{cItem.Name}}
</span> </span>
</td>
</tr>
<tr>
<td>
解析:<span v-html="data.AnswerParse"></span>
</td> </td>
</tr> </tr>
</table> </table>
</div> </div>
</template> </template>
<script> <script>
import {
getOptionList, //获取选择标签【A,B,C,D....】
} from '../../api/question/questionconfig'
import UeEditor from '../editor/UeEditor'
export default { export default {
props: { props: {
questionData: { questionObj: {
type: Array,
},
setOption: {
type: Object, type: Object,
},
//是否显示答案和解析
isShowAnswer: {
type: Boolean,
default: false,
} }
}, },
components: {
UeEditor
},
data() { data() {
return { return {
data: this.questionData, data: this.questionObj,
config: {
initialFrameWidth: null,
initialFrameHeight: 80,
},
optionTitleList: [],
commonIndex: -1,
clickIndex: -1,
}; };
}, },
created() {
this.initConfig();
},
methods: { methods: {
initConfig() {
this.optionTitleList = getOptionList();
},
//删除选项
deleteOpion(index) {
this.$q.dialog({
title: "删除小题",
message: "确实要删除该选项吗?",
persistent: true,
cancel: {
label: "取消",
flat: true
},
ok: {
label: "确认",
flat: true,
focus: true
}
}).onOk(() => {
this.data[0].splice(index, 1);
this.data[1].splice(index, 1);
this.commonIndex = -1;
this.calcOptionTitle();
});
},
//新增选项
addOption() {
if (this.data.length < 26) {
this.data[0].push({
Name: "",
Content: "",
});
this.data[1].push({
Name: "A",
Content: "",
});
this.calcOptionTitle();
} else {
this.$q.notify({
type: 'warning',
position: 'center',
timeout: 1500,
message: `最多只能添加26个选项`
})
return
}
},
//重新计算选择Title[A,B,C,D....]
calcOptionTitle() {
if (this.data && this.data.length > 0) {
this.data[0].forEach((item, index) => {
item.Name = this.optionTitleList[index];
})
}
},
//返回数据到父组件
returnDataToParent() {
this.getAnswer();
this.$emit('getChild', this.data);
},
//获取正确答案
getAnswer() {
this.setOption.Answer = "";
if (this.data && this.data.length > 0) {
var answer = "";
this.data[1].forEach(item => {
answer += "," + item.Name;
})
if (answer != "") {
answer = answer.substring(1);
}
this.setOption.Answer = answer;
}
},
}, },
mounted() { mounted() {
}, },
watch: { watch: {
data: { isShowAnswer: {
handler(newValue) { handler(newValue) {
this.returnDataToParent();
}, },
deep: true deep: true
}, },
......
This diff is collapsed.
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