Commit 98f6a547200a840b52df71bdd96995dd04e59b9f
1 parent
575eb544
创建答题卡,统计答题信息
Showing
1 changed file
with
43 additions
and
9 deletions
src/views/examinationPaper/add.vue
... | ... | @@ -222,8 +222,15 @@ |
222 | 222 | icon="el-icon-delete" |
223 | 223 | ></el-button> |
224 | 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 | 232 | <span class="m20">共:{{ question.subQuestions.length }}题</span> |
226 | - <span>共:{{ setScore(question) }}分</span> | |
233 | + <span class="m20">共:{{ setScore(question) }}分</span> | |
227 | 234 | </p> |
228 | 235 | <transition name="el-zoom-in-top"> |
229 | 236 | <ul v-show="question.show" class="questions-ul"> |
... | ... | @@ -321,7 +328,13 @@ |
321 | 328 | >{{ option }}</span |
322 | 329 | > |
323 | 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 | 338 | <el-button |
326 | 339 | size="mini" |
327 | 340 | type="primary" |
... | ... | @@ -613,7 +626,7 @@ |
613 | 626 | <span>{{ setBigNum(index) }}、</span> |
614 | 627 | <span class="title-txt">{{ question.questionTitle }}</span> |
615 | 628 | <span class="m20">共:{{ setNums(question.subQuestions) }}题</span> |
616 | - <span>共:{{ setScore(question) }} 分</span> | |
629 | + <span class="m20">共:{{ setScore(question) }} 分</span> | |
617 | 630 | </p> |
618 | 631 | <ul class="questions-ul"> |
619 | 632 | <li class="sub-questions"> |
... | ... | @@ -921,7 +934,7 @@ export default { |
921 | 934 | formAns: { |
922 | 935 | listIndex: 0, //大题位置 |
923 | 936 | endIndex: 0, //相同题目最后一位题目的questionIndex |
924 | - index:0,//相同题目最后一位题目的位置 | |
937 | + index: 0, //相同题目最后一位题目的位置 | |
925 | 938 | qusType: "", //题目类型 |
926 | 939 | subNum: 0, //数量 |
927 | 940 | answerOptions: [], //答案选项 |
... | ... | @@ -1059,7 +1072,7 @@ export default { |
1059 | 1072 | //初始化要修改的答案 |
1060 | 1073 | this.formAns = { ...this.form.questionList[index].subQuestions[indexs] }; |
1061 | 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 | 1076 | this.formAns.answerList = []; |
1064 | 1077 | let answerList = ""; |
1065 | 1078 | this.form.questionList[index].subQuestions.map((item, subIdx) => { |
... | ... | @@ -1283,7 +1296,10 @@ export default { |
1283 | 1296 | let addndex = 0; |
1284 | 1297 | item.subQuestions.map((sub, index) => { |
1285 | 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 | 1303 | //同类型批量答案+1 |
1288 | 1304 | types[addndex].subNum += 1; |
1289 | 1305 | if ( |
... | ... | @@ -1427,6 +1443,21 @@ export default { |
1427 | 1443 | }, 0); |
1428 | 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 | 1461 | changeAddSubQuestions(val, question) { |
1431 | 1462 | if (val) { |
1432 | 1463 | let questionsOptions = { |
... | ... | @@ -1501,7 +1532,10 @@ export default { |
1501 | 1532 | subQuestions.answerOptions = this.rightOptions |
1502 | 1533 | .slice(0, subQuestions.selectNum) |
1503 | 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 | 1540 | changAnswer(sub, option) { |
1507 | 1541 | //设置多选答案 |
... | ... | @@ -1691,7 +1725,7 @@ export default { |
1691 | 1725 | return { |
1692 | 1726 | questionTitle: item.questionTitle, |
1693 | 1727 | subQuestions: subQuestions, |
1694 | - show:false | |
1728 | + show: false, | |
1695 | 1729 | }; |
1696 | 1730 | }); |
1697 | 1731 | } else { |
... | ... | @@ -1829,7 +1863,7 @@ export default { |
1829 | 1863 | align-items: center; |
1830 | 1864 | margin-bottom: 12px; |
1831 | 1865 | .m20 { |
1832 | - margin: 0 20px; | |
1866 | + margin-left: 20px; | |
1833 | 1867 | } |
1834 | 1868 | .ipt { |
1835 | 1869 | width: 300px; | ... | ... |