Commit 11a4e518b1adff87db4f4dba17217117b20bbaee
1 parent
5ab73359
背题组卷修改答案设置,即使测随堂问缓存问题
Showing
7 changed files
with
127 additions
and
12 deletions
src/components/setAnswer.vue
@@ -86,7 +86,7 @@ | @@ -86,7 +86,7 @@ | ||
86 | width="400" | 86 | width="400" |
87 | :modal-append-to-body="false" | 87 | :modal-append-to-body="false" |
88 | > | 88 | > |
89 | - <div class="qs-options"> | 89 | + <div class="qs-options set-questions"> |
90 | <p>{{ setSubPro(formAns.qusType) }}:</p> | 90 | <p>{{ setSubPro(formAns.qusType) }}:</p> |
91 | <p class="ipt"> | 91 | <p class="ipt"> |
92 | <el-input | 92 | <el-input |
@@ -158,6 +158,7 @@ | @@ -158,6 +158,7 @@ | ||
158 | @click="formAns.answerList = formAns.answerList.slice(0, -1)" | 158 | @click="formAns.answerList = formAns.answerList.slice(0, -1)" |
159 | >x</span | 159 | >x</span |
160 | > | 160 | > |
161 | + <span class="answer-s ac" @click="formAns.answerList = ''">ac</span> | ||
161 | </p> | 162 | </p> |
162 | </div> | 163 | </div> |
163 | <div class="dialog-footer" slot="footer"> | 164 | <div class="dialog-footer" slot="footer"> |
@@ -262,6 +263,20 @@ export default { | @@ -262,6 +263,20 @@ export default { | ||
262 | setFormAns(indexs) { | 263 | setFormAns(indexs) { |
263 | //初始化要修改的答案 | 264 | //初始化要修改的答案 |
264 | this.formAns = { ...this.FormQuestionList[indexs] }; | 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 | this.diaSetAns = true; | 280 | this.diaSetAns = true; |
266 | }, | 281 | }, |
267 | saveFormAns() { | 282 | saveFormAns() { |
src/store/index.js
@@ -170,6 +170,7 @@ const store = new Vuex.Store({ | @@ -170,6 +170,7 @@ const store = new Vuex.Store({ | ||
170 | children: [], | 170 | children: [], |
171 | }); | 171 | }); |
172 | router.push({ path: "/" }); | 172 | router.push({ path: "/" }); |
173 | + window.location.reload() | ||
173 | }, | 174 | }, |
174 | }, | 175 | }, |
175 | getters: { | 176 | getters: { |
src/utils/index.js
@@ -454,7 +454,7 @@ export function checkAnswer( | @@ -454,7 +454,7 @@ export function checkAnswer( | ||
454 | //单选 | 454 | //单选 |
455 | console.log(s.length + " " + questionCount); | 455 | console.log(s.length + " " + questionCount); |
456 | if (s.length > questionCount) { | 456 | if (s.length > questionCount) { |
457 | - s = s.substring(0, questionCount+1); | 457 | + s = s.substring(0, questionCount); |
458 | } | 458 | } |
459 | } else if (questionType == 3) { | 459 | } else if (questionType == 3) { |
460 | //多选 | 460 | //多选 |
src/views/examinationPaper/add.vue
@@ -115,7 +115,11 @@ | @@ -115,7 +115,11 @@ | ||
115 | <p class="add-type" v-for="item in tagList" :key="item.id"> | 115 | <p class="add-type" v-for="item in tagList" :key="item.id"> |
116 | <el-row :gutter="10"> | 116 | <el-row :gutter="10"> |
117 | <el-col :span="18" | 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 | ></el-col> | 123 | ></el-col> |
120 | <el-col :span="6"> | 124 | <el-col :span="6"> |
121 | <el-tooltip effect="dark" content="保存" placement="top"> | 125 | <el-tooltip effect="dark" content="保存" placement="top"> |
@@ -639,6 +643,9 @@ | @@ -639,6 +643,9 @@ | ||
639 | @click="formAns.answerList = formAns.answerList.slice(0, -1)" | 643 | @click="formAns.answerList = formAns.answerList.slice(0, -1)" |
640 | >x</span | 644 | >x</span |
641 | > | 645 | > |
646 | + <span class="answer-s ac" @click="formAns.answerList = ''" | ||
647 | + >ac</span | ||
648 | + > | ||
642 | </p> | 649 | </p> |
643 | </div> | 650 | </div> |
644 | <div class="dialog-footer" slot="footer"> | 651 | <div class="dialog-footer" slot="footer"> |
@@ -875,6 +882,22 @@ export default { | @@ -875,6 +882,22 @@ export default { | ||
875 | //初始化要修改的答案 | 882 | //初始化要修改的答案 |
876 | this.formAns = { ...this.form.questionList[index].subQuestions[indexs] }; | 883 | this.formAns = { ...this.form.questionList[index].subQuestions[indexs] }; |
877 | this.formAns.listIndex = index; | 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 | this.diaSetAns = true; | 901 | this.diaSetAns = true; |
879 | }, | 902 | }, |
880 | setMultiple(obj, answer) { | 903 | setMultiple(obj, answer) { |
@@ -1457,10 +1480,13 @@ export default { | @@ -1457,10 +1480,13 @@ export default { | ||
1457 | background-size: 19px; | 1480 | background-size: 19px; |
1458 | color: transparent; | 1481 | color: transparent; |
1459 | } | 1482 | } |
1483 | + .answer-s.ac{ | ||
1484 | + border:none; | ||
1485 | + } | ||
1460 | .ac { | 1486 | .ac { |
1461 | border-color: #ff6868; | 1487 | border-color: #ff6868; |
1462 | background: #ff6868; | 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,7 +227,7 @@ | ||
227 | width="400" | 227 | width="400" |
228 | :modal-append-to-body="false" | 228 | :modal-append-to-body="false" |
229 | > | 229 | > |
230 | - <div class="qs-options"> | 230 | + <div class="qs-options set-questions"> |
231 | <p class="dia-tips"> | 231 | <p class="dia-tips"> |
232 | 请点击选项按钮设置答案,多选题题目之间用“,”隔开,若添加5道题:“AC,AD,BD,AC,CD” | 232 | 请点击选项按钮设置答案,多选题题目之间用“,”隔开,若添加5道题:“AC,AD,BD,AC,CD” |
233 | </p> | 233 | </p> |
@@ -302,6 +302,7 @@ | @@ -302,6 +302,7 @@ | ||
302 | @click="formAns.answerList = formAns.answerList.slice(0, -1)" | 302 | @click="formAns.answerList = formAns.answerList.slice(0, -1)" |
303 | >x</span | 303 | >x</span |
304 | > | 304 | > |
305 | + <span class="answer-s ac" @click="formAns.answerList = ''">ac</span> | ||
305 | </p> | 306 | </p> |
306 | </div> | 307 | </div> |
307 | <div class="dialog-footer" slot="footer"> | 308 | <div class="dialog-footer" slot="footer"> |
@@ -492,9 +493,37 @@ export default { | @@ -492,9 +493,37 @@ export default { | ||
492 | if (this.questionList[0].subQuestions) { | 493 | if (this.questionList[0].subQuestions) { |
493 | this.formAns = { ...this.questionList[index].subQuestions[indexs] }; | 494 | this.formAns = { ...this.questionList[index].subQuestions[indexs] }; |
494 | this.formAns.listIndex = index; | 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 | } else { | 510 | } else { |
496 | this.formAns = { ...this.questionList[indexs] }; | 511 | this.formAns = { ...this.questionList[indexs] }; |
497 | this.formAns.listIndex = indexs; | 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 | this.diaSetAns = true; | 528 | this.diaSetAns = true; |
500 | }, | 529 | }, |
@@ -819,9 +848,9 @@ export default { | @@ -819,9 +848,9 @@ export default { | ||
819 | text-align: left; | 848 | text-align: left; |
820 | justify-content: flex-start; | 849 | justify-content: flex-start; |
821 | padding-left: 20px; | 850 | padding-left: 20px; |
822 | - .answer-s { | ||
823 | - cursor: pointer; | ||
824 | - } | 851 | + } |
852 | + .answer-s { | ||
853 | + cursor: pointer; | ||
825 | } | 854 | } |
826 | :deep(.el-select) { | 855 | :deep(.el-select) { |
827 | .el-input__inner { | 856 | .el-input__inner { |
@@ -837,4 +866,15 @@ export default { | @@ -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 | </style> | 880 | </style> |
841 | \ No newline at end of file | 881 | \ No newline at end of file |
src/views/test/analysis.vue
@@ -297,7 +297,7 @@ | @@ -297,7 +297,7 @@ | ||
297 | align="center" | 297 | align="center" |
298 | v-for="(item, index) in questionList" | 298 | v-for="(item, index) in questionList" |
299 | :key="index" | 299 | :key="index" |
300 | - :label="'题目' + item.id" | 300 | + :label="'Q' + item.id" |
301 | :prop="'score' + item.id" | 301 | :prop="'score' + item.id" |
302 | > | 302 | > |
303 | </el-table-column> | 303 | </el-table-column> |
@@ -337,7 +337,7 @@ | @@ -337,7 +337,7 @@ | ||
337 | align="center" | 337 | align="center" |
338 | v-for="(item, index) in questionList" | 338 | v-for="(item, index) in questionList" |
339 | :key="index" | 339 | :key="index" |
340 | - :label="'题目' + item.id" | 340 | + :label="'Q' + item.id" |
341 | > | 341 | > |
342 | <template slot-scope="scope"> | 342 | <template slot-scope="scope"> |
343 | <span | 343 | <span |
src/views/test/editAnswer.vue
@@ -128,7 +128,7 @@ | @@ -128,7 +128,7 @@ | ||
128 | subQuestions.subNum > 4 | 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 | >批量设置答案</el-button | 132 | >批量设置答案</el-button |
133 | > | 133 | > |
134 | </p> | 134 | </p> |
@@ -288,6 +288,11 @@ | @@ -288,6 +288,11 @@ | ||
288 | @click="formAns.answerList = formAns.answerList.slice(0, -1)" | 288 | @click="formAns.answerList = formAns.answerList.slice(0, -1)" |
289 | >x</span | 289 | >x</span |
290 | > | 290 | > |
291 | + <span | ||
292 | + class="answer-s ac" | ||
293 | + @click="formAns.answerList = ''" | ||
294 | + >ac</span | ||
295 | + > | ||
291 | </p> | 296 | </p> |
292 | </div> | 297 | </div> |
293 | <div class="dialog-footer" slot="footer"> | 298 | <div class="dialog-footer" slot="footer"> |
@@ -477,14 +482,42 @@ export default { | @@ -477,14 +482,42 @@ export default { | ||
477 | sub.correctAnswer = arrs.sort().join(""); | 482 | sub.correctAnswer = arrs.sort().join(""); |
478 | } | 483 | } |
479 | }, | 484 | }, |
480 | - setFormAns(indexs, index) { | 485 | + setFormAns(indexs, index) { |
481 | //初始化要修改的答案 | 486 | //初始化要修改的答案 |
482 | if (this.questionList[0].subQuestions) { | 487 | if (this.questionList[0].subQuestions) { |
483 | this.formAns = { ...this.questionList[index].subQuestions[indexs] }; | 488 | this.formAns = { ...this.questionList[index].subQuestions[indexs] }; |
484 | this.formAns.listIndex = index; | 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 | } else { | 504 | } else { |
486 | this.formAns = { ...this.questionList[indexs] }; | 505 | this.formAns = { ...this.questionList[indexs] }; |
487 | this.formAns.listIndex = indexs; | 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 | this.diaSetAns = true; | 522 | this.diaSetAns = true; |
490 | }, | 523 | }, |