Commit 11a4e518b1adff87db4f4dba17217117b20bbaee
1 parent
5ab73359
背题组卷修改答案设置,即使测随堂问缓存问题
Showing
7 changed files
with
127 additions
and
12 deletions
src/components/setAnswer.vue
... | ... | @@ -86,7 +86,7 @@ |
86 | 86 | width="400" |
87 | 87 | :modal-append-to-body="false" |
88 | 88 | > |
89 | - <div class="qs-options"> | |
89 | + <div class="qs-options set-questions"> | |
90 | 90 | <p>{{ setSubPro(formAns.qusType) }}:</p> |
91 | 91 | <p class="ipt"> |
92 | 92 | <el-input |
... | ... | @@ -158,6 +158,7 @@ |
158 | 158 | @click="formAns.answerList = formAns.answerList.slice(0, -1)" |
159 | 159 | >x</span |
160 | 160 | > |
161 | + <span class="answer-s ac" @click="formAns.answerList = ''">ac</span> | |
161 | 162 | </p> |
162 | 163 | </div> |
163 | 164 | <div class="dialog-footer" slot="footer"> |
... | ... | @@ -262,6 +263,20 @@ export default { |
262 | 263 | setFormAns(indexs) { |
263 | 264 | //初始化要修改的答案 |
264 | 265 | this.formAns = { ...this.FormQuestionList[indexs] }; |
266 | + let answerList = ""; | |
267 | + this.FormQuestionList[index].map((item, subIdx) => { | |
268 | + answerList += this.setAnswer(item.questionType, item.correctAnswer); | |
269 | + if (subIdx != indexs) { | |
270 | + if (!!item.qusType) { | |
271 | + answerList = ""; | |
272 | + } | |
273 | + } else { | |
274 | + if (item.qusType == 3) { | |
275 | + answerList = answerList.slice(0, -1); | |
276 | + } | |
277 | + this.formAns.answerList = answerList; | |
278 | + } | |
279 | + }); | |
265 | 280 | this.diaSetAns = true; |
266 | 281 | }, |
267 | 282 | saveFormAns() { | ... | ... |
src/store/index.js
src/utils/index.js
... | ... | @@ -454,7 +454,7 @@ export function checkAnswer( |
454 | 454 | //单选 |
455 | 455 | console.log(s.length + " " + questionCount); |
456 | 456 | if (s.length > questionCount) { |
457 | - s = s.substring(0, questionCount+1); | |
457 | + s = s.substring(0, questionCount); | |
458 | 458 | } |
459 | 459 | } else if (questionType == 3) { |
460 | 460 | //多选 | ... | ... |
src/views/examinationPaper/add.vue
... | ... | @@ -115,7 +115,11 @@ |
115 | 115 | <p class="add-type" v-for="item in tagList" :key="item.id"> |
116 | 116 | <el-row :gutter="10"> |
117 | 117 | <el-col :span="18" |
118 | - ><el-input v-model="item.typeName" :maxlength="10" placeholder="请输入答题卡类型名称"></el-input | |
118 | + ><el-input | |
119 | + v-model="item.typeName" | |
120 | + :maxlength="10" | |
121 | + placeholder="请输入答题卡类型名称" | |
122 | + ></el-input | |
119 | 123 | ></el-col> |
120 | 124 | <el-col :span="6"> |
121 | 125 | <el-tooltip effect="dark" content="保存" placement="top"> |
... | ... | @@ -639,6 +643,9 @@ |
639 | 643 | @click="formAns.answerList = formAns.answerList.slice(0, -1)" |
640 | 644 | >x</span |
641 | 645 | > |
646 | + <span class="answer-s ac" @click="formAns.answerList = ''" | |
647 | + >ac</span | |
648 | + > | |
642 | 649 | </p> |
643 | 650 | </div> |
644 | 651 | <div class="dialog-footer" slot="footer"> |
... | ... | @@ -875,6 +882,22 @@ export default { |
875 | 882 | //初始化要修改的答案 |
876 | 883 | this.formAns = { ...this.form.questionList[index].subQuestions[indexs] }; |
877 | 884 | this.formAns.listIndex = index; |
885 | + this.formAns.answerList = []; | |
886 | + let answerList = ""; | |
887 | + this.form.questionList[index].subQuestions.map((item, subIdx) => { | |
888 | + answerList += this.setAnswer(item.questionType, item.correctAnswer); | |
889 | + if (subIdx != indexs) { | |
890 | + if (!!item.qusType) { | |
891 | + answerList = ""; | |
892 | + } | |
893 | + } else { | |
894 | + if (item.qusType == 3) { | |
895 | + answerList = answerList.slice(0, -1); | |
896 | + } | |
897 | + this.formAns.answerList = answerList; | |
898 | + } | |
899 | + }); | |
900 | + | |
878 | 901 | this.diaSetAns = true; |
879 | 902 | }, |
880 | 903 | setMultiple(obj, answer) { |
... | ... | @@ -1457,10 +1480,13 @@ export default { |
1457 | 1480 | background-size: 19px; |
1458 | 1481 | color: transparent; |
1459 | 1482 | } |
1483 | + .answer-s.ac{ | |
1484 | + border:none; | |
1485 | + } | |
1460 | 1486 | .ac { |
1461 | 1487 | border-color: #ff6868; |
1462 | 1488 | background: #ff6868; |
1463 | - color: #fff; | |
1489 | + color: #fff!important; | |
1464 | 1490 | } |
1465 | 1491 | } |
1466 | 1492 | ... | ... |
src/views/examinationPaper/edit.vue
... | ... | @@ -227,7 +227,7 @@ |
227 | 227 | width="400" |
228 | 228 | :modal-append-to-body="false" |
229 | 229 | > |
230 | - <div class="qs-options"> | |
230 | + <div class="qs-options set-questions"> | |
231 | 231 | <p class="dia-tips"> |
232 | 232 | 请点击选项按钮设置答案,多选题题目之间用“,”隔开,若添加5道题:“AC,AD,BD,AC,CD” |
233 | 233 | </p> |
... | ... | @@ -302,6 +302,7 @@ |
302 | 302 | @click="formAns.answerList = formAns.answerList.slice(0, -1)" |
303 | 303 | >x</span |
304 | 304 | > |
305 | + <span class="answer-s ac" @click="formAns.answerList = ''">ac</span> | |
305 | 306 | </p> |
306 | 307 | </div> |
307 | 308 | <div class="dialog-footer" slot="footer"> |
... | ... | @@ -492,9 +493,37 @@ export default { |
492 | 493 | if (this.questionList[0].subQuestions) { |
493 | 494 | this.formAns = { ...this.questionList[index].subQuestions[indexs] }; |
494 | 495 | this.formAns.listIndex = index; |
496 | + let answerList = ""; | |
497 | + this.questionList[index].subQuestions.map((item, subIdx) => { | |
498 | + answerList += this.setAnswer(item.questionType, item.correctAnswer); | |
499 | + if (subIdx != indexs) { | |
500 | + if (!!item.qusType) { | |
501 | + answerList = ""; | |
502 | + } | |
503 | + } else { | |
504 | + if (item.qusType == 3) { | |
505 | + answerList = answerList.slice(0, -1); | |
506 | + } | |
507 | + this.formAns.answerList = answerList; | |
508 | + } | |
509 | + }); | |
495 | 510 | } else { |
496 | 511 | this.formAns = { ...this.questionList[indexs] }; |
497 | 512 | this.formAns.listIndex = indexs; |
513 | + let answerList = ""; | |
514 | + this.questionList[index].map((item, subIdx) => { | |
515 | + answerList += this.setAnswer(item.questionType, item.correctAnswer); | |
516 | + if (subIdx != indexs) { | |
517 | + if (!!item.qusType) { | |
518 | + answerList = ""; | |
519 | + } | |
520 | + } else { | |
521 | + if (item.qusType == 3) { | |
522 | + answerList = answerList.slice(0, -1); | |
523 | + } | |
524 | + this.formAns.answerList = answerList; | |
525 | + } | |
526 | + }); | |
498 | 527 | } |
499 | 528 | this.diaSetAns = true; |
500 | 529 | }, |
... | ... | @@ -819,9 +848,9 @@ export default { |
819 | 848 | text-align: left; |
820 | 849 | justify-content: flex-start; |
821 | 850 | padding-left: 20px; |
822 | - .answer-s { | |
823 | - cursor: pointer; | |
824 | - } | |
851 | + } | |
852 | + .answer-s { | |
853 | + cursor: pointer; | |
825 | 854 | } |
826 | 855 | :deep(.el-select) { |
827 | 856 | .el-input__inner { |
... | ... | @@ -837,4 +866,15 @@ export default { |
837 | 866 | } |
838 | 867 | } |
839 | 868 | } |
869 | +.set-questions { | |
870 | + .answer-box { | |
871 | + .answer-s { | |
872 | + cursor: pointer; | |
873 | + user-select: none; | |
874 | + &:first-of-type { | |
875 | + margin-left: 0; | |
876 | + } | |
877 | + } | |
878 | + } | |
879 | +} | |
840 | 880 | </style> |
841 | 881 | \ No newline at end of file | ... | ... |
src/views/test/analysis.vue
... | ... | @@ -297,7 +297,7 @@ |
297 | 297 | align="center" |
298 | 298 | v-for="(item, index) in questionList" |
299 | 299 | :key="index" |
300 | - :label="'题目' + item.id" | |
300 | + :label="'Q' + item.id" | |
301 | 301 | :prop="'score' + item.id" |
302 | 302 | > |
303 | 303 | </el-table-column> |
... | ... | @@ -337,7 +337,7 @@ |
337 | 337 | align="center" |
338 | 338 | v-for="(item, index) in questionList" |
339 | 339 | :key="index" |
340 | - :label="'题目' + item.id" | |
340 | + :label="'Q' + item.id" | |
341 | 341 | > |
342 | 342 | <template slot-scope="scope"> |
343 | 343 | <span | ... | ... |
src/views/test/editAnswer.vue
... | ... | @@ -128,7 +128,7 @@ |
128 | 128 | subQuestions.subNum > 4 |
129 | 129 | " |
130 | 130 | > |
131 | - <el-button type="primary" @click="setFormAns(indexs, index)" | |
131 | + <el-button type="primary" @click="setFormAns(indexs)" | |
132 | 132 | >批量设置答案</el-button |
133 | 133 | > |
134 | 134 | </p> |
... | ... | @@ -288,6 +288,11 @@ |
288 | 288 | @click="formAns.answerList = formAns.answerList.slice(0, -1)" |
289 | 289 | >x</span |
290 | 290 | > |
291 | + <span | |
292 | + class="answer-s ac" | |
293 | + @click="formAns.answerList = ''" | |
294 | + >ac</span | |
295 | + > | |
291 | 296 | </p> |
292 | 297 | </div> |
293 | 298 | <div class="dialog-footer" slot="footer"> |
... | ... | @@ -477,14 +482,42 @@ export default { |
477 | 482 | sub.correctAnswer = arrs.sort().join(""); |
478 | 483 | } |
479 | 484 | }, |
480 | - setFormAns(indexs, index) { | |
485 | + setFormAns(indexs, index) { | |
481 | 486 | //初始化要修改的答案 |
482 | 487 | if (this.questionList[0].subQuestions) { |
483 | 488 | this.formAns = { ...this.questionList[index].subQuestions[indexs] }; |
484 | 489 | this.formAns.listIndex = index; |
490 | + let answerList = ""; | |
491 | + this.questionList[index].subQuestions.map((item, subIdx) => { | |
492 | + answerList += this.setAnswer(item.questionType, item.correctAnswer); | |
493 | + if (subIdx != indexs) { | |
494 | + if (!!item.qusType) { | |
495 | + answerList = ""; | |
496 | + } | |
497 | + } else { | |
498 | + if (item.qusType == 3) { | |
499 | + answerList = answerList.slice(0, -1); | |
500 | + } | |
501 | + this.formAns.answerList = answerList; | |
502 | + } | |
503 | + }); | |
485 | 504 | } else { |
486 | 505 | this.formAns = { ...this.questionList[indexs] }; |
487 | 506 | this.formAns.listIndex = indexs; |
507 | + let answerList = ""; | |
508 | + this.questionList[index].map((item, subIdx) => { | |
509 | + answerList += this.setAnswer(item.questionType, item.correctAnswer); | |
510 | + if (subIdx != indexs) { | |
511 | + if (!!item.qusType) { | |
512 | + answerList = ""; | |
513 | + } | |
514 | + } else { | |
515 | + if (item.qusType == 3) { | |
516 | + answerList = answerList.slice(0, -1); | |
517 | + } | |
518 | + this.formAns.answerList = answerList; | |
519 | + } | |
520 | + }); | |
488 | 521 | } |
489 | 522 | this.diaSetAns = true; |
490 | 523 | }, | ... | ... |