Commit 98f6a547200a840b52df71bdd96995dd04e59b9f

Authored by 梁保满
1 parent 575eb544

创建答题卡,统计答题信息

src/views/examinationPaper/add.vue
@@ -222,8 +222,15 @@ @@ -222,8 +222,15 @@
222 icon="el-icon-delete" 222 icon="el-icon-delete"
223 ></el-button> 223 ></el-button>
224 </el-popconfirm> 224 </el-popconfirm>
  225 + <template v-if="equalScore(question)">
  226 + <span class="m20"
  227 + >每题{{
  228 + question.subQuestions && question.subQuestions[0].score
  229 + }}分</span
  230 + >
  231 + </template>
225 <span class="m20">共:{{ question.subQuestions.length }}题</span> 232 <span class="m20">共:{{ question.subQuestions.length }}题</span>
226 - <span>共:{{ setScore(question) }}分</span> 233 + <span class="m20">共:{{ setScore(question) }}分</span>
227 </p> 234 </p>
228 <transition name="el-zoom-in-top"> 235 <transition name="el-zoom-in-top">
229 <ul v-show="question.show" class="questions-ul"> 236 <ul v-show="question.show" class="questions-ul">
@@ -321,7 +328,13 @@ @@ -321,7 +328,13 @@
321 >{{ option }}</span 328 >{{ option }}</span
322 > 329 >
323 </p> 330 </p>
324 - <p v-if="subQuestions.questionType == 3||subQuestions.questionType == 2" class="answer-box"> 331 + <p
  332 + v-if="
  333 + subQuestions.questionType == 3 ||
  334 + subQuestions.questionType == 2
  335 + "
  336 + class="answer-box"
  337 + >
325 <el-button 338 <el-button
326 size="mini" 339 size="mini"
327 type="primary" 340 type="primary"
@@ -613,7 +626,7 @@ @@ -613,7 +626,7 @@
613 <span>{{ setBigNum(index) }}、</span> 626 <span>{{ setBigNum(index) }}、</span>
614 <span class="title-txt">{{ question.questionTitle }}</span> 627 <span class="title-txt">{{ question.questionTitle }}</span>
615 <span class="m20">共:{{ setNums(question.subQuestions) }}题</span> 628 <span class="m20">共:{{ setNums(question.subQuestions) }}题</span>
616 - <span>共:{{ setScore(question) }} 分</span> 629 + <span class="m20">共:{{ setScore(question) }} 分</span>
617 </p> 630 </p>
618 <ul class="questions-ul"> 631 <ul class="questions-ul">
619 <li class="sub-questions"> 632 <li class="sub-questions">
@@ -921,7 +934,7 @@ export default { @@ -921,7 +934,7 @@ export default {
921 formAns: { 934 formAns: {
922 listIndex: 0, //大题位置 935 listIndex: 0, //大题位置
923 endIndex: 0, //相同题目最后一位题目的questionIndex 936 endIndex: 0, //相同题目最后一位题目的questionIndex
924 - index:0,//相同题目最后一位题目的位置 937 + index: 0, //相同题目最后一位题目的位置
925 qusType: "", //题目类型 938 qusType: "", //题目类型
926 subNum: 0, //数量 939 subNum: 0, //数量
927 answerOptions: [], //答案选项 940 answerOptions: [], //答案选项
@@ -1059,7 +1072,7 @@ export default { @@ -1059,7 +1072,7 @@ export default {
1059 //初始化要修改的答案 1072 //初始化要修改的答案
1060 this.formAns = { ...this.form.questionList[index].subQuestions[indexs] }; 1073 this.formAns = { ...this.form.questionList[index].subQuestions[indexs] };
1061 this.formAns.listIndex = index; 1074 this.formAns.listIndex = index;
1062 - let startIndex = (this.formAns.index+1) - this.formAns.subNum;//批量设置大难开始位置 1075 + let startIndex = this.formAns.index + 1 - this.formAns.subNum; //批量设置大难开始位置
1063 this.formAns.answerList = []; 1076 this.formAns.answerList = [];
1064 let answerList = ""; 1077 let answerList = "";
1065 this.form.questionList[index].subQuestions.map((item, subIdx) => { 1078 this.form.questionList[index].subQuestions.map((item, subIdx) => {
@@ -1283,7 +1296,10 @@ export default { @@ -1283,7 +1296,10 @@ export default {
1283 let addndex = 0; 1296 let addndex = 0;
1284 item.subQuestions.map((sub, index) => { 1297 item.subQuestions.map((sub, index) => {
1285 if (!!sub.questionType) { 1298 if (!!sub.questionType) {
1286 - if (sub.questionType == types[addndex].qusType && sub.questionType != 5) { 1299 + if (
  1300 + sub.questionType == types[addndex].qusType &&
  1301 + sub.questionType != 5
  1302 + ) {
1287 //同类型批量答案+1 1303 //同类型批量答案+1
1288 types[addndex].subNum += 1; 1304 types[addndex].subNum += 1;
1289 if ( 1305 if (
@@ -1427,6 +1443,21 @@ export default { @@ -1427,6 +1443,21 @@ export default {
1427 }, 0); 1443 }, 0);
1428 return Number(score).toFixed(2); 1444 return Number(score).toFixed(2);
1429 }, 1445 },
  1446 + equalScore(question) {
  1447 + let score = 0;
  1448 + let bools = true;
  1449 + for (let i = 0; i < question.subQuestions.length; i++) {
  1450 + if (i == 0) {
  1451 + score = question.subQuestions[i].score;
  1452 + } else {
  1453 + if (score != question.subQuestions[i].score) {
  1454 + bools = false;
  1455 + break;
  1456 + }
  1457 + }
  1458 + }
  1459 + return bools;
  1460 + },
1430 changeAddSubQuestions(val, question) { 1461 changeAddSubQuestions(val, question) {
1431 if (val) { 1462 if (val) {
1432 let questionsOptions = { 1463 let questionsOptions = {
@@ -1501,7 +1532,10 @@ export default { @@ -1501,7 +1532,10 @@ export default {
1501 subQuestions.answerOptions = this.rightOptions 1532 subQuestions.answerOptions = this.rightOptions
1502 .slice(0, subQuestions.selectNum) 1533 .slice(0, subQuestions.selectNum)
1503 .join(","); 1534 .join(",");
1504 - subQuestions.correctAnswer = subQuestions.correctAnswer.slice(0, subQuestions.selectNum) 1535 + subQuestions.correctAnswer = subQuestions.correctAnswer.slice(
  1536 + 0,
  1537 + subQuestions.selectNum
  1538 + );
1505 }, 1539 },
1506 changAnswer(sub, option) { 1540 changAnswer(sub, option) {
1507 //设置多选答案 1541 //设置多选答案
@@ -1691,7 +1725,7 @@ export default { @@ -1691,7 +1725,7 @@ export default {
1691 return { 1725 return {
1692 questionTitle: item.questionTitle, 1726 questionTitle: item.questionTitle,
1693 subQuestions: subQuestions, 1727 subQuestions: subQuestions,
1694 - show:false 1728 + show: false,
1695 }; 1729 };
1696 }); 1730 });
1697 } else { 1731 } else {
@@ -1829,7 +1863,7 @@ export default { @@ -1829,7 +1863,7 @@ export default {
1829 align-items: center; 1863 align-items: center;
1830 margin-bottom: 12px; 1864 margin-bottom: 12px;
1831 .m20 { 1865 .m20 {
1832 - margin: 0 20px; 1866 + margin-left: 20px;
1833 } 1867 }
1834 .ipt { 1868 .ipt {
1835 width: 300px; 1869 width: 300px;