Commit f57293969c334a8248512006f69d437a0d42aba0
1 parent
87abc4f3
批量设置答案
Showing
8 changed files
with
455 additions
and
226 deletions
src/api/apis/apis.js
src/api/urls/apis.js
src/components/setAnswer.vue
... | ... | @@ -90,6 +90,7 @@ |
90 | 90 | <p>{{ setSubPro(formAns.qusType) }}:</p> |
91 | 91 | <p class="ipt"> |
92 | 92 | <el-input |
93 | + ref="formAnsIpt" | |
93 | 94 | v-if="formAns.qusType == 2 || formAns.qusType == 3" |
94 | 95 | v-model="formAns.answerList" |
95 | 96 | @keydown.native="keydownAnswer($event, formAns.qusType)" |
... | ... | @@ -263,18 +264,21 @@ export default { |
263 | 264 | setFormAns(indexs) { |
264 | 265 | //初始化要修改的答案 |
265 | 266 | this.formAns = { ...this.FormQuestionList[indexs] }; |
267 | + let startIndex = this.formAns.endIndex - this.formAns.subNum; | |
266 | 268 | let answerList = ""; |
267 | 269 | 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); | |
270 | + if (subIdx >= startIndex) { | |
271 | + answerList += this.setAnswer(item.questionType, item.correctAnswer); | |
272 | + if (subIdx != indexs) { | |
273 | + if (!!item.qusType) { | |
274 | + answerList = ""; | |
275 | + } | |
276 | + } else { | |
277 | + if (item.qusType == 3) { | |
278 | + answerList = answerList.slice(0, -1); | |
279 | + } | |
280 | + this.formAns.answerList = answerList; | |
276 | 281 | } |
277 | - this.formAns.answerList = answerList; | |
278 | 282 | } |
279 | 283 | }); |
280 | 284 | this.diaSetAns = true; |
... | ... | @@ -292,13 +296,16 @@ export default { |
292 | 296 | for (let i = 0; i <= subNum; i++) { |
293 | 297 | let correctAnswer = ""; |
294 | 298 | if (this.formAns.qusType == 2) { |
295 | - correctAnswer = this.formAns.answerList[subNum - i]; | |
299 | + correctAnswer = this.formAns.answerList[subNum - i] || ""; | |
296 | 300 | } else if (this.formAns.qusType == 3) { |
297 | - correctAnswer = this.formAns.answerList.split(",")[subNum - i]; | |
298 | - | |
299 | - console.log(this.formAns.answerList.split(",")[subNum - i]); | |
301 | + correctAnswer = this.formAns.answerList.split(",")[subNum - i] || ""; | |
300 | 302 | } else if (this.formAns.qusType == 4) { |
301 | - correctAnswer = this.formAns.answerList[subNum - i] == "✓" ? 1 : 2; | |
303 | + correctAnswer = | |
304 | + this.formAns.answerList[subNum - i] == "✓" | |
305 | + ? 1 | |
306 | + : this.formAns.answerList[subNum - i] == "✗" | |
307 | + ? 2 | |
308 | + : ""; | |
302 | 309 | } |
303 | 310 | this.questionList[EndIndex - i].correctAnswer = correctAnswer; |
304 | 311 | } |
... | ... | @@ -392,9 +399,26 @@ export default { |
392 | 399 | } |
393 | 400 | return txt; |
394 | 401 | }, |
402 | + insertTxtAndSetcursor(answerList, str) { | |
403 | + let element = this.$refs.formAnsIpt.$el.children[0]; // 获取到指定标签 | |
404 | + let startPos = element.selectionStart; // 获取光标开始的位置 | |
405 | + if (startPos === undefined) { | |
406 | + // 如果没有光标位置 不操作 | |
407 | + return answerList; | |
408 | + } else { | |
409 | + return { | |
410 | + text: | |
411 | + answerList.substring(0, startPos) + | |
412 | + str + | |
413 | + answerList.substring(startPos), // 将文本插入 | |
414 | + startPos: startPos + str.length, | |
415 | + }; | |
416 | + } | |
417 | + }, | |
395 | 418 | setMultiple(obj, answer) { |
396 | 419 | //多选答案设置 |
397 | - obj.answerList += answer; | |
420 | + let resault = this.insertTxtAndSetcursor(obj.answerList || "", answer); | |
421 | + obj.answerList = resault.text; | |
398 | 422 | let str = obj.answerList; |
399 | 423 | let str2 = checkAnswer( |
400 | 424 | str, |
... | ... | @@ -403,6 +427,8 @@ export default { |
403 | 427 | obj.answerList.length |
404 | 428 | ); |
405 | 429 | obj.answerList = str2; |
430 | + this.$refs.formAnsIpt.$el.children[0].focus(); | |
431 | + this.$refs.formAnsIpt.$el.children[0].selectionStart = resault.startPos; | |
406 | 432 | }, |
407 | 433 | changAnswer(sub, option) { |
408 | 434 | //设置多选答案 | ... | ... |
src/views/examinationPaper/add.vue
... | ... | @@ -191,7 +191,11 @@ |
191 | 191 | :key="index" |
192 | 192 | > |
193 | 193 | <p class="question-title"> |
194 | - <el-tooltip effect="dark" :content="question.show?'收起':'展开'" placement="left"> | |
194 | + <el-tooltip | |
195 | + effect="dark" | |
196 | + :content="question.show ? '收起' : '展开'" | |
197 | + placement="left" | |
198 | + > | |
195 | 199 | <i |
196 | 200 | class="el-icon-caret-right" |
197 | 201 | :class="question.show ? 'active' : ''" |
... | ... | @@ -277,33 +281,47 @@ |
277 | 281 | </div> |
278 | 282 | <div class="qs-options"> |
279 | 283 | <p v-if="subQuestions.questionType == 5">--</p> |
280 | - <p | |
281 | - v-else-if="subQuestions.questionType == 4" | |
282 | - class="answer-box" | |
283 | - > | |
284 | + <p v-if="subQuestions.questionType == 4" class="answer-box"> | |
284 | 285 | <span |
285 | 286 | class="answer-s" |
286 | 287 | :class="subQuestions.correctAnswer == 1 ? 'active' : ''" |
288 | + @click="subQuestions.correctAnswer = 1" | |
287 | 289 | >✓</span |
288 | 290 | > |
289 | 291 | <span |
290 | 292 | class="answer-s" |
291 | 293 | :class="subQuestions.correctAnswer == 2 ? 'active' : ''" |
294 | + @click="subQuestions.correctAnswer = 2" | |
292 | 295 | >✗</span |
293 | 296 | > |
294 | 297 | </p> |
295 | - <p v-else class="answer-box"> | |
298 | + <p v-if="subQuestions.questionType == 3" class="answer-box"> | |
296 | 299 | <span |
297 | 300 | class="answer-s" |
298 | 301 | v-for="option in subQuestions.answerOptions.split(',')" |
299 | - :key="option" | |
300 | 302 | :class=" |
301 | 303 | subQuestions.correctAnswer?.includes(option) |
302 | 304 | ? 'active' |
303 | 305 | : '' |
304 | 306 | " |
307 | + :key="option" | |
308 | + @click="changAnswer(subQuestions, option)" | |
309 | + >{{ option }}</span | |
310 | + > | |
311 | + </p> | |
312 | + <p v-if="subQuestions.questionType == 2" class="answer-box"> | |
313 | + <span | |
314 | + class="answer-s" | |
315 | + v-for="option in subQuestions.answerOptions.split(',')" | |
316 | + :class=" | |
317 | + subQuestions.correctAnswer == option ? 'active' : '' | |
318 | + " | |
319 | + :key="option" | |
320 | + @click="subQuestions.correctAnswer = option" | |
305 | 321 | >{{ option }}</span |
306 | 322 | > |
323 | + </p> | |
324 | + <p class="answer-box"> | |
307 | 325 | <el-button |
308 | 326 | size="mini" |
309 | 327 | type="primary" |
... | ... | @@ -601,108 +619,108 @@ |
601 | 619 | <span class="m20">共:{{ setNums(question.subQuestions) }}题</span> |
602 | 620 | <span>共:{{ setScore(question) }} 分</span> |
603 | 621 | </p> |
604 | - <ul class="questions-ul"> | |
605 | - <li class="sub-questions"> | |
606 | - <div class="qs-num">题号</div> | |
607 | - <div class="qs-type">题型</div> | |
608 | - <div class="qs-score">分数</div> | |
609 | - <div class="qs-partScore">漏选得分</div> | |
610 | - <div class="qs-options qs-options2">选项设置</div> | |
611 | - </li> | |
612 | - <li | |
613 | - v-for="(subQuestions, indexs) in question.subQuestions" | |
614 | - :key="indexs" | |
622 | + <ul class="questions-ul"> | |
623 | + <li class="sub-questions"> | |
624 | + <div class="qs-num">题号</div> | |
625 | + <div class="qs-type">题型</div> | |
626 | + <div class="qs-score">分数</div> | |
627 | + <div class="qs-partScore">漏选得分</div> | |
628 | + <div class="qs-options qs-options2">选项设置</div> | |
629 | + </li> | |
630 | + <li | |
631 | + v-for="(subQuestions, indexs) in question.subQuestions" | |
632 | + :key="indexs" | |
633 | + > | |
634 | + <p | |
635 | + class="set-ans-btn" | |
636 | + v-if=" | |
637 | + subQuestions.qusType && | |
638 | + subQuestions.subNum && | |
639 | + subQuestions.subNum > 4 | |
640 | + " | |
615 | 641 | > |
616 | - <p | |
617 | - class="set-ans-btn" | |
618 | - v-if=" | |
619 | - subQuestions.qusType && | |
620 | - subQuestions.subNum && | |
621 | - subQuestions.subNum > 4 | |
622 | - " | |
642 | + <el-button type="primary" @click="setFormAns(indexs, index)" | |
643 | + >批量设置答案</el-button | |
623 | 644 | > |
624 | - <el-button type="primary" @click="setFormAns(indexs, index)" | |
625 | - >批量设置答案</el-button | |
626 | - > | |
627 | - </p> | |
628 | - <div v-else class="sub-questions"> | |
629 | - <div class="qs-num"> | |
630 | - {{ setNum(index, indexs, subQuestions) }} | |
631 | - </div> | |
632 | - <div class="qs-type"> | |
633 | - {{ setSubPro(subQuestions.questionType) }} | |
634 | - </div> | |
635 | - <div class="qs-score"> | |
636 | - <el-input-number | |
637 | - class="number-ipt" | |
638 | - size="medium" | |
639 | - :min="1" | |
640 | - :max="200" | |
641 | - :precision="2" | |
642 | - v-model="subQuestions.score" | |
643 | - label="单题分值" | |
644 | - ></el-input-number> | |
645 | - </div> | |
646 | - <div class="qs-partScore"> | |
647 | - <p v-if="subQuestions.questionType != 3">--</p> | |
648 | - <el-input-number | |
649 | - class="number-ipt" | |
650 | - v-else | |
651 | - size="medium" | |
652 | - :min="0" | |
653 | - :precision="2" | |
654 | - :max="subQuestions.score" | |
655 | - :step="0.5" | |
656 | - v-model="subQuestions.partScore" | |
657 | - label="漏选得分" | |
658 | - ></el-input-number> | |
659 | - </div> | |
660 | - <div class="qs-options qs-options2"> | |
661 | - <p v-if="subQuestions.questionType == 5">--</p> | |
662 | - <p v-if="subQuestions.questionType == 4" class="answer-box"> | |
663 | - <span | |
664 | - class="answer-s" | |
665 | - :class="subQuestions.correctAnswer == 1 ? 'active' : ''" | |
666 | - @click="subQuestions.correctAnswer = 1" | |
667 | - >✓</span | |
668 | - > | |
669 | - <span | |
670 | - class="answer-s" | |
671 | - :class="subQuestions.correctAnswer == 2 ? 'active' : ''" | |
672 | - @click="subQuestions.correctAnswer = 2" | |
673 | - >✗</span | |
674 | - > | |
675 | - </p> | |
676 | - <p v-if="subQuestions.questionType == 3" class="answer-box"> | |
677 | - <span | |
678 | - class="answer-s" | |
679 | - v-for="option in subQuestions.answerOptions.split(',')" | |
680 | - :class=" | |
681 | - subQuestions.correctAnswer?.includes(option) | |
682 | - ? 'active' | |
683 | - : '' | |
684 | - " | |
685 | - :key="option" | |
686 | - @click="changAnswer(subQuestions, option)" | |
687 | - >{{ option }}</span | |
688 | - > | |
689 | - </p> | |
690 | - <p v-if="subQuestions.questionType == 2" class="answer-box"> | |
691 | - <span | |
692 | - class="answer-s" | |
693 | - v-for="option in subQuestions.answerOptions.split(',')" | |
694 | - :class=" | |
695 | - subQuestions.correctAnswer == option ? 'active' : '' | |
696 | - " | |
697 | - :key="option" | |
698 | - @click="subQuestions.correctAnswer = option" | |
699 | - >{{ option }}</span | |
700 | - > | |
701 | - </p> | |
702 | - </div> | |
645 | + </p> | |
646 | + <div v-else class="sub-questions"> | |
647 | + <div class="qs-num"> | |
648 | + {{ setNum(index, indexs, subQuestions) }} | |
703 | 649 | </div> |
704 | - </li> | |
705 | - </ul> | |
650 | + <div class="qs-type"> | |
651 | + {{ setSubPro(subQuestions.questionType) }} | |
652 | + </div> | |
653 | + <div class="qs-score"> | |
654 | + <el-input-number | |
655 | + class="number-ipt" | |
656 | + size="medium" | |
657 | + :min="1" | |
658 | + :max="200" | |
659 | + :precision="2" | |
660 | + v-model="subQuestions.score" | |
661 | + label="单题分值" | |
662 | + ></el-input-number> | |
663 | + </div> | |
664 | + <div class="qs-partScore"> | |
665 | + <p v-if="subQuestions.questionType != 3">--</p> | |
666 | + <el-input-number | |
667 | + class="number-ipt" | |
668 | + v-else | |
669 | + size="medium" | |
670 | + :min="0" | |
671 | + :precision="2" | |
672 | + :max="subQuestions.score" | |
673 | + :step="0.5" | |
674 | + v-model="subQuestions.partScore" | |
675 | + label="漏选得分" | |
676 | + ></el-input-number> | |
677 | + </div> | |
678 | + <div class="qs-options qs-options2"> | |
679 | + <p v-if="subQuestions.questionType == 5">--</p> | |
680 | + <p v-if="subQuestions.questionType == 4" class="answer-box"> | |
681 | + <span | |
682 | + class="answer-s" | |
683 | + :class="subQuestions.correctAnswer == 1 ? 'active' : ''" | |
684 | + @click="subQuestions.correctAnswer = 1" | |
685 | + >✓</span | |
686 | + > | |
687 | + <span | |
688 | + class="answer-s" | |
689 | + :class="subQuestions.correctAnswer == 2 ? 'active' : ''" | |
690 | + @click="subQuestions.correctAnswer = 2" | |
691 | + >✗</span | |
692 | + > | |
693 | + </p> | |
694 | + <p v-if="subQuestions.questionType == 3" class="answer-box"> | |
695 | + <span | |
696 | + class="answer-s" | |
697 | + v-for="option in subQuestions.answerOptions.split(',')" | |
698 | + :class=" | |
699 | + subQuestions.correctAnswer?.includes(option) | |
700 | + ? 'active' | |
701 | + : '' | |
702 | + " | |
703 | + :key="option" | |
704 | + @click="changAnswer(subQuestions, option)" | |
705 | + >{{ option }}</span | |
706 | + > | |
707 | + </p> | |
708 | + <p v-if="subQuestions.questionType == 2" class="answer-box"> | |
709 | + <span | |
710 | + class="answer-s" | |
711 | + v-for="option in subQuestions.answerOptions.split(',')" | |
712 | + :class=" | |
713 | + subQuestions.correctAnswer == option ? 'active' : '' | |
714 | + " | |
715 | + :key="option" | |
716 | + @click="subQuestions.correctAnswer = option" | |
717 | + >{{ option }}</span | |
718 | + > | |
719 | + </p> | |
720 | + </div> | |
721 | + </div> | |
722 | + </li> | |
723 | + </ul> | |
706 | 724 | </div> |
707 | 725 | <el-dialog |
708 | 726 | title="批量设置答案" |
... | ... | @@ -719,6 +737,7 @@ |
719 | 737 | <p class="ipt"> |
720 | 738 | <el-input |
721 | 739 | v-if="formAns.qusType == 2 || formAns.qusType == 3" |
740 | + ref="formAnsIpt" | |
722 | 741 | v-model="formAns.answerList" |
723 | 742 | @keydown.native="keydownAnswer($event, formAns.qusType)" |
724 | 743 | @input="setAllAnswer($event, formAns.qusType)" |
... | ... | @@ -1047,27 +1066,47 @@ export default { |
1047 | 1066 | //初始化要修改的答案 |
1048 | 1067 | this.formAns = { ...this.form.questionList[index].subQuestions[indexs] }; |
1049 | 1068 | this.formAns.listIndex = index; |
1069 | + let startIndex = this.formAns.endIndex - this.formAns.subNum; | |
1050 | 1070 | this.formAns.answerList = []; |
1051 | 1071 | let answerList = ""; |
1052 | 1072 | this.form.questionList[index].subQuestions.map((item, subIdx) => { |
1053 | - answerList += this.setAnswer(item.questionType, item.correctAnswer); | |
1054 | - if (subIdx != indexs) { | |
1055 | - if (!!item.qusType) { | |
1056 | - answerList = ""; | |
1057 | - } | |
1058 | - } else { | |
1059 | - if (item.qusType == 3) { | |
1060 | - answerList = answerList.slice(0, -1); | |
1073 | + if (subIdx >= startIndex) { | |
1074 | + answerList += this.setAnswer(item.questionType, item.correctAnswer); | |
1075 | + if (subIdx != indexs) { | |
1076 | + if (!!item.qusType) { | |
1077 | + answerList = ""; | |
1078 | + } | |
1079 | + } else { | |
1080 | + if (item.qusType == 3) { | |
1081 | + answerList = answerList.slice(0, -1); | |
1082 | + } | |
1083 | + this.formAns.answerList = answerList; | |
1061 | 1084 | } |
1062 | - this.formAns.answerList = answerList; | |
1063 | 1085 | } |
1064 | 1086 | }); |
1065 | 1087 | |
1066 | 1088 | this.diaSetAns = true; |
1067 | 1089 | }, |
1090 | + insertTxtAndSetcursor(answerList, str) { | |
1091 | + let element = this.$refs.formAnsIpt.$el.children[0]; // 获取到指定标签 | |
1092 | + let startPos = element.selectionStart; // 获取光标开始的位置 | |
1093 | + if (startPos === undefined) { | |
1094 | + // 如果没有光标位置 不操作 | |
1095 | + return answerList; | |
1096 | + } else { | |
1097 | + return { | |
1098 | + text: | |
1099 | + answerList.substring(0, startPos) + | |
1100 | + str + | |
1101 | + answerList.substring(startPos), // 将文本插入 | |
1102 | + startPos: startPos + str.length, | |
1103 | + }; | |
1104 | + } | |
1105 | + }, | |
1068 | 1106 | setMultiple(obj, answer) { |
1069 | 1107 | //多选答案设置 |
1070 | - obj.answerList += answer; | |
1108 | + let resault = this.insertTxtAndSetcursor(obj.answerList || "", answer); | |
1109 | + obj.answerList = resault.text; | |
1071 | 1110 | let str = obj.answerList; |
1072 | 1111 | let str2; |
1073 | 1112 | if (!!obj.answerOptions) { |
... | ... | @@ -1081,6 +1120,8 @@ export default { |
1081 | 1120 | str2 = checkAnswer(str, 3, obj.selectNum, obj.answerList.length); |
1082 | 1121 | } |
1083 | 1122 | obj.answerList = str2; |
1123 | + this.$refs.formAnsIpt.$el.children[0].focus(); | |
1124 | + this.$refs.formAnsIpt.$el.children[0].selectionStart = resault.startPos; | |
1084 | 1125 | }, |
1085 | 1126 | saveFormAns() { |
1086 | 1127 | //批量修改答案 |
... | ... | @@ -1098,10 +1139,9 @@ export default { |
1098 | 1139 | for (let i = 0; i <= subNum; i++) { |
1099 | 1140 | let correctAnswer = ""; |
1100 | 1141 | if (this.formAns.qusType == 2) { |
1101 | - correctAnswer = this.formAns.answerList[subNum - i]; | |
1142 | + correctAnswer = this.formAns.answerList[subNum - i] || ""; | |
1102 | 1143 | } else if (this.formAns.qusType == 3) { |
1103 | - correctAnswer = this.formAns.answerList.split(",")[subNum - i]; | |
1104 | - console.log(this.formAns.answerList.split(",")[subNum - i]); | |
1144 | + correctAnswer = this.formAns.answerList.split(",")[subNum - i] || ""; | |
1105 | 1145 | } else if (this.formAns.qusType == 4) { |
1106 | 1146 | correctAnswer = |
1107 | 1147 | this.formAns.answerList[subNum - i] == "✓" |
... | ... | @@ -1548,9 +1588,9 @@ export default { |
1548 | 1588 | if (this.saveLoading) return; |
1549 | 1589 | this.saveLoading = true; |
1550 | 1590 | this.formatQuestionList(); |
1551 | - let formDatas = deepClone(this.form) | |
1591 | + let formDatas = deepClone(this.form); | |
1552 | 1592 | for (let i = 0; i < formDatas.questionList.length; i++) { |
1553 | - delete formDatas.questionList[i].show | |
1593 | + delete formDatas.questionList[i].show; | |
1554 | 1594 | } |
1555 | 1595 | const { data, status, info } = await this.$request.addPaper({ |
1556 | 1596 | ...formDatas, | ... | ... |
src/views/examinationPaper/edit.vue
... | ... | @@ -71,7 +71,17 @@ |
71 | 71 | </div> |
72 | 72 | <div class="qs-partScore"> |
73 | 73 | <p v-if="subQuestions.questionType != 3">--</p> |
74 | - <p v-else>{{ subQuestions.partScore }}</p> | |
74 | + <el-input-number | |
75 | + class="number-ipt" | |
76 | + v-else | |
77 | + size="medium" | |
78 | + :min="0" | |
79 | + :precision="2" | |
80 | + :max="subQuestions.score" | |
81 | + :step="0.5" | |
82 | + v-model="subQuestions.partScore" | |
83 | + label="漏选得分" | |
84 | + ></el-input-number> | |
75 | 85 | </div> |
76 | 86 | <div class="qs-options qs-options2"> |
77 | 87 | <p v-if="subQuestions.questionType == 5">--</p> |
... | ... | @@ -160,7 +170,17 @@ |
160 | 170 | </div> |
161 | 171 | <div class="qs-partScore"> |
162 | 172 | <p v-if="subQuestions.questionType != 3">--</p> |
163 | - <p v-else>{{ subQuestions.partScore }}</p> | |
173 | + <el-input-number | |
174 | + class="number-ipt" | |
175 | + v-else | |
176 | + size="medium" | |
177 | + :min="0" | |
178 | + :precision="2" | |
179 | + :max="subQuestions.score" | |
180 | + :step="0.5" | |
181 | + v-model="subQuestions.partScore" | |
182 | + label="漏选得分" | |
183 | + ></el-input-number> | |
164 | 184 | </div> |
165 | 185 | <div class="qs-options qs-options2"> |
166 | 186 | <p v-if="subQuestions.questionType == 5">--</p> |
... | ... | @@ -234,6 +254,7 @@ |
234 | 254 | <p>{{ setSubPro(formAns.qusType) }}:</p> |
235 | 255 | <p class="ipt"> |
236 | 256 | <el-input |
257 | + ref="formAnsIpt" | |
237 | 258 | v-if="formAns.qusType == 2 || formAns.qusType == 3" |
238 | 259 | v-model="formAns.answerList" |
239 | 260 | @keydown.native="keydownAnswer($event, formAns.qusType)" |
... | ... | @@ -476,9 +497,26 @@ export default { |
476 | 497 | } |
477 | 498 | return txt; |
478 | 499 | }, |
500 | + insertTxtAndSetcursor(answerList, str) { | |
501 | + let element = this.$refs.formAnsIpt.$el.children[0]; // 获取到指定标签 | |
502 | + let startPos = element.selectionStart; // 获取光标开始的位置 | |
503 | + if (startPos === undefined) { | |
504 | + // 如果没有光标位置 不操作 | |
505 | + return answerList; | |
506 | + } else { | |
507 | + return { | |
508 | + text: | |
509 | + answerList.substring(0, startPos) + | |
510 | + str + | |
511 | + answerList.substring(startPos), // 将文本插入 | |
512 | + startPos: startPos + str.length, | |
513 | + }; | |
514 | + } | |
515 | + }, | |
479 | 516 | setMultiple(obj, answer) { |
480 | 517 | //多选答案设置 |
481 | - obj.answerList += answer; | |
518 | + let resault = this.insertTxtAndSetcursor(obj.answerList || "", answer); | |
519 | + obj.answerList = resault.text; | |
482 | 520 | let str = obj.answerList; |
483 | 521 | let str2 = checkAnswer( |
484 | 522 | str, |
... | ... | @@ -487,6 +525,8 @@ export default { |
487 | 525 | obj.answerList.length |
488 | 526 | ); |
489 | 527 | obj.answerList = str2; |
528 | + this.$refs.formAnsIpt.$el.children[0].focus(); | |
529 | + this.$refs.formAnsIpt.$el.children[0].selectionStart = resault.startPos; | |
490 | 530 | }, |
491 | 531 | setFormAns(indexs, index) { |
492 | 532 | //初始化要修改的答案 |
... | ... | @@ -494,34 +534,40 @@ export default { |
494 | 534 | this.formAns = { ...this.questionList[index].subQuestions[indexs] }; |
495 | 535 | this.formAns.listIndex = index; |
496 | 536 | let answerList = ""; |
537 | + let startIndex = this.formAns.endIndex - this.formAns.subNum; | |
497 | 538 | 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); | |
539 | + if (subIdx >= startIndex) { | |
540 | + answerList += this.setAnswer(item.questionType, item.correctAnswer); | |
541 | + if (subIdx != indexs) { | |
542 | + if (!!item.qusType) { | |
543 | + answerList = ""; | |
544 | + } | |
545 | + } else { | |
546 | + if (item.qusType == 3) { | |
547 | + answerList = answerList.slice(0, -1); | |
548 | + } | |
549 | + this.formAns.answerList = answerList; | |
506 | 550 | } |
507 | - this.formAns.answerList = answerList; | |
508 | 551 | } |
509 | 552 | }); |
510 | 553 | } else { |
511 | 554 | this.formAns = { ...this.questionList[indexs] }; |
555 | + let startIndex = this.formAns.endIndex - this.formAns.subNum; | |
512 | 556 | this.formAns.listIndex = indexs; |
513 | 557 | let answerList = ""; |
514 | 558 | 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); | |
559 | + if (subIdx >= startIndex) { | |
560 | + answerList += this.setAnswer(item.questionType, item.correctAnswer); | |
561 | + if (subIdx != indexs) { | |
562 | + if (!!item.qusType) { | |
563 | + answerList = ""; | |
564 | + } | |
565 | + } else { | |
566 | + if (item.qusType == 3) { | |
567 | + answerList = answerList.slice(0, -1); | |
568 | + } | |
569 | + this.formAns.answerList = answerList; | |
523 | 570 | } |
524 | - this.formAns.answerList = answerList; | |
525 | 571 | } |
526 | 572 | }); |
527 | 573 | } |
... | ... | @@ -552,13 +598,16 @@ export default { |
552 | 598 | for (let i = 0; i <= subNum; i++) { |
553 | 599 | let correctAnswer = ""; |
554 | 600 | if (this.formAns.qusType == 2) { |
555 | - correctAnswer = this.formAns.answerList[subNum - i]; | |
601 | + correctAnswer = this.formAns.answerList[subNum - i] || ""; | |
556 | 602 | } else if (this.formAns.qusType == 3) { |
557 | - correctAnswer = this.formAns.answerList.split(",")[subNum - i]; | |
558 | - | |
559 | - console.log(this.formAns.answerList.split(",")[subNum - i]); | |
603 | + correctAnswer = this.formAns.answerList.split(",")[subNum - i] || ""; | |
560 | 604 | } else if (this.formAns.qusType == 4) { |
561 | - correctAnswer = this.formAns.answerList[subNum - i] == "✓" ? 1 : 2; | |
605 | + correctAnswer = | |
606 | + this.formAns.answerList[subNum - i] == "✓" | |
607 | + ? 1 | |
608 | + : this.formAns.answerList[subNum - i] == "✗" | |
609 | + ? 2 | |
610 | + : ""; | |
562 | 611 | } |
563 | 612 | if (this.questionList[0].subQuestions) { |
564 | 613 | this.questionList[this.formAns.listIndex].subQuestions[ |
... | ... | @@ -732,6 +781,7 @@ export default { |
732 | 781 | } |
733 | 782 | } |
734 | 783 | } |
784 | + console.log(this.questionList); | |
735 | 785 | } else { |
736 | 786 | this.$message.error(info); |
737 | 787 | } | ... | ... |
src/views/setUp/account.vue
... | ... | @@ -16,7 +16,12 @@ |
16 | 16 | @click="diaUp = true" |
17 | 17 | ></el-button> |
18 | 18 | </el-tooltip> --> |
19 | - <el-tooltip effect="dark" content="添加账号" placement="bottom" v-if="!code"> | |
19 | + <el-tooltip | |
20 | + effect="dark" | |
21 | + content="添加账号" | |
22 | + placement="bottom" | |
23 | + v-if="!code" | |
24 | + > | |
20 | 25 | <el-button |
21 | 26 | type="primary" |
22 | 27 | icon="el-icon-plus" |
... | ... | @@ -28,6 +33,7 @@ |
28 | 33 | </el-tooltip> |
29 | 34 | <el-tooltip effect="dark" content="账号同步" placement="bottom" v-else> |
30 | 35 | <el-button |
36 | + v-loading="syncLoading" | |
31 | 37 | type="primary" |
32 | 38 | icon="el-icon-refresh" |
33 | 39 | size="mini" |
... | ... | @@ -360,12 +366,13 @@ import { encryptLoginPassword } from "@/utils"; |
360 | 366 | export default { |
361 | 367 | data() { |
362 | 368 | return { |
363 | - code:"", | |
369 | + code: "", | |
364 | 370 | role: "", |
365 | 371 | diaUp: false, |
366 | 372 | diaAdd: false, |
367 | 373 | url: "", //上传地址 |
368 | 374 | loading: false, |
375 | + syncLoading: false, | |
369 | 376 | diaCount: false, |
370 | 377 | tenantRoleList: [], |
371 | 378 | regionList: [], |
... | ... | @@ -439,10 +446,16 @@ export default { |
439 | 446 | this._QueryData(4); |
440 | 447 | }, |
441 | 448 | methods: { |
442 | - async refreshAcc(){//长水账号同步 | |
443 | - const { data, status, info } = await this.$request.roleList(); | |
449 | + async refreshAcc() { | |
450 | + //长水账号同步 | |
451 | + if (this.syncLoading) return; | |
452 | + this.syncLoading = true; | |
453 | + const { data, status, info } = await this.$request.syncUser(); | |
454 | + this.syncLoading = false; | |
444 | 455 | if (status === 0) { |
445 | - this._QueryData(4); | |
456 | + this.$message.success("同步中,请稍后刷新重试~"); | |
457 | + // this._QueryData(4); | |
458 | + | |
446 | 459 | } else { |
447 | 460 | this.$message.error(info); |
448 | 461 | } | ... | ... |
src/views/setUp/student.vue
... | ... | @@ -4,8 +4,23 @@ |
4 | 4 | <template slot="title"> |
5 | 5 | <span>学生管理</span> |
6 | 6 | </template> |
7 | - <template slot="btns" v-if="!code"> | |
8 | - <el-tooltip effect="dark" content="添加学生" placement="bottom"> | |
7 | + <template slot="btns" v-if="role == 'ROLE_XUEXIAO'"> | |
8 | + <el-tooltip effect="dark" content="设置答题器" placement="bottom"> | |
9 | + <el-button | |
10 | + type="primary" | |
11 | + icon="el-icon-upload2" | |
12 | + size="mini" | |
13 | + plain | |
14 | + circle | |
15 | + @click="diaUp = true" | |
16 | + ></el-button> | |
17 | + </el-tooltip> | |
18 | + <el-tooltip | |
19 | + v-if="!code" | |
20 | + effect="dark" | |
21 | + content="添加学生" | |
22 | + placement="bottom" | |
23 | + > | |
9 | 24 | <el-button |
10 | 25 | type="primary" |
11 | 26 | icon="el-icon-plus" |
... | ... | @@ -17,6 +32,7 @@ |
17 | 32 | </el-tooltip> |
18 | 33 | </template> |
19 | 34 | </back-box> |
35 | + | |
20 | 36 | <div class="page-content"> |
21 | 37 | <div class="stu-box"> |
22 | 38 | <div class="stu-list"> |
... | ... | @@ -193,6 +209,22 @@ |
193 | 209 | <el-button @click="diaClass = false">取 消</el-button> |
194 | 210 | </div> |
195 | 211 | </el-dialog> |
212 | + <el-dialog title="设置答题器" :visible.sync="diaUp" width="600"> | |
213 | + <up-load | |
214 | + id="downTeacher" | |
215 | + :url="url" | |
216 | + @upSuccess="upSuccess" | |
217 | + fileName="学生信息与答题器名单" | |
218 | + > | |
219 | + <p class="down-txt" slot="down"> | |
220 | + 通过Excel名单导入学生信息与答题器名单,点击 | |
221 | + <el-link type="danger" @click="downExcel">模板下载</el-link> 。 | |
222 | + </p> | |
223 | + </up-load> | |
224 | + <div class="dialog-footer" slot="footer"> | |
225 | + <el-button @click="diaUp = false">取 消</el-button> | |
226 | + </div> | |
227 | + </el-dialog> | |
196 | 228 | </div> |
197 | 229 | </template> |
198 | 230 | |
... | ... | @@ -202,6 +234,8 @@ export default { |
202 | 234 | data() { |
203 | 235 | return { |
204 | 236 | code: "", |
237 | + role: "", | |
238 | + diaUp: false, | |
205 | 239 | url: "", |
206 | 240 | diaStu: false, |
207 | 241 | diaClass: false, |
... | ... | @@ -254,6 +288,13 @@ export default { |
254 | 288 | }, |
255 | 289 | async created() { |
256 | 290 | this.code = localStorage.getItem("csCode") || ""; |
291 | + let role = ""; | |
292 | + this.$store.getters.info.permissions.map((item) => { | |
293 | + if (item.roleName == this.$store.getters.info.showRoleName) { | |
294 | + role = item.role; | |
295 | + } | |
296 | + }); | |
297 | + this.role = role ? role : this.$store.getters.info.permissions[0].role; | |
257 | 298 | await this._QueryDataGrade(); |
258 | 299 | await this._QueryClass(); |
259 | 300 | this._QueryData(3); |
... | ... | @@ -300,6 +341,26 @@ export default { |
300 | 341 | } |
301 | 342 | }); |
302 | 343 | }, |
344 | + upSuccess() { | |
345 | + //导入成功 | |
346 | + this.diaUp = false; | |
347 | + this._QueryData(3); | |
348 | + }, | |
349 | + async downExcel() { | |
350 | + this.loadingDown = true; | |
351 | + let data = await this.$request.subjectiveScoreTemplate({ | |
352 | + classId: this.query.classId, | |
353 | + }); | |
354 | + this.loadingDown = false; | |
355 | + if (data && !data.code) { | |
356 | + let blob = new Blob([data], { | |
357 | + type: "application/vnd.ms-excel;charset=utf-8", | |
358 | + }); | |
359 | + downloadFile(`主观题模版.xlsx`, blob); | |
360 | + } else { | |
361 | + this.$message.error(data.info); | |
362 | + } | |
363 | + }, | |
303 | 364 | async removeStu(obj, index) { |
304 | 365 | const { data, status, info } = await this.$request.delStudent({ |
305 | 366 | studentId: obj.id, |
... | ... | @@ -410,19 +471,6 @@ export default { |
410 | 471 | this.$message.error(info); |
411 | 472 | } |
412 | 473 | }, |
413 | - async downExcel() { | |
414 | - let data = await this.$request.downDevice({ | |
415 | - id: this.id, | |
416 | - }); | |
417 | - if (data && !data.code) { | |
418 | - let blob = new Blob([data], { | |
419 | - type: "application/vnd.ms-excel;charset=utf-8", | |
420 | - }); | |
421 | - downloadFile(`设备信息.xlsx`, blob); | |
422 | - } else { | |
423 | - this.$message.error(data.info); | |
424 | - } | |
425 | - }, | |
426 | 474 | }, |
427 | 475 | }; |
428 | 476 | </script> | ... | ... |
src/views/test/editAnswer.vue
... | ... | @@ -53,7 +53,17 @@ |
53 | 53 | </div> |
54 | 54 | <div class="qs-partScore"> |
55 | 55 | <p v-if="subQuestions.questionType != 3">--</p> |
56 | - <p v-else>{{ subQuestions.partScore }}</p> | |
56 | + <el-input-number | |
57 | + class="number-ipt" | |
58 | + v-else | |
59 | + size="medium" | |
60 | + :min="0" | |
61 | + :precision="2" | |
62 | + :max="subQuestions.score" | |
63 | + :step="0.5" | |
64 | + v-model="subQuestions.partScore" | |
65 | + label="漏选得分" | |
66 | + ></el-input-number> | |
57 | 67 | </div> |
58 | 68 | <div class="qs-options qs-options2"> |
59 | 69 | <p v-if="subQuestions.questionType == 5">--</p> |
... | ... | @@ -142,7 +152,17 @@ |
142 | 152 | </div> |
143 | 153 | <div class="qs-partScore"> |
144 | 154 | <p v-if="subQuestions.questionType != 3">--</p> |
145 | - <p v-else>{{ subQuestions.partScore }}</p> | |
155 | + <el-input-number | |
156 | + class="number-ipt" | |
157 | + v-else | |
158 | + size="medium" | |
159 | + :min="0" | |
160 | + :precision="2" | |
161 | + :max="subQuestions.score" | |
162 | + :step="0.5" | |
163 | + v-model="subQuestions.partScore" | |
164 | + label="漏选得分" | |
165 | + ></el-input-number> | |
146 | 166 | </div> |
147 | 167 | <div class="qs-options qs-options2"> |
148 | 168 | <p v-if="subQuestions.questionType == 5">--</p> |
... | ... | @@ -200,9 +220,7 @@ |
200 | 220 | </ul> |
201 | 221 | </div> |
202 | 222 | <div class="btn-box"> |
203 | - <el-button type="danger" plain round @click="cancel" | |
204 | - >取消</el-button | |
205 | - > | |
223 | + <el-button type="danger" plain round @click="cancel">取消</el-button> | |
206 | 224 | <el-button type="primary" round @click="saveAnswer">保存</el-button> |
207 | 225 | </div> |
208 | 226 | </div> |
... | ... | @@ -220,6 +238,7 @@ |
220 | 238 | <p>{{ setSubPro(formAns.qusType) }}:</p> |
221 | 239 | <p class="ipt"> |
222 | 240 | <el-input |
241 | + ref="formAnsIpt" | |
223 | 242 | v-if="formAns.qusType == 2 || formAns.qusType == 3" |
224 | 243 | v-model="formAns.answerList" |
225 | 244 | @keydown.native="keydownAnswer($event, formAns.qusType)" |
... | ... | @@ -288,11 +307,7 @@ |
288 | 307 | @click="formAns.answerList = formAns.answerList.slice(0, -1)" |
289 | 308 | >x</span |
290 | 309 | > |
291 | - <span | |
292 | - class="answer-s ac" | |
293 | - @click="formAns.answerList = ''" | |
294 | - >ac</span | |
295 | - > | |
310 | + <span class="answer-s ac" @click="formAns.answerList = ''">ac</span> | |
296 | 311 | </p> |
297 | 312 | </div> |
298 | 313 | <div class="dialog-footer" slot="footer"> |
... | ... | @@ -322,7 +337,7 @@ export default { |
322 | 337 | }, |
323 | 338 | data() { |
324 | 339 | return { |
325 | - id:"", | |
340 | + id: "", | |
326 | 341 | diaSetAns: false, |
327 | 342 | form: {}, |
328 | 343 | questionList: [], |
... | ... | @@ -438,12 +453,12 @@ export default { |
438 | 453 | event.returnValue = ""; |
439 | 454 | } |
440 | 455 | }, |
441 | - setAllAnswer(event, type){ | |
456 | + setAllAnswer(event, type) { | |
442 | 457 | let str = this.formAns.answerList; |
443 | 458 | let str2 = checkAnswer( |
444 | 459 | str, |
445 | 460 | type, |
446 | - this.formAns.answerOptions.split(',').length, | |
461 | + this.formAns.answerOptions.split(",").length, | |
447 | 462 | this.formAns.subNum |
448 | 463 | ); |
449 | 464 | this.formAns.answerList = str2; |
... | ... | @@ -459,9 +474,26 @@ export default { |
459 | 474 | } |
460 | 475 | return txt; |
461 | 476 | }, |
477 | + insertTxtAndSetcursor(answerList, str) { | |
478 | + let element = this.$refs.formAnsIpt.$el.children[0]; // 获取到指定标签 | |
479 | + let startPos = element.selectionStart; // 获取光标开始的位置 | |
480 | + if (startPos === undefined) { | |
481 | + // 如果没有光标位置 不操作 | |
482 | + return answerList; | |
483 | + } else { | |
484 | + return { | |
485 | + text: | |
486 | + answerList.substring(0, startPos) + | |
487 | + str + | |
488 | + answerList.substring(startPos), // 将文本插入 | |
489 | + startPos: startPos + str.length, | |
490 | + }; | |
491 | + } | |
492 | + }, | |
462 | 493 | setMultiple(obj, answer) { |
463 | 494 | //多选答案设置 |
464 | - obj.answerList += answer; | |
495 | + let resault = this.insertTxtAndSetcursor(obj.answerList || "", answer); | |
496 | + obj.answerList = resault.text; | |
465 | 497 | let str = obj.answerList; |
466 | 498 | let str2 = checkAnswer( |
467 | 499 | str, |
... | ... | @@ -470,6 +502,8 @@ export default { |
470 | 502 | obj.answerList.length |
471 | 503 | ); |
472 | 504 | obj.answerList = str2; |
505 | + this.$refs.formAnsIpt.$el.children[0].focus(); | |
506 | + this.$refs.formAnsIpt.$el.children[0].selectionStart = resault.startPos; | |
473 | 507 | }, |
474 | 508 | changAnswer(sub, option) { |
475 | 509 | //设置多选答案 |
... | ... | @@ -482,40 +516,46 @@ export default { |
482 | 516 | sub.correctAnswer = arrs.sort().join(""); |
483 | 517 | } |
484 | 518 | }, |
485 | - setFormAns(indexs, index) { | |
519 | + setFormAns(indexs, index) { | |
486 | 520 | //初始化要修改的答案 |
487 | 521 | if (this.questionList[0].subQuestions) { |
488 | 522 | this.formAns = { ...this.questionList[index].subQuestions[indexs] }; |
489 | 523 | this.formAns.listIndex = index; |
524 | + let startIndex = this.formAns.endIndex - this.formAns.subNum; | |
490 | 525 | let answerList = ""; |
491 | 526 | 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); | |
527 | + if (subIdx >= startIndex) { | |
528 | + answerList += this.setAnswer(item.questionType, item.correctAnswer); | |
529 | + if (subIdx != indexs) { | |
530 | + if (!!item.qusType) { | |
531 | + answerList = ""; | |
532 | + } | |
533 | + } else { | |
534 | + if (item.qusType == 3) { | |
535 | + answerList = answerList.slice(0, -1); | |
536 | + } | |
537 | + this.formAns.answerList = answerList; | |
500 | 538 | } |
501 | - this.formAns.answerList = answerList; | |
502 | 539 | } |
503 | 540 | }); |
504 | 541 | } else { |
505 | 542 | this.formAns = { ...this.questionList[indexs] }; |
506 | 543 | this.formAns.listIndex = indexs; |
544 | + let startIndex = this.formAns.endIndex - this.formAns.subNum; | |
507 | 545 | let answerList = ""; |
508 | 546 | 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); | |
547 | + if (subIdx >= startIndex) { | |
548 | + answerList += this.setAnswer(item.questionType, item.correctAnswer); | |
549 | + if (subIdx != indexs) { | |
550 | + if (!!item.qusType) { | |
551 | + answerList = ""; | |
552 | + } | |
553 | + } else { | |
554 | + if (item.qusType == 3) { | |
555 | + answerList = answerList.slice(0, -1); | |
556 | + } | |
557 | + this.formAns.answerList = answerList; | |
517 | 558 | } |
518 | - this.formAns.answerList = answerList; | |
519 | 559 | } |
520 | 560 | }); |
521 | 561 | } |
... | ... | @@ -546,13 +586,16 @@ export default { |
546 | 586 | for (let i = 0; i <= subNum; i++) { |
547 | 587 | let correctAnswer = ""; |
548 | 588 | if (this.formAns.qusType == 2) { |
549 | - correctAnswer = this.formAns.answerList[subNum - i]; | |
589 | + correctAnswer = this.formAns.answerList[subNum - i] || ""; | |
550 | 590 | } else if (this.formAns.qusType == 3) { |
551 | - correctAnswer = this.formAns.answerList.split(",")[subNum - i]; | |
552 | - | |
553 | - console.log(this.formAns.answerList.split(",")[subNum - i]); | |
591 | + correctAnswer = this.formAns.answerList.split(",")[subNum - i] || ""; | |
554 | 592 | } else if (this.formAns.qusType == 4) { |
555 | - correctAnswer = this.formAns.answerList[subNum - i] == "✓" ? 1 : 2; | |
593 | + correctAnswer = | |
594 | + this.formAns.answerList[subNum - i] == "✓" | |
595 | + ? 1 | |
596 | + : this.formAns.answerList[subNum - i] == "✗" | |
597 | + ? 2 | |
598 | + : ""; | |
556 | 599 | } |
557 | 600 | if (this.questionList[0].subQuestions) { |
558 | 601 | this.questionList[this.formAns.listIndex].subQuestions[ |
... | ... | @@ -566,7 +609,7 @@ export default { |
566 | 609 | }, |
567 | 610 | async edit(id) { |
568 | 611 | //修改答案 |
569 | - this.id = id | |
612 | + this.id = id; | |
570 | 613 | const { data, status, info } = await this.$request.examQuestionList({ |
571 | 614 | examId: id, |
572 | 615 | }); |
... | ... | @@ -580,7 +623,7 @@ export default { |
580 | 623 | let types = [{}]; |
581 | 624 | let addndex = 0; |
582 | 625 | item.subQuestions.map((sub, index) => { |
583 | - if (!!sub.questionType && sub.questionType!=5) { | |
626 | + if (!!sub.questionType && sub.questionType != 5) { | |
584 | 627 | if (sub.questionType == types[addndex].qusType) { |
585 | 628 | //同类型批量答案+1 |
586 | 629 | types[addndex].subNum += 1; |
... | ... | @@ -605,7 +648,7 @@ export default { |
605 | 648 | //不同类型时如果原有类型数量大于等于5,保存批量答案 |
606 | 649 | types[addndex].endIndex = |
607 | 650 | item.subQuestions[index - 1].questionIndex; |
608 | - types[addndex].index = index-1; | |
651 | + types[addndex].index = index - 1; | |
609 | 652 | addndex += 1; |
610 | 653 | types[addndex] = {}; |
611 | 654 | } |
... | ... | @@ -637,7 +680,7 @@ export default { |
637 | 680 | let types = [{}]; |
638 | 681 | let addndex = 0; |
639 | 682 | this.questionList?.map((sub, index) => { |
640 | - if (!!sub.questionType && sub.questionType!=5) { | |
683 | + if (!!sub.questionType && sub.questionType != 5) { | |
641 | 684 | if (sub.questionType == types[addndex].qusType) { |
642 | 685 | //同类型批量答案+1 |
643 | 686 | types[addndex].subNum += 1; |
... | ... | @@ -662,7 +705,7 @@ export default { |
662 | 705 | //不同类型时如果原有类型数量大于等于5,保存批量答案 |
663 | 706 | types[addndex].endIndex = |
664 | 707 | this.questionList[index - 1].questionIndex; |
665 | - types[addndex].index = index-1; | |
708 | + types[addndex].index = index - 1; | |
666 | 709 | addndex += 1; |
667 | 710 | types[addndex] = {}; |
668 | 711 | } |
... | ... | @@ -705,7 +748,7 @@ export default { |
705 | 748 | } else { |
706 | 749 | if (this.questionList[i].qusType) { |
707 | 750 | this.questionList.splice(i, 1); |
708 | - i-- | |
751 | + i--; | |
709 | 752 | } |
710 | 753 | } |
711 | 754 | } | ... | ... |