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

yemxiug

parent cccf7fe7
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
</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,
}
}, },
components: { //是否显示答案和解析
isShowAnswer: {
type: Boolean,
default: false,
}
}, },
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">
<tr>
<td style="width:40px;text-align:center;padding-top:8px;"> <td style="width:40px;text-align:center;padding-top:8px;">
{{index+1}}</el-checkbox> {{index+1}}</el-checkbox>
</td> </td>
<td> <td>
<div class="InpDIV" style="border:0;margin-top:-2px;" v-html="item.Content"></div> <div class="InpDIV" style="border:0;margin-top:-2px;" v-html="item.Content"></div>
</td> </td>
<td style="width:40px;text-align:center;">
</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,
}
}, },
components: { //是否显示答案和解析
UeEditor isShowAnswer: {
type: Boolean,
default: false,
}
}, },
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">
<tr>
<td style="width:50px;text-align:center;padding-top:8px;"> <td style="width:50px;text-align:center;padding-top:8px;">
{{index+1}}</el-checkbox> {{index+1}}</el-checkbox>
</td> </td>
...@@ -24,60 +16,54 @@ ...@@ -24,60 +16,54 @@
<div class="InpDIV" style="border:0;margin-top:-2px;" v-html="item.Content"></div> <div class="InpDIV" style="border:0;margin-top:-2px;" v-html="item.Content"></div>
</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 />
<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,
}
}, },
components: { //是否显示答案和解析
UeEditor isShowAnswer: {
type: Boolean,
default: false,
}
}, },
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">
<tr>
<td style="width:50px;text-align:center;"> <td style="width:50px;text-align:center;">
<div class="Answer_List2" :class="{'Is_Answer':item.IsAnswer}"> <div class="Answer_List2">
{{item.Name}} {{item.Name}}
</div> </div>
</td> </td>
...@@ -19,58 +20,47 @@ ...@@ -19,58 +20,47 @@
<span v-if="index==1"></span> <span v-if="index==1"></span>
</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 UeEditor from '../editor/UeEditor'
export default { export default {
props: { props: {
questionData: { questionObj: {
type: Array,
},
setOption: {
type: Object, type: Object,
}
}, },
components: { //是否显示答案和解析
UeEditor isShowAnswer: {
type: Boolean,
default: false,
}
}, },
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>
</tr>
<tfoot>
<tr>
<td colspan="3">
</td> </td>
</tr> </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>
</tr>
<tfoot>
<tr>
<td colspan="3">
解析:<span v-html="data.AnswerParse"></span>
</td> </td>
</tr> </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,
}
}, },
components: { //是否显示答案和解析
isShowAnswer: {
type: Boolean,
default: false,
}
}, },
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">
<tr>
<td style="width:40px;text-align:center;"> <td style="width:40px;text-align:center;">
<div class="num_option_dx2" :class="{'Is_Answer':item.IsAnswer}"> <div class="num_option_dx2">
{{item.Name}} {{item.Name}}
</div> </div>
</td> </td>
<td> <td>
<div class="InpDIV" style="border:0;" v-html="item.Content"></div> <div class="InpDIV" style="border:0;" v-html="item.Content"></div>
</td> </td>
<td style="width:40px;text-align:center;">
</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,
}
}, },
components: { //是否显示答案和解析
UeEditor isShowAnswer: {
type: Boolean,
default: false,
}
}, },
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,
}
}, },
components: { //是否显示答案和解析
UeEditor isShowAnswer: {
type: Boolean,
default: false,
}
}, },
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,
}
}, },
components: { //是否显示答案和解析
UeEditor isShowAnswer: {
type: Boolean,
default: false,
}
}, },
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">
<tr>
<td style="width:40px;text-align:center;"> <td style="width:40px;text-align:center;">
<div class="Answer_List2" :class="{'Is_Answer':item.IsAnswer}"> <div class="Answer_List2">
{{item.Name}} {{item.Name}}
</div> </div>
</td> </td>
...@@ -18,129 +19,44 @@ ...@@ -18,129 +19,44 @@
<div class="InpDIV" style="border:0;" v-html="item.Content"></div> <div class="InpDIV" style="border:0;" v-html="item.Content"></div>
</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,
}
}, },
components: { //是否显示答案和解析
UeEditor isShowAnswer: {
type: Boolean,
default: false,
}
}, },
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> </td>
</tr> </tr>
<tr>
<td>
解析:<span v-html="data.AnswerParse"></span>
</td>
</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,
}
}, },
components: { //是否显示答案和解析
UeEditor isShowAnswer: {
type: Boolean,
default: false,
}
}, },
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
}, },
......
...@@ -227,256 +227,110 @@ ...@@ -227,256 +227,110 @@
<div class="examPaper_Top"> <div class="examPaper_Top">
<div style="width:80%;display:flex;"> <div style="width:80%;display:flex;">
<div style="width:36%;margin-right:20px;"> <div style="width:36%;margin-right:20px;">
{{DataObj.PaperName}} {{DataObj.PaperName}} <br />
创建人: &nbsp;&nbsp;&nbsp;题量:{{examNum}} &nbsp;&nbsp;&nbsp; 满分:{{examScore}}
</div> <q-checkbox size="xs" v-model="isShowAnswer" label="显示答案" />
<div style="width:24%;">
<q-select filled option-value="Id" option-label="Name" :options="questionDifficultyTypeList" emit-value
map-options label="难度" use-input clearable v-model="DataObj.DifficultyType" />
</div> </div>
</div> </div>
<div style="width:20%;text-align:right;"> <div style="width:20%;text-align:right;">
<q-btn color="accent" size="sm" class="q-mr-md" label="预览" /> <q-btn color="accent" size="sm" class="q-mr-md" label="返回" />
<q-btn color="accent" size="sm" class="q-mr-md" label="保存并返回" @click="SavePaper()" />
</div> </div>
</div> </div>
<div class="Exam-main"> <div class="Exam-main">
<div class="Exam-left f1">
<p class="Left-ptitel">
<span>题量:<i>{{examNum}}</i></span>
<span>  总分:<i>{{examScore}}</i></span>
</p>
<div class="Left-list" style="height:740px;overflow:auto;">
<template v-if="DataObj&&DataObj.GroupList&&DataObj.GroupList.length>0"> <template v-if="DataObj&&DataObj.GroupList&&DataObj.GroupList.length>0">
<div class="List-con1" v-for="(gItem,gIndex) in DataObj.GroupList" :key="gIndex"> <div v-for="(gItem,gIndex) in DataObj.GroupList" :key="gIndex">
<div class="List-bt"> <span>{{gIndex+1}}{{gItem.GroupName}} (共 {{gItem.DetailsList.length}} 题,{{gItem.GScore}}分)</span>
<strong class="f1"> <div v-for="(dItem,dIndex) in gItem.DetailsList" :key="dIndex">
<template v-if="!gItem.isShowEdit">{{gIndex+1}}&nbsp;{{gItem.GroupName}}</template> <span>{{dIndex+1}}</span>
<template v-else> <span v-html="dItem.Title"></span>
<input style="width:160px;margin-right:10px;" v-model="gItem.GroupName" /> <span>
<input style="width:40px;" filled v-model="gItem.GScore" @change="changeGroupScore(gItem)" /> ({{dItem.Score}}分)
</template>
</strong>
<i class="iconfont icon-edit" title="编辑" style="font-size:18px;margin-right:5px;"
@click="getNameEdit(DataObj.GroupList,gIndex)"></i>
<i class="iconfont icon-ico_commodity_defaul" v-if="gItem.isShowEdit" title="保存"
style="top:0;margin-right:5px;" @click="saveExamName(DataObj.GroupList)"></i>
<i class="iconfont icon-shangyi2" style="margin-right:5px;" @click.stop="MoveFatherItem(gIndex,0)"
v-if="gIndex!=0"></i>
<i class="iconfont icon-xiayi" @click.stop="MoveFatherItem(gIndex,1)"
v-if="gIndex!=DataObj.GroupList.length-1"></i>
<i class="iconfont icon-shanchu2" style="margin-left:5px;" @click.stop="removeFather(gItem,gIndex)"></i>
</div>
<ul class="List-ul" v-if="gItem.DetailsList&&gItem.DetailsList.length>0">
<li class="" style="cursor:pointer;" :class="{'checkUl':dIndex==ComCheckIndex&&gIndex==ComOneIndex}"
v-for="(dItem,dIndex) in gItem.DetailsList" :key="dIndex" @click="ClickItem(dItem,gIndex,dIndex)">
({{dIndex+1}}) <span class="exam_DetailList" v-html="dItem.ShowTitle"></span>
<span class="exam_ListSHow">
<i class="iconfont icon-shangyi2" @click.stop="MoveChildItem(gIndex,dIndex,0)"
style="margin-right:5px;" v-if="dIndex!=0"></i>
<i class="iconfont icon-xiayi" @click.stop="MoveChildItem(gIndex,dIndex,1)"
v-if="dIndex!=gItem.DetailsList.length-1"></i>
<i class="iconfont icon-shanchu2" @click.stop="delExam(gItem.DetailsList,dItem,dIndex)"
style="margin-left:5px;font-size:17px;"></i>
</span> </span>
</li>
</ul>
</div>
</template>
</div>
</div>
<div class="Exam-right f1">
<div class="Left-btn">
 <div>
<template v-for="(fItem,fIndex) in firstTypeList">
<q-btn :key="fIndex" color="accent" :id="commonIndex==fIndex?'btn1':''" size="sm" :label="fItem.Name"
style="margin-left:5px;" @click="onItemClick(fItem,fIndex)" />
</template>
<q-btn-dropdown color="accent" size="sm" label="更多" style="margin-left:5px;">
<q-list>
<q-item v-for="(fItem,fIndex) in secondTypeList" @click="onItemClick(fItem)" clickable v-close-popup
:key="fIndex">
<q-item-section>
<q-item-label>{{fItem.Name}}</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
</div>
 <div>
<q-btn color="accent" size="sm" @click="isShowQuestion=true" class="q-mr-md" label="题库选题"  />
</div>
</div>
<div class="row wrap" v-if="ChooseItem" style="padding:20px;">
<div class="edit_stem">
<q-input filled stack-label maxlength="5" :dense="false" @keyup.native="checkInteger(ChooseItem,'Score')"
v-model="ChooseItem.Score" class="col-12 q-pb-lg" label="分数" />
</div>
<div class="col-12">
<template v-if="ChooseItem.QuestionTypeKey=='cloze'">
<span class="question_number">选项处用##题号##替换,如##1##</span>
</template>
<UeEditor v-if="ChooseItem.QuestionTypeKey!='sharing-choose'" v-model="ChooseItem.Title" :config="config"
ref="UE_Title"></UeEditor>
</div>
<br /> <br />
<!--单选题--> <!--单选题-->
<single v-if="ChooseItem.QuestionTypeKey=='single'||ChooseItem.QuestionTypeKey=='single-number'" <v-single v-if="dItem.QuestionTypeKey=='single'||dItem.QuestionTypeKey=='single-number'"
:questionData="ChooseItem.QuestionContentObj" @getChild="getChildData" :setOption="ChooseItem"></single> :questionObj="dItem" :isShowAnswer="isShowAnswer">
</v-single>
<!--多选题--> <!--多选题-->
<multiple v-if="ChooseItem.QuestionTypeKey=='multiple'" :questionData="ChooseItem.QuestionContentObj" <v-multiple v-if="dItem.QuestionTypeKey=='multiple'" :questionObj="dItem" :isShowAnswer="isShowAnswer">
@getChild="getChildData" :setOption="ChooseItem"></multiple> </v-multiple>
<!--填空题--> <!--填空题-->
<fill-in v-if="ChooseItem.QuestionTypeKey=='fill-in'" :questionData="ChooseItem.QuestionContentObj" <v-fillin v-if="dItem.QuestionTypeKey=='fill-in'" :questionObj="dItem" :isShowAnswer="isShowAnswer">
@getChild="getChildData" :setOption="ChooseItem"></fill-in> </v-fillin>
<!--判断题--> <!--判断题-->
<judge v-if="ChooseItem.QuestionTypeKey=='judge'" :questionData="ChooseItem.QuestionContentObj" <v-judge v-if="dItem.QuestionTypeKey=='judge'" :questionObj="dItem" :isShowAnswer="isShowAnswer"></v-judge>
@getChild="getChildData" :setOption="ChooseItem"></judge>
<!--简答题、名词解释、论述题、计算题、口语题、其它--> <!--简答题、名词解释、论述题、计算题、口语题、其它-->
<short-answer v-if="ChooseItem.QuestionTypeKey=='short-answer'||ChooseItem.QuestionTypeKey=='noun-explanation'||ChooseItem.QuestionTypeKey=='essay-question' <v-shortanswer v-if="dItem.QuestionTypeKey=='short-answer'||dItem.QuestionTypeKey=='noun-explanation'||dItem.QuestionTypeKey=='essay-question'
||ChooseItem.QuestionTypeKey=='calculation' || ChooseItem.QuestionTypeKey=='spoken'|| ChooseItem.QuestionTypeKey=='other' ||dItem.QuestionTypeKey=='calculation' || dItem.QuestionTypeKey=='spoken'|| dItem.QuestionTypeKey=='other'
" :setOption="ChooseItem"> </short-answer> " :questionObj="dItem" :isShowAnswer="isShowAnswer"> </v-shortanswer>
<!--分录题、资料题--> <!--分录题、资料题-->
<entry-problem v-if="ChooseItem.QuestionTypeKey=='entry-problem'|| ChooseItem.Key=='data-question'" <v-entryproblem v-if="dItem.QuestionTypeKey=='entry-problem'|| dItem.QuestionTypeKey=='data-question'"
:questionData="ChooseItem.QuestionContentObj" :setOption="ChooseItem" @getChild="getChildData"> :questionObj="dItem" :isShowAnswer="isShowAnswer">
</entry-problem> </v-entryproblem>
<!--连线题--> <!--连线题-->
<matching v-if="ChooseItem.QuestionTypeKey=='matching'" :questionData="ChooseItem.QuestionContentObj" <v-matching v-if="dItem.QuestionTypeKey=='matching'" :questionObj="dItem" :isShowAnswer="isShowAnswer">
:setOption="ChooseItem" @getChild="getChildData"></matching> </v-matching>
<!--排序题--> <!--排序题-->
<sorting-problem v-if="ChooseItem.QuestionTypeKey=='sorting-problem'" <v-sortingproblem v-if="dItem.QuestionTypeKey=='sorting-problem'" :questionObj="dItem"
:questionData="ChooseItem.QuestionContentObj" :setOption="ChooseItem" @getChild="getChildData"> :isShowAnswer="isShowAnswer"></v-sortingproblem>
</sorting-problem>
<!--完型填空--> <!--完型填空-->
<cloze v-if="ChooseItem.QuestionTypeKey=='cloze'" :questionData="ChooseItem.QuestionContentObj" <v-cloze v-if="dItem.QuestionTypeKey=='cloze'" :questionObj="dItem" :isShowAnswer="isShowAnswer"></v-cloze>
:setOption="ChooseItem" @getChild="getChildData"></cloze>
<!--阅读理解、听力题--> <!--阅读理解、听力题-->
<reading-comprehensio <v-readingcomprehensio
v-if="ChooseItem.QuestionTypeKey=='reading-comprehensio'||ChooseItem.QuestionTypeKey=='listening'" v-if="dItem.QuestionTypeKey=='reading-comprehensio'||dItem.QuestionTypeKey=='listening'"
:questionData="ChooseItem.QuestionContentObj" :setOption="ChooseItem" @getChild="getChildData"> :questionObj="dItem" :isShowAnswer="isShowAnswer"></v-readingcomprehensio>
</reading-comprehensio>
<!--共用选择题--> <!--共用选择题-->
<sharing-choose v-if="ChooseItem.QuestionTypeKey=='sharing-choose'" <v-sharingchoose v-if="dItem.QuestionTypeKey=='sharing-choose'" :questionObj="dItem"
:questionData="ChooseItem.QuestionContentObj" @getChild="getChildData" :setOption="ChooseItem"> :isShowAnswer="isShowAnswer">
</sharing-choose> </v-sharingchoose>
<br />
<div class="col-12">
<div style="margin:20px 0;">答案解析</div>
<UeEditor v-model="ChooseItem.AnswerParse" :config="config" ref="UE_AnswerParse"></UeEditor>
</div> </div>
<br />
<div class="col-12 commonDalei" style="margin-top:20px;">
<span class="difficulty_Degree">难度:</span>
<q-select filled option-value="Id" size="sm" style="display:inline-block;width:300px;" option-label="Name"
v-model="ChooseItem.DifficultyType" :options="questionDifficultyTypeList" emit-value map-options />
</div>
<div class="col-12 commonDalei">
<br />
<span class="difficulty_Degree">所属大类:</span>
<q-select filled option-value="Id" size="sm" style="display:inline-block;width:300px;" option-label="Name"
v-model="ChooseItem.Category" :options="questionCategoryList" emit-value map-options />
</div>
<div class="col-12 commonDalei">
<br />
<span class="difficulty_Degree">考级程度:</span>
<q-select filled option-value="Id" size="sm" style="display:inline-block;width:300px;" option-label="Name"
v-model="ChooseItem.LevelType" :options="questionLevalTypeList" emit-value map-options />
</div> </div>
<div class="col-12"> </template>
<span class="difficulty_Degree">知识点:</span>
<a class="addKnowledge" @click="isShowPoint=true">
<i class="iconfont icon-add" style="position:relative;top:1px;"></i>选择知识点
</a>
<span class="knowledge_List" v-for="(x, i) in choosePointArray" :key="i">
{{x.PointName}}
<i class="iconfont icon-shanchu1" @click="removePointTag(i)"></i>
</span>
</div>
</div>
</div>
<questionForm v-if="isShowQuestion" @close="closeQuestForm" @success="getQuestionList"></questionForm>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import UeEditor from '../../components/editor/UeEditor' import vSingle from '../../components/questiontype/v-single'
//知识点列表 import vMultiple from '../../components/questiontype/v-multiple'
import questionpoint from '../../components/question/questionpoint' import vFillin from '../../components/questiontype/v-fillin'
import vJudge from '../../components/questiontype/v-judge'
import single from '../../components/questiontype/single' import vShortanswer from '../../components/questiontype/v-shortanswer'
import multiple from '../../components/questiontype/multiple' import vEntryproblem from '../../components/questiontype/v-entryproblem'
import fillIn from '../../components/questiontype/fill-in' import vMatching from '../../components/questiontype/v-matching'
import judge from '../../components/questiontype/judge' import vSortingproblem from '../../components/questiontype/v-sortingproblem'
import shortAnswer from '../../components/questiontype/short-answer' import vCloze from '../../components/questiontype/v-cloze'
import entryProblem from '../../components/questiontype/entry-problem' import vReadingcomprehensio from '../../components/questiontype/v-readingcomprehensio'
import matching from '../../components/questiontype/matching' import vSharingchoose from '../../components/questiontype/v-sharingchoose'
import sortingProblem from '../../components/questiontype/sorting-problem'
import cloze from '../../components/questiontype/cloze'
import readingComprehensio from '../../components/questiontype/reading-comprehensio'
import sharingChoose from '../../components/questiontype/sharing-choose'
import questionForm from '../../components/exam/question-form'
import { import {
GetPaper, GetPaper,
savePaperInfo,
} from '../../api/teacher/index'; } from '../../api/teacher/index';
import {
CreateQuestion, //生成问题
} from '../../api/question/questionconfig'
import {
queryQuestionTypeList,
queryDifficultyType,
queryQuestionCategory,
queryQuestionLevelType,
DeletePaperGroup,
DeletePaperDetails
} from '../../api/question/question'
export default { export default {
components: { components: {
UeEditor, vSingle,
questionpoint, //知识点 vMultiple,
single, //单选题 vFillin,
multiple, //多选题 vJudge,
fillIn, //填空题 vShortanswer,
judge, //判断题 vEntryproblem,
shortAnswer, //简答题 vMatching,
entryProblem, //分录题 vSortingproblem,
matching, //连线题 vCloze,
sortingProblem, //排序题 vReadingcomprehensio,
cloze, //完型填空 vSharingchoose
readingComprehensio, //阅读理解
sharingChoose, //共用选择题、
questionForm
}, },
meta: { meta: {
title: "考试" title: "试卷详情"
}, },
watch: { watch: {
'ChooseItem.Title': {
handler(newValue) {
this.ChooseItem.ShowTitle = newValue;
},
deep: true
},
'ChooseItem.Score': {
handler(newValue) {
this.ChooseItem.Score = newValue;
this.calcPaper();
},
deep: true
},
'ChooseItem.QuestionContentObj': {
handler(newValue) {
this.ChooseItem.QuestionContentObj = newValue;
},
deep: true
}
}, },
data() { data() {
return { return {
config: {
initialFrameWidth: null,
initialFrameHeight: 80,
},
msg: { msg: {
PaperId: 0 PaperId: 0
}, },
...@@ -492,31 +346,15 @@ ...@@ -492,31 +346,15 @@
ParentId: 0, //父节点编号, ParentId: 0, //父节点编号,
GroupList: [], //试卷答题分类 GroupList: [], //试卷答题分类
}, },
//点击问题对象 isShowAnswer: false, //是否显示答案
ChooseItem: {}, examScore: 0, //总分,
questionDifficultyTypeList: [], //难易程度列表 examNum: 0, //总题量
questionLevalTypeList: [],
questionCategoryList: [], //分类
choosePointArray: [], //选择知识点
firstTypeList: [], //第一类题型
secondTypeList: [], //第二类题型
allTypeList: [], //所有题型
isShowQuestion: false,
commonIndex: -1,
examNum: 0, //题量
examScore: 0, //总分
ComOneIndex: -1,
ComCheckIndex: -1
} }
}, },
created() { created() {
if (this.$route.query && this.$route.query.Id) { if (this.$route.query && this.$route.query.Id) {
this.msg.PaperId = decodeURI(this.$route.query.Id) this.msg.PaperId = decodeURI(this.$route.query.Id)
} }
this.getQuestionType();
this.getDifficultyType();
this.getQuestionCategory();
this.getQuestionLevelType();
}, },
mounted() { mounted() {
if (this.msg.PaperId && this.msg.PaperId > 0) { if (this.msg.PaperId && this.msg.PaperId > 0) {
...@@ -524,233 +362,7 @@ ...@@ -524,233 +362,7 @@
} }
}, },
methods: { methods: {
//大类改变分数 //获取试卷详情
changeGroupScore(gItem) {
var subScore = 0;
if (gItem.GScore && gItem.GScore > 0) {
subScore = gItem.GScore;
}
if (gItem.DetailsList && gItem.DetailsList.length > 0) {
var avgScore = Number(subScore / gItem.DetailsList.length).toFixed(2);
gItem.DetailsList.forEach(sItem => {
sItem.Score = avgScore;
})
}
this.calcPaper();
},
//上移下移(IsUp:0上移,1下移)
MoveFatherItem(subIndex, IsUp) {
var currentItem = this.DataObj.GroupList[subIndex];
//上移
if (IsUp == 0) {
if (subIndex > 0) {
var upItem = this.DataObj.GroupList[subIndex - 1];
this.$set(this.DataObj.GroupList, subIndex - 1, currentItem);
this.$set(this.DataObj.GroupList, subIndex, upItem);
this.$forceUpdate();
}
} else {
//下移
if (subIndex != this.DataObj.GroupList.length - 1) {
var downItem = this.DataObj.GroupList[subIndex + 1];
this.$set(this.DataObj.GroupList, subIndex + 1, currentItem);
this.$set(this.DataObj.GroupList, subIndex, downItem);
this.$forceUpdate();
}
}
},
//移动子项
MoveChildItem(Index, subIndex, IsUp) {
var currentItem = this.DataObj.GroupList[Index].DetailsList[subIndex];
//上移
if (IsUp == 0) {
if (subIndex > 0) {
var upItem = this.DataObj.GroupList[Index].DetailsList[subIndex - 1];
this.$set(this.DataObj.GroupList[Index].DetailsList, subIndex - 1, currentItem);
this.$set(this.DataObj.GroupList[Index].DetailsList, subIndex, upItem);
this.$forceUpdate();
}
} else {
//下移
if (subIndex != this.DataObj.GroupList[Index].DetailsList.length - 1) {
var downItem = this.DataObj.GroupList[Index].DetailsList[subIndex + 1];
this.$set(this.DataObj.GroupList[Index].DetailsList, subIndex + 1, currentItem);
this.$set(this.DataObj.GroupList[Index].DetailsList, subIndex, downItem);
this.$forceUpdate();
}
}
},
//删除题目
delExam(gitem, item, index) {
if (item.Id == 0) {
gitem.splice(index, 1);
} else {
this.$q.dialog({
title: '提示信息',
message: '是否确定删除',
cancel: true,
persistent: true,
ok: "确定",
cancel: "取消",
}).onOk(() => {
let msg = {
Id: item.Id,
}
DeletePaperDetails(msg).then(res => {
if (res.Code == 1) {
this.GetPaperInfo();
}
})
}).onCancel(() => {
});
}
this.calcPaper();
},
//点击修改标题名字和分数
getNameEdit(item, index) {
item.forEach(x => {
x.isShowEdit = false;
})
item[index].isShowEdit = true;
this.$forceUpdate();
},
//鼠标移开输入框 保存数据 还有隐藏输入框
saveExamName(item) {
item.forEach(x => {
x.isShowEdit = false;
})
this.$forceUpdate();
},
//获取子组件内容
getChildData(obj) {
if (obj) {
this.ChooseItem.QuestionContent = JSON.stringify(obj);
}
},
//获取题型列表
getQuestionType() {
queryQuestionTypeList({}).then(res => {
if (res.Code == 1) {
var tempArray = res.Data;
this.allTypeList = tempArray;
if (tempArray && tempArray.length > 0) {
this.firstTypeList = tempArray.slice(0, 5);
this.secondTypeList = tempArray.slice(5);
}
}
});
},
//题型点击【添加问题】
onItemClick(item, index) {
var questionObj = this.getDetailsObj();
questionObj.QuestionTypeId = item.QId;
questionObj.QuestionTypeKey = item.Key;
questionObj.GroupName = item.Name;
var obj = CreateQuestion(item.Key);
questionObj.QuestionContentObj = obj;
if (obj) {
questionObj.QuestionContent = JSON.stringify(obj);
}
var tempArray = [];
tempArray.push(questionObj);
this.AddQuestion(tempArray);
},
//添加问题
AddQuestion(qArray) {
if (this.DataObj) {
if (!this.DataObj.GroupList) {
this.DataObj.GroupList = [];
}
if (qArray && qArray.length > 0) {
qArray.forEach(qItem => {
if (!this.checkGroupExists(qItem.QuestionTypeId)) {
this.DataObj.GroupList.push({
GId: 0, //大题分组编号
PaperId: 0, //试卷编号
GroupName: qItem.GroupName,
QuestionTypeId: qItem.QuestionTypeId,
QuestionTypeKey: qItem.QuestionTypeKey,
GSortNum: 0,
GScore: 0, //分数
DetailsList: [], //问题列表
});
}
this.DataObj.GroupList.forEach((gItem, gIndex) => {
if (gItem.QuestionTypeId == qItem.QuestionTypeId) {
if (!gItem.DetailsList) {
gItem.DetailsList = [];
}
gItem.DetailsList.push(qItem);
}
})
})
}
}
this.calcPaper();
},
//判断题库是否存在
checkGroupExists(QuestionTypeId) {
var isExistsGroup = false;
if (this.DataObj && this.DataObj.GroupList && this.DataObj.GroupList.length > 0) {
this.DataObj.GroupList.forEach(item => {
if (!isExistsGroup) {
if (item.QuestionTypeId == QuestionTypeId) {
isExistsGroup = true;
}
}
})
}
return isExistsGroup;
},
//获取试卷问题详细Obj
getDetailsObj() {
var objOption = {
Id: 0, //试卷详情编号
PaperId: 0, //试卷编号
BankId: 0, //题库编号
QuestionId: 0, //问题编号
Title: "", //问题标题
QuestionContent: "", //问题内容
DifficultyType: 1, //问题难易程度
AnswerParse: "", //答案解析
QuestionTypeId: 0, //问题类型编号
QuestionTypeKey: "", //问题类型Key
Knowledge: "", //知识点
IsUpdateJobExam: 0, //是否同步修改引用此题目的作业和考试(1-是)
SortNum: 0, //排序
Answer: '', //问题答案【JSON字符串】
QuestionContentObj: [], //问题选项
IsMutex: 1, //填空题(答案顺序打乱也判正确)
Category: 0, //问题大类,
LevelType: 1, //考级程度
Score: 0, //分数
GroupName: "", //分组名称
ShowTitle: ''
};
return objOption;
},
//获取问题大类
getQuestionCategory() {
queryQuestionCategory().then(res => {
this.questionCategoryList = res.Data;
})
},
//获取问题考级程度
getQuestionLevelType() {
queryQuestionLevelType().then(res => {
this.questionLevalTypeList = res.Data;
})
},
//获取问题难易程度列表
getDifficultyType() {
queryDifficultyType().then(res => {
if (res.Code == 1) {
this.questionDifficultyTypeList = res.Data;
}
});
},
//获取题目
GetPaperInfo() { GetPaperInfo() {
GetPaper(this.msg).then(res => { GetPaper(this.msg).then(res => {
var tempData = res.Data; var tempData = res.Data;
...@@ -787,214 +399,6 @@ ...@@ -787,214 +399,6 @@
} }
}) })
} }
},
//点击问题
ClickItem(questionItem, index, index2) {
this.ChooseItem = {};
this.ComOneIndex = index;
this.ComCheckIndex = index2;
this.ChooseItem = questionItem;
this.ChooseItem.QuestionContentObj = questionItem.QuestionContentObj;
if (questionItem.QuestionTypeKey != 'sharing-choose') {
this.$refs.UE_Title.reloadNewValue();
}
this.$refs.UE_AnswerParse.reloadNewValue();
this.ChooseItem.AnswerParse = questionItem.AnswerParse;
this.$forceUpdate();
},
//保存题目
SavePaper() {
if (this.validateType()) {
savePaperInfo(this.DataObj).then(res => {
if (res.Code == 1) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '操作成功!',
position: 'top'
})
this.$router.push({
path: '/exam/examPaper',
query: {}
});
} else {
this.$q.notify({
type: 'negative',
position: "top",
message: `操作失败!`
})
}
})
}
},
//验证
validateType() {
var result = true;
for (let k = 0; k < this.DataObj.GroupList.length; k++) {
//连线题
if (this.DataObj.GroupList[k].QuestionTypeKey == 'matching') {
for (let j = 0; j < this.DataObj.GroupList[k].DetailsList.length; j++) {
if (this.DataObj.GroupList[k].DetailsList[j].QuestionContentObj.length > 0) {
for (let p = 0; p < this.DataObj.GroupList[k].DetailsList[j].QuestionContentObj[0].length; p++) {
if (this.DataObj.GroupList[k].DetailsList[j].QuestionContentObj[0][p].Content == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `${this.DataObj.GroupList[k].GroupName}${j+1}题第一组第${p+1}行数据内容为空!`
})
result = false;
return;
}
}
}
}
}
//单选题
if (this.DataObj.GroupList[k].QuestionTypeKey == 'single') {
var Num = 0;
for (let i = 0; i < this.DataObj.GroupList[k].DetailsList.length; i++) {
if (this.DataObj.GroupList[k].DetailsList[i].Title == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `${this.DataObj.GroupList[k].GroupName}${i+1}题标题为空!`
})
result = false;
return;
}
for (let j = 0; j < this.DataObj.GroupList[k].DetailsList[i].QuestionContentObj.length; j++) {
if (this.DataObj.GroupList[k].DetailsList[i].QuestionContentObj[j].Content == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `请填写${this.DataObj.GroupList[k].GroupName}${i+1}题选项!`
})
result = false;
return;
}
if (this.DataObj.GroupList[k].DetailsList[i].QuestionContentObj[j].IsAnswer) {
Num++
}
}
}
if (Num == 0) {
this.$q.notify({
type: 'negative',
position: "top",
message: `请设置单选题答案选项`
})
result = false;
return;
}
}
}
return result;
},
//js 判断重复
isRepeat(Arr, type) {
var result = true;
var msg = '';
switch (type) {
case 1:
msg = '第1组数据选项不能相同'
break;
case 2:
msg = '第2组数据选项不能相同'
break;
case 3:
msg = '选项内容不能相同'
break;
case 4:
msg = '题干内容不能相同!';
break;
default:
}
let num = 0;
for (var i = 0; i < Arr.length - 1; i++) {
for (var j = i + 1; j < Arr.length; j++) {
if (Arr[i].Content === Arr[j].Content) {
this.$q.notify({
type: 'negative',
position: "top",
message: msg
})
num++;
}
}
}
if (num > 0) {
result = false;
} else {
result = true;
}
return result;
},
closeQuestForm() {
this.isShowQuestion = false;
},
//获取选择的问题列表
getQuestionList(qArray) {
var tempArray = [];
if (qArray && qArray.length > 0) {
qArray.forEach(eItem => {
var qObj = this.getDetailsObj();
qObj.QuestionId = eItem.QuestionId;
qObj.Title = eItem.SourceTitle;
qObj.ShowTitle = eItem.Title;
qObj.QuestionContent = eItem.QuestionContent;
qObj.DifficultyType = eItem.DifficultyType;
qObj.AnswerParse = eItem.AnswerParse;
qObj.QuestionTypeId = eItem.QuestionTypeId;
qObj.QuestionTypeKey = eItem.QuestionTypeKey;
qObj.Knowledge = eItem.Knowledge;
qObj.IsUpdateJobExam = eItem.IsUpdateJobExam;
qObj.SortNum = eItem.SortNum;
qObj.Answer = eItem.Answer;
qObj.IsMutex = eItem.IsMutex;
qObj.Category = eItem.Category;
qObj.LevelType = eItem.LevelType;
var tempType = this.allTypeList.find(x => x.QId == qObj.QuestionTypeId);
if (tempType) {
qObj.GroupName = tempType.Name;
}
//问题选项
if (eItem.QuestionContent) {
qObj.QuestionContentObj = JSON.parse(eItem.QuestionContent);
}
tempArray.push(qObj);
});
}
this.AddQuestion(tempArray);
this.isShowQuestion = false;
},
//删除分组及问题
removeFather(item, index) {
if (item.GId == 0) {
this.DataObj.GroupList.splice(index, 1);
} else {
this.$q.dialog({
title: '提示信息',
message: '是否确定删除',
cancel: true,
persistent: true,
ok: "确定",
cancel: "取消",
}).onOk(() => {
let msg = {
GId: item.GId,
QuestionTypeId: item.QuestionTypeId
}
DeletePaperGroup(msg).then(res => {
if (res.Code == 1) {
this.GetPaperInfo();
}
})
}).onCancel(() => {
});
}
this.calcPaper();
} }
} }
} }
......
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