Commit 1ec9e74c authored by 黄奎's avatar 黄奎

页面修改

parent fa51384d
...@@ -184,3 +184,259 @@ export function CreateQuestion(questionKey) { ...@@ -184,3 +184,259 @@ export function CreateQuestion(questionKey) {
} }
return AnswerList; return AnswerList;
} }
/**
* 【单选题、多选题、数字选择题】验证
*/
export function chooseValidate(gName, detailsList) {
var message = "";
//单选题 多选题
if (detailsList && detailsList.length > 0) {
for (let i = 0; i < detailsList.length; i++) {
var Num = 0;
if (detailsList[i].Title == '') {
message = `请填写【${gName}】第 ${i+1} 题 问题内容!`;
return message;
}
for (let j = 0; j < detailsList[i].QuestionContentObj.length; j++) {
if (detailsList[i].QuestionContentObj[j].Content == '') {
message = `请填写【${gName}】第 ${i+1} 题,选项 ${detailsList[i].QuestionContentObj[j].Name} 内容!`;
return message;
}
if (detailsList[i].QuestionContentObj[j].IsAnswer) {
Num++
}
}
if (Num == 0) {
message = `请设置【${gName}】第 ${i+1} 题 正确答案!`;
return message;
}
}
}
return message;
}
/**
* 【填空题、分录题、资料题】验证
*/
export function fillInValidate(gName, detailsList) {
var message = "";
for (let i = 0; i < detailsList.length; i++) {
if (detailsList[i].Title == '') {
message = `请填写【${gName}】第 ${i+1} 题 问题内容!`;
return message;
}
for (let j = 0; j < detailsList[i].QuestionContentObj.length; j++) {
if (detailsList[i].QuestionContentObj[j].Content == '') {
message = `请填写【${gName}】第 ${i+1} 题,第 ${j+1} 空 答案!`;
return message;
}
}
}
return message;
}
/**
* 【判断题】验证
*/
export function judgeValidate(gName, detailsList) {
var message = "";
for (let i = 0; i < detailsList.length; i++) {
if (detailsList[i].Title == '') {
message = `请填写【${gName}】第 ${i+1} 题 问题内容!`;
return message;
}
}
return message;
}
/**
* 【简答题、名词解释、论述题、计算题、其它题】验证
*/
export function shortanswerValidate(gName, detailsList) {
var message = "";
for (let i = 0; i < detailsList.length; i++) {
if (detailsList[i].Title == '') {
message = `请填写【${gName}】第 ${i+1} 题 问题内容!`;
return message;
}
if (detailsList[i].Answer == '') {
message = `请填写【${gName}】第 ${i+1} 题 问题答案!`;
return message;
}
}
return message;
}
/**
* 【连线题】验证
*/
export function matchingValidate(gName, detailsList) {
var message = "";
for (let i = 0; i < detailsList.length; i++) {
if (detailsList[i].Title == '') {
message = `请填写【${gName}】第 ${i+1} 题 问题内容!`;
return message;
}
if (detailsList[i].QuestionContentObj.length > 0) {
for (let p = 0; p < detailsList[i].QuestionContentObj[0].length; p++) {
if (detailsList[i].QuestionContentObj[0][p].Content == '') {
message = `请填写【${gName}】第 ${i+1} 题 第一组 选项 ${detailsList[i].QuestionContentObj[0][p].Name} 内容!`
return message;
}
}
}
if (detailsList[i].QuestionContentObj.length > 0) {
for (let p = 0; p < detailsList[i].QuestionContentObj[1].length; p++) {
if (detailsList[i].QuestionContentObj[1][p].Content == '') {
message = `请填写【${gName}】第 ${i+1} 题 第二组 选项 ${detailsList[i].QuestionContentObj[1][p].Name} 内容!`
return message;
}
}
}
}
return message;
}
/**
* 【排序题】验证
*/
export function sortingproblemValidate(gName, detailsList) {
var message = "";
if (detailsList && detailsList.length > 0) {
for (let i = 0; i < detailsList.length; i++) {
if (detailsList[i].Title == '') {
message = `请填写【${gName}】第 ${i+1} 题 问题内容!`;
return message;
}
for (let j = 0; j < detailsList[i].QuestionContentObj[0].length; j++) {
if (detailsList[i].QuestionContentObj[0][j].Content == '') {
message = `请填写【${gName}】第 ${i+1} 题 选项 ${detailsList[i].QuestionContentObj[0][j].Name} 内容!`
return message;
}
}
}
}
return message;
}
/**
*【完型填空】验证
*/
export function clozeValidate(gName, detailsList) {
var message = "";
if (detailsList && detailsList.length > 0) {
for (let i = 0; i < detailsList.length; i++) {
if (detailsList[i].Title == '') {
message = `请填写【${gName}】第 ${i+1} 题 问题内容!`;
return message;
}
for (let j = 0; j < detailsList[i].QuestionContentObj.length; j++) {
var Num = 0;
for (var k = 0; k < detailsList[i].QuestionContentObj[j].length; k++) {
if (detailsList[i].QuestionContentObj[j][k].Content == '') {
message =
`请填写【${gName}】第 ${i+1} 题,第 ${j+1} 小题 选项 ${detailsList[i].QuestionContentObj[j][k].Name} 内容!`;
return message;
}
if (detailsList[i].QuestionContentObj[j][k].IsAnswer) {
Num++
}
}
if (Num == 0) {
message = `请设置【${gName}】第 ${i+1} 题,第 ${j+1} 小题 正确答案!`;
return message;
}
}
}
}
return message;
}
/**
* 【阅读理解、听力题】验证
*/
export function readingcomprehensioValidate(gName, detailsList) {
var message = "";
if (detailsList && detailsList.length > 0) {
for (let i = 0; i < detailsList.length; i++) {
if (detailsList[i].Title == '') {
message = `请填写【${gName}】第 ${i+1} 题 问题内容!`;
return message;
}
for (let j = 0; j < detailsList[i].QuestionContentObj.length; j++) {
var subQuestion = detailsList[i].QuestionContentObj[j];
if (subQuestion) {
if (subQuestion.SubTitle == '') {
message = `请填写【${gName}】第 ${i+1} 题,第 ${j+1} 小题 问题内容!`;
return message;
}
//单选题、多选题
if (subQuestion.QuestionKey == 'single' || subQuestion.QuestionKey == "multiple") {
var singleNum = 0;
for (var k = 0; k < subQuestion.SubAnwser.length; k++) {
if (subQuestion.SubAnwser[k].Content == '') {
message = `请填写【${gName}】第 ${i+1} 题,第 ${j+1} 小题 选项 ${subQuestion.SubAnwser[k].Name} 内容!`;
return message;
}
if (subQuestion.SubAnwser[k].IsAnswer) {
singleNum++
}
}
if (singleNum == 0) {
message = `请设置【${gName}】第 ${i+1} 题,第 ${j+1} 小题 正确答案!`;
return message;
}
}
//填空题
if (subQuestion.QuestionKey == "fill-in") {
for (var k = 0; k < subQuestion.SubAnwser.length; k++) {
if (subQuestion.SubAnwser[k].Content == '') {
message = `请填写【${gName}】第 ${i+1} 题,第 ${j+1} 小题 第 ${k+1} 空答案!`;
return message;
}
}
}
//简答题
if (subQuestion.QuestionKey == "short-answer") {
for (var k = 0; k < subQuestion.SubAnwser.length; k++) {
if (subQuestion.SubAnwser[k].Content == '') {
message = `请填写【${gName}】第 ${i+1} 题,第 ${j+1} 小题答案!`;
return message;
}
}
}
}
}
}
}
return message;
}
/**
* 【公用选项题】验证
*/
export function sharingchooseValidate(gName, detailsList) {
var message = "";
if (detailsList && detailsList.length > 0) {
for (var i = 0; i < detailsList.length; i++) {
for (var j = 0; j < detailsList[i].QuestionContentObj[0].length; j++) {
if (detailsList[i].QuestionContentObj[0][j].Content == '') {
message = `请填写【${gName}】第 ${i+1} 题 第一组 选项 ${detailsList[i].QuestionContentObj[0][j].Name} 内容!`;
return message;
}
}
for (var j = 0; j < detailsList[i].QuestionContentObj[1].length; j++) {
if (detailsList[i].QuestionContentObj[1][j].Content == '') {
message = `请填写【${gName}】第 ${i+1} 题 第二组 题干 ${j+1} 内容!`;
return message;
}
if (detailsList[i].QuestionContentObj[1][j].Name == '') {
message = `请选择【${gName}】第 ${i+1} 题 第二组 题干 ${j+1} 答案!`;
return message;
}
}
}
}
return message;
}
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
border: 1px solid #d9d9d9; border: 1px solid #d9d9d9;
margin-left: 20px; margin-left: 20px;
} }
.Left-ptitel { .Left-ptitel {
font-size: 14px; font-size: 14px;
color: #777; color: #777;
...@@ -59,11 +60,13 @@ ...@@ -59,11 +60,13 @@
border-top: 1px solid #d9d9d9; border-top: 1px solid #d9d9d9;
height: calc(100vh - 270px); height: calc(100vh - 270px);
} }
.right_TiList{
.right_TiList {
width: 100%; width: 100%;
overflow: auto; overflow: auto;
height: calc(100vh - 270px); height: calc(100vh - 270px);
} }
.List-ul { .List-ul {
margin: 0; margin: 0;
padding: 0; padding: 0;
...@@ -190,6 +193,7 @@ ...@@ -190,6 +193,7 @@
-webkit-box-shadow: -webkit-gradient(linear, 0 0, 0 100%, color-stop(.5, rgba(255, 255, 255, .2)), color-stop(.5, transparent), to(transparent)); -webkit-box-shadow: -webkit-gradient(linear, 0 0, 0 100%, color-stop(.5, rgba(255, 255, 255, .2)), color-stop(.5, transparent), to(transparent));
background-color: #0ae; background-color: #0ae;
} }
.right_TiList::-webkit-scrollbar { .right_TiList::-webkit-scrollbar {
width: 3px; width: 3px;
height: 3px; height: 3px;
...@@ -209,6 +213,7 @@ ...@@ -209,6 +213,7 @@
-webkit-box-shadow: -webkit-gradient(linear, 0 0, 0 100%, color-stop(.5, rgba(255, 255, 255, .2)), color-stop(.5, transparent), to(transparent)); -webkit-box-shadow: -webkit-gradient(linear, 0 0, 0 100%, color-stop(.5, rgba(255, 255, 255, .2)), color-stop(.5, transparent), to(transparent));
background-color: #0ae; background-color: #0ae;
} }
.commonDalei { .commonDalei {
display: flex; display: flex;
align-content: center; align-content: center;
...@@ -240,22 +245,26 @@ ...@@ -240,22 +245,26 @@
.exam_ListSHow i:hover { .exam_ListSHow i:hover {
color: #2961fe; color: #2961fe;
} }
.paper_GroupName{
max-width:40%; .paper_GroupName {
max-width: 40%;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
margin-right:5px; margin-right: 5px;
} }
.paperEdit_Top{
.paperEdit_Top {
display: flex; display: flex;
font-weight: bold; font-weight: bold;
position: relative; position: relative;
} }
.paperEdit_Top i{
color:#555; .paperEdit_Top i {
color: #555;
font-weight: normal; font-weight: normal;
} }
</style> </style>
<template> <template>
<div class="examPaper page-body"> <div class="examPaper page-body">
...@@ -308,22 +317,25 @@ ...@@ -308,22 +317,25 @@
v-if="gIndex!=0"></i> v-if="gIndex!=0"></i>
<i class="iconfont icon-xiayi" style="margin-right:5px;" @click.stop="MoveFatherItem(gIndex,1)" <i class="iconfont icon-xiayi" style="margin-right:5px;" @click.stop="MoveFatherItem(gIndex,1)"
v-if="gIndex!=DataObj.GroupList.length-1"></i> v-if="gIndex!=DataObj.GroupList.length-1"></i>
<i class="iconfont icon-shanchu2" style="font-size:18px;" @click.stop="removeFather(gItem,gIndex)"></i> <i class="iconfont icon-shanchu2" style="font-size:18px;"
@click.stop="removeFather(gItem,gIndex)"></i>
</div> </div>
</div> </div>
</div> </div>
<ul class="List-ul" v-if="gItem.DetailsList&&gItem.DetailsList.length>0"> <ul class="List-ul" v-if="gItem.DetailsList&&gItem.DetailsList.length>0">
<li class="" style="cursor:pointer;position:relative;" :class="{'checkUl':dIndex==ComCheckIndex&&gIndex==ComOneIndex}" <li class="" style="cursor:pointer;position:relative;"
:class="{'checkUl':dIndex==ComCheckIndex&&gIndex==ComOneIndex}"
v-for="(dItem,dIndex) in gItem.DetailsList" :key="dIndex" @click="ClickItem(dItem,gIndex,dIndex)"> 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> ({{dIndex+1}}) <span class="exam_DetailList" v-html="dItem.ShowTitle"></span>
<span style="position:absolute;right:5px;"> <span style="position:absolute;right:5px;">
<el-tag type="warning" size="mini" style="margin-right:5px;" <el-tag type="warning" size="mini" style="margin-right:5px;"
v-if="getRepeat(dItem.QuestionId,gItem.DetailsList)&&dIndex+1!=getIndex(dItem.QuestionId,gItem.DetailsList)">与{{gIndex+1}}.{{getIndex(dItem.QuestionId,gItem.DetailsList)}}重复出现</el-tag> v-if="getRepeat(dItem.QuestionId,gItem.DetailsList)&&dIndex+1!=getIndex(dItem.QuestionId,gItem.DetailsList)">
与{{gIndex+1}}.{{getIndex(dItem.QuestionId,gItem.DetailsList)}}重复出现</el-tag>
<span class="exam_ListSHow"> <span class="exam_ListSHow">
<i class="iconfont icon-shangyi2" @click.stop="MoveChildItem(gIndex,dIndex,0)" <i class="iconfont icon-shangyi2" @click.stop="MoveChildItem(gIndex,dIndex,0)"
style="margin-right:5px;" v-if="dIndex!=0"></i> style="margin-right:5px;" v-if="dIndex!=0"></i>
<i class="iconfont icon-xiayi" style="margin-right:5px;" @click.stop="MoveChildItem(gIndex,dIndex,1)" <i class="iconfont icon-xiayi" style="margin-right:5px;"
v-if="dIndex!=gItem.DetailsList.length-1"></i> @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)" <i class="iconfont icon-shanchu2" @click.stop="delExam(gItem.DetailsList,dItem,dIndex)"
style="font-size:17px;"></i> style="font-size:17px;"></i>
</span> </span>
...@@ -477,6 +489,15 @@ ...@@ -477,6 +489,15 @@
} from '../../api/teacher/index'; } from '../../api/teacher/index';
import { import {
CreateQuestion, //生成问题 CreateQuestion, //生成问题
chooseValidate, //【单选题、多选题、数字选择题】验证
fillInValidate, //【填空题、分录题、资料题】验证
judgeValidate, //【判断题】验证
shortanswerValidate, //【简答题、名词解释、论述题、计算题、其它题】验证
matchingValidate, //【连线题】验证
sortingproblemValidate, //【排序题】验证
clozeValidate, //【完型填空】验证
readingcomprehensioValidate, //【阅读理解、听力题】验证
sharingchooseValidate, //【公用选项题】验证
} from '../../api/question/questionconfig' } from '../../api/question/questionconfig'
import { import {
queryQuestionTypeList, queryQuestionTypeList,
...@@ -957,8 +978,6 @@ ...@@ -957,8 +978,6 @@
path: '/exam/examPaper', path: '/exam/examPaper',
query: {} query: {}
}); });
// this.ChooseItem = null;
// this.GetPaperInfo();
} else { } else {
this.$q.notify({ this.$q.notify({
type: 'negative', type: 'negative',
...@@ -985,79 +1004,79 @@ ...@@ -985,79 +1004,79 @@
switch (newKey) { switch (newKey) {
//单选题 //单选题
case "single": case "single":
retMessage = this.chooseValidate(gName, detailsList); retMessage = chooseValidate(gName, detailsList);
break; break;
//多选题 //多选题
case 'multiple': case 'multiple':
retMessage = this.chooseValidate(gName, detailsList); retMessage = chooseValidate(gName, detailsList);
break; break;
//填空题 //填空题
case "fill-in": case "fill-in":
retMessage = this.fillInValidate(gName, detailsList); retMessage = fillInValidate(gName, detailsList);
break; break;
//判断题 //判断题
case "judge": case "judge":
retMessage = this.judgeValidate(gName, detailsList); retMessage = judgeValidate(gName, detailsList);
break; break;
//简答题 //简答题
case "short-answer": case "short-answer":
retMessage = this.shortanswerValidate(gName, detailsList); retMessage = shortanswerValidate(gName, detailsList);
break; break;
//名词解释 //名词解释
case "noun-explanation": case "noun-explanation":
retMessage = this.shortanswerValidate(gName, detailsList); retMessage = shortanswerValidate(gName, detailsList);
break; break;
//论述题 //论述题
case "essay-question": case "essay-question":
retMessage = this.shortanswerValidate(gName, detailsList); retMessage = shortanswerValidate(gName, detailsList);
break; break;
//计算题 //计算题
case "calculation": case "calculation":
retMessage = this.shortanswerValidate(gName, detailsList); retMessage = shortanswerValidate(gName, detailsList);
break; break;
//分录题 //分录题
case "entry-problem": case "entry-problem":
retMessage = this.fillInValidate(gName, detailsList); retMessage = fillInValidate(gName, detailsList);
break; break;
//资料题 //资料题
case "data-question": case "data-question":
retMessage = this.fillInValidate(gName, detailsList); retMessage = fillInValidate(gName, detailsList);
break; break;
//连线题 //连线题
case "matching": case "matching":
retMessage = this.matchingValidate(gName, detailsList); retMessage = matchingValidate(gName, detailsList);
break; break;
//排序题 //排序题
case "sorting-problem": case "sorting-problem":
retMessage = this.sortingproblemValidate(gName, detailsList); retMessage = sortingproblemValidate(gName, detailsList);
break; break;
//完型填空 //完型填空
case "cloze": case "cloze":
retMessage = this.clozeValidate(gName, detailsList); retMessage = clozeValidate(gName, detailsList);
break; break;
//阅读理解 //阅读理解
case "reading-comprehensio": case "reading-comprehensio":
retMessage = this.readingcomprehensioValidate(gName, detailsList); retMessage = readingcomprehensioValidate(gName, detailsList);
break; break;
//口语题 //口语题
case "spoken": case "spoken":
retMessage = this.shortanswerValidate(gName, detailsList); retMessage = shortanswerValidate(gName, detailsList);
break; break;
//听力题 //听力题
case "listening": case "listening":
retMessage = this.readingcomprehensioValidate(gName, detailsList); retMessage = readingcomprehensioValidate(gName, detailsList);
break; break;
//公用选项题 //公用选项题
case "sharing-choose": case "sharing-choose":
retMessage = this.sharingchooseValidate(gName, detailsList); retMessage = sharingchooseValidate(gName, detailsList);
break; break;
//其它题 //其它题
case "other": case "other":
retMessage = this.shortanswerValidate(gName, detailsList); retMessage = shortanswerValidate(gName, detailsList);
break; break;
//单选题-数字 //单选题-数字
case "single-number": case "single-number":
retMessage = this.chooseValidate(gName, detailsList); retMessage = chooseValidate(gName, detailsList);
break; break;
} }
if (retMessage != '') { if (retMessage != '') {
...@@ -1073,235 +1092,6 @@ ...@@ -1073,235 +1092,6 @@
} }
return result; return result;
}, },
//【单选题、多选题、数字选择题】验证
chooseValidate(gName, detailsList) {
var message = "";
//单选题 多选题
if (detailsList && detailsList.length > 0) {
for (let i = 0; i < detailsList.length; i++) {
var Num = 0;
if (detailsList[i].Title == '') {
message = `请填写【${gName}】第 ${i+1} 题 问题内容!`;
return message;
}
for (let j = 0; j < detailsList[i].QuestionContentObj.length; j++) {
if (detailsList[i].QuestionContentObj[j].Content == '') {
message = `请填写【${gName}】第 ${i+1} 题,选项 ${detailsList[i].QuestionContentObj[j].Name} 内容!`;
return message;
}
if (detailsList[i].QuestionContentObj[j].IsAnswer) {
Num++
}
}
if (Num == 0) {
message = `请设置【${gName}】第 ${i+1} 题 正确答案!`;
return message;
}
}
}
return message;
},
//【填空题、分录题、资料题】验证
fillInValidate(gName, detailsList) {
var message = "";
for (let i = 0; i < detailsList.length; i++) {
if (detailsList[i].Title == '') {
message = `请填写【${gName}】第 ${i+1} 题 问题内容!`;
return message;
}
for (let j = 0; j < detailsList[i].QuestionContentObj.length; j++) {
if (detailsList[i].QuestionContentObj[j].Content == '') {
message = `请填写【${gName}】第 ${i+1} 题,第 ${j+1} 空 答案!`;
return message;
}
}
}
return message;
},
//【判断题】验证
judgeValidate(gName, detailsList) {
var message = "";
for (let i = 0; i < detailsList.length; i++) {
if (detailsList[i].Title == '') {
message = `请填写【${gName}】第 ${i+1} 题 问题内容!`;
return message;
}
}
return message;
},
//【简答题、名词解释、论述题、计算题、其它题】验证
shortanswerValidate(gName, detailsList) {
var message = "";
for (let i = 0; i < detailsList.length; i++) {
if (detailsList[i].Title == '') {
message = `请填写【${gName}】第 ${i+1} 题 问题内容!`;
return message;
}
if (detailsList[i].Answer == '') {
message = `请填写【${gName}】第 ${i+1} 题 问题答案!`;
return message;
}
}
return message;
},
//【连线题】验证
matchingValidate(gName, detailsList) {
var message = "";
for (let i = 0; i < detailsList.length; i++) {
if (detailsList[i].Title == '') {
message = `请填写【${gName}】第 ${i+1} 题 问题内容!`;
return message;
}
if (detailsList[i].QuestionContentObj.length > 0) {
for (let p = 0; p < detailsList[i].QuestionContentObj[0].length; p++) {
if (detailsList[i].QuestionContentObj[0][p].Content == '') {
message = `请填写【${gName}】第 ${i+1} 题 第一组 选项 ${detailsList[i].QuestionContentObj[0][p].Name} 内容!`
return message;
}
}
}
if (detailsList[i].QuestionContentObj.length > 0) {
for (let p = 0; p < detailsList[i].QuestionContentObj[1].length; p++) {
if (detailsList[i].QuestionContentObj[1][p].Content == '') {
message = `请填写【${gName}】第 ${i+1} 题 第二组 选项 ${detailsList[i].QuestionContentObj[1][p].Name} 内容!`
return message;
}
}
}
}
return message;
},
//【排序题】验证
sortingproblemValidate(gName, detailsList) {
var message = "";
if (detailsList && detailsList.length > 0) {
for (let i = 0; i < detailsList.length; i++) {
if (detailsList[i].Title == '') {
message = `请填写【${gName}】第 ${i+1} 题 问题内容!`;
return message;
}
for (let j = 0; j < detailsList[i].QuestionContentObj[0].length; j++) {
if (detailsList[i].QuestionContentObj[0][j].Content == '') {
message = `请填写【${gName}】第 ${i+1} 题 选项 ${detailsList[i].QuestionContentObj[0][j].Name} 内容!`
return message;
}
}
}
}
return message;
},
//【完型填空】验证
clozeValidate(gName, detailsList) {
var message = "";
if (detailsList && detailsList.length > 0) {
for (let i = 0; i < detailsList.length; i++) {
if (detailsList[i].Title == '') {
message = `请填写【${gName}】第 ${i+1} 题 问题内容!`;
return message;
}
for (let j = 0; j < detailsList[i].QuestionContentObj.length; j++) {
var Num = 0;
for (var k = 0; k < detailsList[i].QuestionContentObj[j].length; k++) {
if (detailsList[i].QuestionContentObj[j][k].Content == '') {
message =
`请填写【${gName}】第 ${i+1} 题,第 ${j+1} 小题 选项 ${detailsList[i].QuestionContentObj[j][k].Name} 内容!`;
return message;
}
if (detailsList[i].QuestionContentObj[j][k].IsAnswer) {
Num++
}
}
if (Num == 0) {
message = `请设置【${gName}】第 ${i+1} 题,第 ${j+1} 小题 正确答案!`;
return message;
}
}
}
}
return message;
},
//【阅读理解、听力题】验证
readingcomprehensioValidate(gName, detailsList) {
var message = "";
if (detailsList && detailsList.length > 0) {
for (let i = 0; i < detailsList.length; i++) {
if (detailsList[i].Title == '') {
message = `请填写【${gName}】第 ${i+1} 题 问题内容!`;
return message;
}
for (let j = 0; j < detailsList[i].QuestionContentObj.length; j++) {
var subQuestion = detailsList[i].QuestionContentObj[j];
if (subQuestion) {
if (subQuestion.SubTitle == '') {
message = `请填写【${gName}】第 ${i+1} 题,第 ${j+1} 小题 问题内容!`;
return message;
}
//单选题、多选题
if (subQuestion.QuestionKey == 'single' || subQuestion.QuestionKey == "multiple") {
var singleNum = 0;
for (var k = 0; k < subQuestion.SubAnwser.length; k++) {
if (subQuestion.SubAnwser[k].Content == '') {
message = `请填写【${gName}】第 ${i+1} 题,第 ${j+1} 小题 选项 ${subQuestion.SubAnwser[k].Name} 内容!`;
return message;
}
if (subQuestion.SubAnwser[k].IsAnswer) {
singleNum++
}
}
if (singleNum == 0) {
message = `请设置【${gName}】第 ${i+1} 题,第 ${j+1} 小题 正确答案!`;
return message;
}
}
//填空题
if (subQuestion.QuestionKey == "fill-in") {
for (var k = 0; k < subQuestion.SubAnwser.length; k++) {
if (subQuestion.SubAnwser[k].Content == '') {
message = `请填写【${gName}】第 ${i+1} 题,第 ${j+1} 小题 第 ${k+1} 空答案!`;
return message;
}
}
}
//简答题
if (subQuestion.QuestionKey == "short-answer") {
for (var k = 0; k < subQuestion.SubAnwser.length; k++) {
if (subQuestion.SubAnwser[k].Content == '') {
message = `请填写【${gName}】第 ${i+1} 题,第 ${j+1} 小题答案!`;
return message;
}
}
}
}
}
}
}
return message;
},
//【公用选项题】验证
sharingchooseValidate(gName, detailsList) {
var message = "";
if (detailsList && detailsList.length > 0) {
for (var i = 0; i < detailsList.length; i++) {
for (var j = 0; j < detailsList[i].QuestionContentObj[0].length; j++) {
if (detailsList[i].QuestionContentObj[0][j].Content == '') {
message = `请填写【${gName}】第 ${i+1} 题 第一组 选项 ${detailsList[i].QuestionContentObj[0][j].Name} 内容!`;
return message;
}
}
for (var j = 0; j < detailsList[i].QuestionContentObj[1].length; j++) {
if (detailsList[i].QuestionContentObj[1][j].Content == '') {
message = `请填写【${gName}】第 ${i+1} 题 第二组 题干 ${j+1} 内容!`;
return message;
}
if (detailsList[i].QuestionContentObj[1][j].Name == '') {
message = `请选择【${gName}】第 ${i+1} 题 第二组 题干 ${j+1} 答案!`;
return message;
}
}
}
}
return message;
},
//关闭弹窗 //关闭弹窗
closeQuestForm() { closeQuestForm() {
this.isShowQuestion = false; this.isShowQuestion = false;
...@@ -1342,20 +1132,20 @@ ...@@ -1342,20 +1132,20 @@
this.isShowQuestion = false; this.isShowQuestion = false;
}, },
//获取相同 //获取相同
getRepeat(QuestionId,Arr){ getRepeat(QuestionId, Arr) {
let Num=0; let Num = 0;
Arr.forEach((x,index)=>{ Arr.forEach((x, index) => {
if (x.QuestionId == QuestionId) { if (x.QuestionId == QuestionId) {
Num++; Num++;
} }
}) })
if(Num>1){ if (Num > 1) {
return true return true
} }
}, },
getIndex(Id,Arr){ getIndex(Id, Arr) {
const index = Arr.findIndex(d => d.QuestionId === Id); const index = Arr.findIndex(d => d.QuestionId === Id);
return index+1; return index + 1;
} }
} }
} }
......
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