Commit 77fa942a6b3ba05f32000003df435b3b06f2ddfe

Authored by LH_PC
1 parent b79b1091

feat:修改打印对接

src/utils/index.js
... ... @@ -885,7 +885,7 @@ export function formatGradeNameClass(data) {
885 885  
886 886 ///试卷定制化打印
887 887 export async function paperPrint(paper) {
888   - let printWin = window.open("", "_blank", "");
  888 + let printWin = window.open("", "_blank", "");
889 889 var browser = getBrowserEngine(printWin);
890 890 var subjectName = paper.subjectName;
891 891 var paperTitle = paper.title;
... ... @@ -911,7 +911,7 @@ export async function paperPrint(paper) {
911 911 }
912 912 return "Blink"; // Assume it's Chrome, Safari, or an alternative Blink-based browser
913 913 }
914   - function windowPrint(windowParams) {
  914 + function windowPrint(windowParams) {
915 915 windowParams.print();
916 916 windowParams.close();
917 917 }
... ...
src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue
1 1 <template>
2   - <el-dialog
3   - :visible.sync="visible"
4   - width="70%"
5   - :before-close="handleClose"
6   - :modal-append-to-body="false"
7   - >
  2 + <el-dialog :visible.sync="visible" width="70%" :before-close="handleClose" :modal-append-to-body="false">
8 3 <div class="test-box" v-if="groups">
9 4 <div class="test">
10 5 <div class="test-title" @click="enableEditing">
11   - <div
12   - class="test-title"
13   - v-if="!isEditing"
14   - @mouseenter="handleMouseEnter"
15   - @mouseleave="handleMouseLeave"
16   - :class="isHovered ? 'hover' : ''"
17   - >
  6 + <div class="test-title" v-if="!isEditing" @mouseenter="handleMouseEnter" @mouseleave="handleMouseLeave"
  7 + :class="isHovered ? 'hover' : ''">
18 8 {{ inputValue }}
19 9 </div>
20   - <div
21   - v-if="isHovered"
22   - class="tooltip"
23   - :style="{
24   - top: tooltipPosition.y + 'px',
25   - left: tooltipPosition.x + 'px',
26   - }"
27   - >
  10 + <div v-if="isHovered" class="tooltip" :style="{
  11 + top: tooltipPosition.y + 'px',
  12 + left: tooltipPosition.x + 'px',
  13 + }">
28 14 单击设置试卷标题
29 15 </div>
30   - <el-input
31   - class="test-title"
32   - ref="editInput"
33   - v-if="isEditing"
34   - v-model="inputValue"
35   - @blur="save"
36   - @keyup.enter.native="save"
37   - style="padding: 0 200px"
38   - />
  16 + <el-input class="test-title" ref="editInput" v-if="isEditing" v-model="inputValue" @blur="save"
  17 + @keyup.enter.native="save" style="padding: 0 200px" />
39 18 </div>
40 19 <div class="test-group">
41   - <div
42   - class="outer-item"
43   - v-for="(group, index) in groups"
44   - :key="group.questionType"
45   - :class="{
46   - border: selectedIndex === group.questionType,
47   - }"
48   - @mouseenter="handleGroupMouseEnter(group.questionType, 'all')"
49   - @mouseleave="handleGroupMouseLeave"
50   - >
51   - <div
52   - v-if="selectedIndex == group.questionType"
53   - class="border-del"
54   - @click="handleDel(group.questionType, 'all')"
55   - >
  20 + <div class="outer-item" v-for="(group, index) in groups" :key="group.questionType" :class="{
  21 + border: selectedIndex === group.questionType,
  22 + }" @mouseenter="handleGroupMouseEnter(group.questionType, 'all')" @mouseleave="handleGroupMouseLeave">
  23 + <div v-if="selectedIndex == group.questionType" class="border-del"
  24 + @click="handleDel(group.questionType, 'all')">
56 25 删除
57 26 </div>
58 27 <!-- 每个组的标题 -->
59   - <div
60   - class="test-group-title"
61   - :class="{
62   - border: selectedIndex == group.questionType,
63   - }"
64   - @mouseenter="handleGroupMouseEnter(group.questionType, 'all')"
65   - >
  28 + <div class="test-group-title" :class="{
  29 + border: selectedIndex == group.questionType,
  30 + }" @mouseenter="handleGroupMouseEnter(group.questionType, 'all')">
66 31 <div class="size-16" style="font-weight: 600">
67 32 {{ index + 1 }}、
68   - <span
69   - @mouseenter="
70   - (event) => handleItemMouseEnter(event, group.questionType)
71   - "
72   - @mouseleave="handleItemMouseLeave"
73   - :class="isItemHovered == group.questionType ? 'hover' : ''"
74   - class="size-16"
75   - @click="groupEditing(index)"
76   - v-show="!group.input"
77   - >{{ group.questionTitle }}</span
78   - >
79   -
80   - <el-input
81   - :ref="'refInput' + index"
82   - class="size-16"
83   - size="mini"
84   - v-show="group.input"
85   - v-model="group.questionTitle"
86   - @blur="groupSave(index)"
87   - @keyup.enter.native="groupSave(index)"
88   - style="width: fit-content"
89   - />
90   - <div
91   - v-if="isItemHovered == group.questionType"
92   - class="tooltip"
93   - :style="{
94   - top: tooltipPosition.y + 'px',
95   - left: tooltipPosition.x + 'px',
96   - }"
97   - >
  33 + <span @mouseenter="(event) => handleItemMouseEnter(event, group.questionType)
  34 + " @mouseleave="handleItemMouseLeave" :class="isItemHovered == group.questionType ? 'hover' : ''"
  35 + class="size-16" @click="groupEditing(index)" v-show="!group.input">{{ group.questionTitle }}</span>
  36 +
  37 + <el-input :ref="'refInput' + index" class="size-16" size="mini" v-show="group.input"
  38 + v-model="group.questionTitle" @blur="groupSave(index)" @keyup.enter.native="groupSave(index)"
  39 + style="width: fit-content" />
  40 + <div v-if="isItemHovered == group.questionType" class="tooltip" :style="{
  41 + top: tooltipPosition.y + 'px',
  42 + left: tooltipPosition.x + 'px',
  43 + }">
98 44 单击设置试卷标题
99 45 </div>
100 46  
101   - <span
102   - v-if="group.subQuestionIds"
103   - class="size-16"
104   - style="margin-left: 10px"
105   - >(共{{ group.subQuestionIds.length }}题 / 共{{
  47 + <span v-if="group.subQuestionIds" class="size-16" style="margin-left: 10px">(共{{
  48 + group.subQuestionIds.length }}题 / 共{{
106 49 group.questionScore * group.subQuestionIds.length
107   - }}分)</span
108   - >
  50 + }}分)</span>
109 51 </div>
110 52 </div>
111 53  
112 54 <!-- 内部的题目列表,允许组内排序 -->
113   - <div
114   - style="display: flex"
115   - v-for="question in group.subQuestionIds"
116   - :key="question.id"
117   - :class="{
118   - border: selectedItemIndex === question.id,
119   - }"
120   - @mouseenter="handleGroupMouseEnter(question.id, 'number')"
121   - @mouseleave="handleGroupMouseLeave"
122   - class="inner-item"
123   - >
124   - <div
125   - v-if="selectedItemIndex === question.id"
126   - class="border-del"
127   - @click="handleDel(question.id, group.questionType)"
128   - >
  55 + <div style="display: flex" v-for="question in group.subQuestionIds" :key="question.id" :class="{
  56 + border: selectedItemIndex === question.id,
  57 + }" @mouseenter="handleGroupMouseEnter(question.id, 'number')" @mouseleave="handleGroupMouseLeave"
  58 + class="inner-item">
  59 + <div v-if="selectedItemIndex === question.id" class="border-del"
  60 + @click="handleDel(question.id, group.questionType)">
129 61 删除
130 62 </div>
131 63 <div class="size color" style="margin-top: 20px">
132   - <div
133   - style="max-width: 100px; white-space: nowrap; /* 不换行 */"
134   - >
  64 + <div style="max-width: 100px; white-space: nowrap; /* 不换行 */">
135 65 {{ question.globalIndex }}、
136 66 </div>
137 67 </div>
138 68  
139   - <iframe
140   - :src="question.screenshot"
141   - :ref="'iframe' + question.id"
142   - @load="onIFrameLoad(question.id)"
143   - style="
  69 + <iframe :src="question.screenshot" :ref="'iframe' + question.id" @load="onIFrameLoad(question.id)" style="
144 70 width: 100%;
145 71 pointer-events: none;
146 72 border: none; /* 启用点击穿透 */
147   - "
148   - ></iframe>
  73 + "></iframe>
149 74 </div>
150 75 </div>
151 76 </div>
... ... @@ -153,43 +78,23 @@
153 78 <div class="edit">
154 79 <div class="edit-title">
155 80 <div class="edit-title-info">
156   - 共<span>{{ list.length }}</span
157   - >小题,卷面分<span>{{ sumValues() }}</span
158   - >分
  81 + 共<span>{{ list.length }}</span>小题,卷面分<span>{{ sumValues() }}</span>分
159 82 </div>
160 83 <div class="edit-button">
161   - <el-button class="button-width" type="primary" @click="handleSava"
162   - >保存试卷</el-button
163   - >
164   - <el-button class="button-width" plain @click="handleSava('print')"
165   - >保存并打印</el-button
166   - >
167   - <el-button
168   - class="button-width"
169   - type="danger"
170   - plain
171   - @click="handleClear"
172   - >清空题目</el-button
173   - >
174   - <el-button class="button-width" plain @click="handleSelect"
175   - >继续选题</el-button
176   - >
  84 + <el-button class="button-width" type="primary" @click="handleSava">保存试卷</el-button>
  85 + <el-button class="button-width" plain @click="handleSava('print')">保存并打印</el-button>
  86 + <el-button class="button-width" type="danger" plain @click="handleClear">清空题目</el-button>
  87 + <el-button class="button-width" plain @click="handleSelect">继续选题</el-button>
177 88 </div>
178 89 </div>
179 90 <div class="edit-info">
180 91 <div class="title size color" style="padding: 15px 0 0 10px">
181 92 题目排序
182   - <span class="title size" style="color: #999999"
183   - >(拖拽题号可拖拽排序)</span
184   - >
  93 + <span class="title size" style="color: #999999">(拖拽题号可拖拽排序)</span>
185 94 </div>
186 95 <!-- 外层容器,允许拖拽整个组 -->
187 96 <draggable v-model="groups" group="groups" @end="onEnd">
188   - <div
189   - v-for="(group, index) in groups"
190   - :key="group.id"
191   - class="group-item"
192   - >
  97 + <div v-for="(group, index) in groups" :key="group.id" class="group-item">
193 98 <!-- 每个组的标题 -->
194 99 <div class="group-title">
195 100 <div class="size" style="font-weight: 600">
... ... @@ -197,28 +102,14 @@
197 102 </div>
198 103 <div class="size">
199 104 单题分值:
200   - <el-input-number
201   - size="mini"
202   - v-model="group.questionScore"
203   - :min="1"
204   - :max="30"
205   - style="width: 100px"
206   - ></el-input-number>
  105 + <el-input-number size="mini" v-model="group.questionScore" :min="1" :max="30"
  106 + style="width: 100px"></el-input-number>
207 107 </div>
208 108 </div>
209 109  
210 110 <!-- 内部的题目列表,允许组内排序 -->
211   - <draggable
212   - class="questions"
213   - v-model="group.subQuestionIds"
214   - group="questions"
215   - @end="onItemEnd(group)"
216   - >
217   - <div
218   - v-for="question in group.subQuestionIds"
219   - :key="question.id"
220   - class="question-item"
221   - >
  111 + <draggable class="questions" v-model="group.subQuestionIds" group="questions" @end="onItemEnd(group)">
  112 + <div v-for="question in group.subQuestionIds" :key="question.id" class="question-item">
222 113 {{ question.globalIndex }}
223 114 </div>
224 115 </draggable>
... ... @@ -234,6 +125,7 @@
234 125 <script>
235 126 import { number } from "echarts";
236 127 import draggable from "vuedraggable";
  128 +import { paperPrint } from "@/utils";
237 129 export default {
238 130 components: { draggable },
239 131 name: "wrongQuestionDialog",
... ... @@ -665,7 +557,11 @@ export default {
665 557 this.$emit("setQuestions");
666 558 this.handleClose();
667 559 if (type) {
668   - console.log(123);
  560 + this.$request.tPaperDetail({
  561 + paperId: res.data
  562 + }).then(detail => {
  563 + paperPrint(detail.data);
  564 + });
669 565 }
670 566 }
671 567 });
... ... @@ -708,9 +604,11 @@ export default {
708 604 .title {
709 605 font-weight: 600;
710 606 }
  607 +
711 608 .test-box {
712 609 display: flex;
713 610 min-height: 742px;
  611 +
714 612 .test {
715 613 flex: 1;
716 614 height: fit-content;
... ... @@ -720,6 +618,7 @@ export default {
720 618 margin-right: 20px;
721 619 box-sizing: border-box;
722 620 padding: 0 20px;
  621 +
723 622 .test-title {
724 623 font-size: 20px !important;
725 624 font-weight: 700;
... ... @@ -737,6 +636,7 @@ export default {
737 636 justify-content: space-around;
738 637 align-items: center;
739 638 }
  639 +
740 640 .test-group {
741 641 .test-group-title {
742 642 position: relative;
... ... @@ -746,14 +646,17 @@ export default {
746 646 }
747 647 }
748 648 }
  649 +
749 650 .edit {
750 651 width: 400px;
751 652 display: flex;
752 653 flex-direction: column;
  654 +
753 655 .edit-title {
754 656 width: 100%;
755 657 height: 200px;
756 658 border: 1px solid #999999;
  659 +
757 660 .edit-title-info {
758 661 height: 60px;
759 662 width: 100%;
... ... @@ -762,22 +665,26 @@ export default {
762 665 font-size: 16px !important;
763 666 line-height: 60px;
764 667 color: #000000;
  668 +
765 669 span {
766 670 color: rgb(234, 163, 73);
767 671 }
768 672 }
  673 +
769 674 .edit-button {
770 675 box-sizing: border-box;
771 676 padding: 0 20px;
772 677 display: flex;
773 678 flex-wrap: wrap;
774 679 justify-content: space-around;
  680 +
775 681 .button-width {
776 682 width: 160px !important;
777 683 margin: 10px 0;
778 684 }
779 685 }
780 686 }
  687 +
781 688 .edit-info {
782 689 flex: 1;
783 690 border: 1px solid #999999;
... ... @@ -785,10 +692,12 @@ export default {
785 692 max-height: 500px;
786 693 padding: 10px;
787 694 overflow: auto;
  695 +
788 696 .group-item {
789 697 margin: 10px;
790 698 background: rgba(243, 243, 243, 0.6);
791 699 border-radius: 5px;
  700 +
792 701 .group-title {
793 702 display: flex;
794 703 align-items: center;
... ... @@ -797,9 +706,11 @@ export default {
797 706 cursor: pointer;
798 707 }
799 708 }
  709 +
800 710 .questions {
801 711 display: flex;
802 712 flex-wrap: wrap;
  713 +
803 714 .question-item {
804 715 width: 35px;
805 716 height: 35px;
... ... @@ -819,25 +730,31 @@ export default {
819 730 }
820 731 }
821 732 }
  733 +
822 734 .size {
823 735 font-size: 14px !important;
824 736 }
  737 +
825 738 .color {
826 739 color: #000000;
827 740 }
  741 +
828 742 .size-16 {
829 743 font-size: 16px !important;
830 744 font-weight: 600;
831 745 color: #333333;
832 746 }
  747 +
833 748 ::v-deep {
834 749 .el-dialog {
835 750 margin-top: 10vh !important;
836 751 }
837 752 }
  753 +
838 754 .border {
839 755 border: 1px solid rgb(173, 190, 250);
840 756 position: relative;
  757 +
841 758 .border-del {
842 759 position: absolute;
843 760 top: -30px;
... ... @@ -853,11 +770,13 @@ export default {
853 770 cursor: pointer;
854 771 }
855 772 }
  773 +
856 774 .outer-item,
857 775 .inner-item {
858 776 height: fit-content;
859 777 margin-bottom: 20px;
860 778 }
  779 +
861 780 .tooltip {
862 781 position: absolute;
863 782 background: rgba(0, 0, 0, 0.7);
... ... @@ -866,11 +785,13 @@ export default {
866 785 border-radius: 5px;
867 786 font-size: 12px !important;
868 787 }
  788 +
869 789 .hover {
870 790 border: 1px solid rgb(115, 142, 246);
871 791 background: rgb(233, 237, 253);
872 792 width: fit-content;
873 793 }
  794 +
874 795 .title-bg {
875 796 background: rgb(115, 142, 246);
876 797 border-bottom: 1px solid rgb(115, 142, 246);
... ...
src/views/basic/askTestQuestion/update.vue
... ... @@ -4,7 +4,7 @@
4 4 <back-box class="detailBack">
5 5 <template slot="title">
6 6 <span class="default-title">
7   - {{ isViewer ? "详情" : type == 1 ? paperType == 1 ? "修改课件" : "修改试卷" : "修改答案" }}</span>
  7 + {{ isViewer && !isWrong ? "详情" : type == 1 ? paperType == 1 ? "修改课件" : "修改试卷" : "修改答案" }}</span>
8 8 </template>
9 9 </back-box>
10 10 </el-header>
... ... @@ -21,12 +21,13 @@
21 21 <div class="answer-title" :class="type == 1 ? 't-left' : ''">
22 22 <p class="name-box">
23 23 <span>试卷名称:</span>
24   - <el-input :disabled="isViewer" class="ipt-name" v-model="form.title"></el-input>
  24 + <el-input :disabled="isViewer && !isWrong" class="ipt-name" v-model="form.title"></el-input>
25 25 </p>
26 26 <p class="name-box">
27 27 <span>分享范围:</span>
28   - <el-radio :disabled="isViewer" class="name-radio" v-model="form.sharingType" :label="0">任课班级分享</el-radio>
29   - <el-radio :disabled="isViewer" class="name-radio" @click.native="_selectClassSharingType"
  28 + <el-radio :disabled="isViewer && !isWrong" class="name-radio" v-model="form.sharingType"
  29 + :label="0">任课班级分享</el-radio>
  30 + <el-radio :disabled="isViewer && !isWrong" class="name-radio" @click.native="_selectClassSharingType"
30 31 v-model="form.sharingType" :label="1">自定义分享班级</el-radio>
31 32 </p>
32 33 </div>
... ... @@ -47,7 +48,7 @@
47 48 <div class="bigQuestionTitle" v-if="paperType != 1">
48 49 {{ question.questionTitle }}
49 50 (共{{ question.subQuestions.filter(subQuestion => subQuestion &&
50   - subQuestion.questionIndex && subQuestion.questionType).length }}小题,
  51 + subQuestion.questionIndex && subQuestion.questionType).length }}小题,
51 52 共{{ question.score }}分)
52 53 </div>
53 54 <div v-if="paperType == 2 && index == 0" class="courseware-title sub-questions">
... ... @@ -61,7 +62,7 @@
61 62 </div>
62 63  
63 64 <div class="courseware-content sub-questions" v-if="subQuestion &&
64   - subQuestion.questionIndex && subQuestion.questionType && question.subQuestions"
  65 + subQuestion.questionIndex && subQuestion.questionType && question.subQuestions"
65 66 v-for="(subQuestion, subIndex) in question.subQuestions">
66 67 <div class="qs-num">{{ subQuestion.questionIndex }}</div>
67 68 <div class="qs-stem">
... ... @@ -74,8 +75,8 @@
74 75 </el-select>
75 76 </div>
76 77 <div class="qs-score">
77   - <el-input-number :disabled="isViewer" class="number-ipt" size="medium" :min="1" :max="200"
78   - :precision="2" :step="1" v-model="subQuestion.score" label="单题分值" />
  78 + <el-input-number :disabled="isViewer && !isWrong" class="number-ipt" size="medium" :min="1"
  79 + :max="200" :precision="2" :step="1" v-model="subQuestion.score" label="单题分值" />
79 80 </div>
80 81 <div class="qs-partScore">
81 82 <p v-if="subQuestion.questionType != 3">------</p>
... ... @@ -103,7 +104,7 @@
103 104 @click="changAnswer(subQuestion, option)">{{ option }}</span>
104 105 <span v-if="option && isViewer" class="answer-s"
105 106 :class="subQuestion.correctAnswer.includes(option) ? 'answer-active' : ''" :key="option">{{
106   - option }}</span>
  107 + option }}</span>
107 108 </template>
108 109 <span class="answer-s answer-opration" v-if="!isViewer"
109 110 @click="openStem(subQuestion, 4, index, subIndex)">+</span>
... ... @@ -117,7 +118,7 @@
117 118 @click="subQuestion.correctAnswer = option">{{ option }}</span>
118 119 <span v-if="option && isViewer" class="answer-s"
119 120 :class="subQuestion.correctAnswer.includes(option) ? 'answer-active' : ''" :key="option">{{
120   - option }}</span>
  121 + option }}</span>
121 122 </template>
122 123 <span class="answer-s answer-opration" v-if="!isViewer"
123 124 @click="openStem(subQuestion, 4, index, subIndex)">+</span>
... ... @@ -156,8 +157,8 @@
156 157 </el-select>
157 158 </div>
158 159 <div class="qs-score">
159   - <el-input-number :disabled="isViewer" class="number-ipt" size="medium" :min="1" :max="200"
160   - :precision="2" :step="1" v-model="question.score" label="单题分值" />
  160 + <el-input-number :disabled="isViewer && !isWrong" class="number-ipt" size="medium" :min="1"
  161 + :max="200" :precision="2" :step="1" v-model="question.score" label="单题分值" />
161 162 </div>
162 163 <div class="qs-partScore">
163 164 <p v-if="question.questionType != 3">------</p>
... ... @@ -168,16 +169,16 @@
168 169 <p v-if="question.questionType == 5">--</p>
169 170 <p v-if="question.questionType == 4" class="answer-box">
170 171 <span class="answer-s" :class="question.correctAnswer == 1 ? 'answer-active' : ''
171   - " @click="question.correctAnswer = 1">✓</span>
  172 + " @click="question.correctAnswer = 1">✓</span>
172 173 <span class="answer-s" :class="question.correctAnswer == 2 ? 'answer-active' : ''
173   - " @click="question.correctAnswer = 2">✗</span>
  174 + " @click="question.correctAnswer = 2">✗</span>
174 175 </p>
175 176 <p v-if="question.questionType == 3" class="answer-box">
176 177 <template v-for="option in question.answerOptions.split(',')">
177 178 <span v-if="option" class="answer-s" :class="question.correctAnswer.includes(option)
178   - ? 'answer-active'
179   - : ''
180   - " :key="option" @click="changAnswer(question, option)">{{ option }}</span>
  179 + ? 'answer-active'
  180 + : ''
  181 + " :key="option" @click="changAnswer(question, option)">{{ option }}</span>
181 182 </template>
182 183 <span class="answer-s answer-opration" v-if="!isViewer"
183 184 @click="openStem(question, 4, index, 0)">+</span>
... ... @@ -187,9 +188,9 @@
187 188 <p v-if="question.questionType == 2" class="answer-box">
188 189 <template v-for="option in question.answerOptions.split(',')">
189 190 <span class="answer-s" v-if="option" :class="question.correctAnswer == option
190   - ? 'answer-active'
191   - : ''
192   - " :key="option" @click="question.correctAnswer = option">{{ option }}</span>
  191 + ? 'answer-active'
  192 + : ''
  193 + " :key="option" @click="question.correctAnswer = option">{{ option }}</span>
193 194 </template>
194 195 <span class="answer-s answer-opration" v-if="!isViewer"
195 196 @click="openStem(question, 4, index, 0)">+</span>
... ... @@ -225,7 +226,7 @@
225 226 :append-to-body="true">
226 227 <div :key="classSharingType">
227 228 <div class="row-subfix">
228   - <div >
  229 + <div>
229 230 <span class="line-subfix">年级:</span>
230 231 <span class="line-value">{{ gradeName }}</span>
231 232 </div>
... ... @@ -233,9 +234,10 @@
233 234 <div v-if="gradeClass.length >= 1" class="row-subfix"
234 235 style="margin-top: 20px;margin-bottom: 20px;overflow: auto">
235 236 <span class="line-subfix" style="float: left;">班级:</span>
236   - <div style="float: left;background:rgb(245,247,250);padding:15px 10px;width: calc(100% - 80px);border-radius:5px;">
  237 + <div
  238 + style="float: left;background:rgb(245,247,250);padding:15px 10px;width: calc(100% - 80px);border-radius:5px;">
237 239 <span class="line-value" style="min-height: 300px;border-radius: 4px; background: rgb(247,247,250);">
238   - <el-checkbox v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
  240 + <el-checkbox v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
239 241 <div>
240 242 <el-checkbox @change="handleCheckedClassChange" v-model="item.isChecked" :key="index"
241 243 v-for="(item, index) in gradeClass" :label="item.id">
... ... @@ -267,15 +269,15 @@
267 269 <p class="answer-box">
268 270 <template v-if="formAns.qusType == 4">
269 271 <span class="answer-s answer-active" @click="
270   - formAns.answerList.length < formAns.subNum
271   - ? (formAns.answerList += '✓')
272   - : ''
273   - ">✓</span>
  272 + formAns.answerList.length < formAns.subNum
  273 + ? (formAns.answerList += '✓')
  274 + : ''
  275 + ">✓</span>
274 276 <span class="answer-s answer-active" @click="
275   - formAns.answerList.length < formAns.subNum
276   - ? (formAns.answerList += '✗')
277   - : ''
278   - ">✗</span>
  277 + formAns.answerList.length < formAns.subNum
  278 + ? (formAns.answerList += '✗')
  279 + : ''
  280 + ">✗</span>
279 281 </template>
280 282 <template v-if="formAns.qusType == 3">
281 283 <span class="answer-s answer-active" v-for="option in formAns.answerOptions.split(',')" :key="option"
... ... @@ -285,10 +287,10 @@
285 287 <template v-if="formAns.qusType == 2">
286 288 <span class="answer-s answer-active" v-for="option in formAns.answerOptions.split(',')" :key="option"
287 289 @click="
288   - formAns.answerList.length < formAns.subNum
289   - ? (formAns.answerList += option)
290   - : ''
291   - ">{{ option }}</span>
  290 + formAns.answerList.length < formAns.subNum
  291 + ? (formAns.answerList += option)
  292 + : ''
  293 + ">{{ option }}</span>
292 294 </template>
293 295 <span class="answer-s delButton" @click="formAns.answerList = formAns.answerList.slice(0, -1)">x</span>
294 296 <span class="answer-s ac" @click="formAns.answerList = ''">ac</span>
... ... @@ -350,6 +352,7 @@ export default {
350 352 gradeClass: [],
351 353 subjectName: "",
352 354 isViewer: false,
  355 + isWrong: false,
353 356 isIndeterminate: true,
354 357 type: 1, //1:答题卡 2:即时测报表题目列表 3:课时题目列表
355 358 questionList: [],
... ... @@ -501,7 +504,7 @@ export default {
501 504 },
502 505 async _selectClassSharingType() {
503 506  
504   - if (this.isViewer) return;
  507 + if (this.isViewer && !this.isWrong) return;
505 508  
506 509 this.gradeClass = [];
507 510  
... ... @@ -522,7 +525,7 @@ export default {
522 525 }
523 526 })];
524 527  
525   - this.checkAll = this.checkedClass.length === this.gradeClass.length;
  528 + this.checkAll = this.checkedClass.length === this.gradeClass.length;
526 529 },
527 530 // v1.5
528 531 //上传截图
... ... @@ -996,8 +999,11 @@ export default {
996 999 return a.questionIndex - b.questionIndex;
997 1000 });
998 1001 }
  1002 + if (data.tag == "错题复习" && this.isViewer == false) {
  1003 + this.isViewer = true;
  1004 + this.isWrong = true;
  1005 + }
999 1006 this.questionList = questionList;
1000   - console.log(this.questionList)
1001 1007 this.formateQuestion();
1002 1008 this.checkedClass = data.classList?.map(item => item.classId);
1003 1009 } else {
... ...
src/views/examinationPaper/add.vue
... ... @@ -11,17 +11,18 @@
11 11 :modal-append-to-body="false" :append-to-body="true">
12 12 <div :key="classSharingType">
13 13 <div class="row-subfix">
14   - <div >
  14 + <div>
15 15 <span class="line-subfix">年级:</span>
16 16 <span class="line-value">{{ gradeName }}</span>
17 17 </div>
18 18 </div>
19   - <div v-if="shareClass.length >= 1" class="row-subfix" style="margin-top: 20px;margin-bottom: 20px;overflow: auto">
  19 + <div v-if="shareClass.length >= 1" class="row-subfix"
  20 + style="margin-top: 20px;margin-bottom: 20px;overflow: auto">
20 21 <span class="line-subfix" style="float: left;">班级:</span>
21   - <div style="float: left;
  22 + <div style="float: left;
22 23 background:rgb(245,247,250);padding:15px 10px;width: calc(100% - 80px);border-radius:5px;">
23 24 <span class="line-value" style="min-height: 300px;border-radius: 4px; background: rgb(247,247,250);">
24   - <el-checkbox v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
  25 + <el-checkbox v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
25 26 <div>
26 27 <el-checkbox @change="handleCheckedClassChange" v-model="item.isChecked" :key="index"
27 28 v-for="(item, index) in shareClass" :label="item.id">
... ... @@ -54,7 +55,7 @@
54 55 <el-select v-model="form.tagId" placeholder="选择测验类型">
55 56 <el-option label="--" value=""> </el-option>
56 57 <el-option v-for="item in answerTypeList" :key="item.id" :label="item.typeName" :value="item.id">{{
57   - item.typeName }}</el-option>
  58 + item.typeName }}</el-option>
58 59 </el-select>
59 60 <el-button class="ml-20" type="primary" round circle icon="el-icon-edit" @click="openTagDia"></el-button>
60 61 </el-form-item>
... ... @@ -67,8 +68,8 @@
67 68 <el-form-item label="科目:" prop="subjectName">
68 69 <el-select class="sel" v-model="form.subjectName" placeholder="">
69 70 <el-option v-for="item in subjectList" :key="item.value" :label="item.label" :value="item.value">{{
70   - item.label
71   - }}
  71 + item.label
  72 + }}
72 73 </el-option>
73 74 </el-select>
74 75 </el-form-item>
... ... @@ -91,17 +92,17 @@
91 92 <div class="dia-content">
92 93 <p class="add-type" v-for="item in tagList" :key="item.id">
93 94 <el-row :gutter="10">
94   - <el-col :span="18"><el-input v-model="item.typeName" :maxlength="10"
  95 + <el-col :span="18"><el-input :disabled="item.typeName == '错题复习'" v-model="item.typeName" :maxlength="10"
95 96 placeholder="请输入答题卡类型名称"></el-input></el-col>
96 97 <el-col :span="6">
97 98 <el-tooltip effect="dark" content="保存" placement="top">
98   - <el-button class="js-set" type="primary" size="small" round circle icon="el-icon-check"
99   - @click="editTypeName(item)"></el-button>
  99 + <el-button v-if="item.typeName != '错题复习'" class="js-set" type="primary" size="small" round circle
  100 + icon="el-icon-check" @click="editTypeName(item)"></el-button>
100 101 </el-tooltip>
101 102 <el-tooltip effect="dark" content="删除" placement="right">
102 103 <el-popconfirm title="确定删除这道大题吗?" @confirm="removeTypeName(item)">
103   - <el-button class="js-set" type="danger" size="small" round circle icon="el-icon-delete"
104   - slot="reference"></el-button>
  104 + <el-button v-if="item.typeName != '错题复习'" class="js-set" type="danger" size="small" round circle
  105 + icon="el-icon-delete" slot="reference"></el-button>
105 106 </el-popconfirm>
106 107 </el-tooltip>
107 108 </el-col>
... ... @@ -181,27 +182,27 @@
181 182 <p v-if="subQuestions.questionType == 5">--</p>
182 183 <p v-if="subQuestions.questionType == 4" class="answer-box">
183 184 <span class="answer-s" :class="subQuestions.correctAnswer == 1 ? 'active' : ''
184   - " @click="subQuestions.correctAnswer = 1">✓</span>
  185 + " @click="subQuestions.correctAnswer = 1">✓</span>
185 186 <span class="answer-s" :class="subQuestions.correctAnswer == 2 ? 'active' : ''
186   - " @click="subQuestions.correctAnswer = 2">✗</span>
  187 + " @click="subQuestions.correctAnswer = 2">✗</span>
187 188 </p>
188 189 <p v-if="subQuestions.questionType == 3" class="answer-box">
189 190 <span class="answer-s" v-for="option in subQuestions.answerOptions.split(
190   - ','
191   - )" :class="subQuestions.correctAnswer ? subQuestions.correctAnswer.includes(option)
192   - ? 'active'
193   - : '' : ''
194   - " :key="option" @click="changAnswer(subQuestions, option)">{{ option }}</span>
  191 + ','
  192 + )" :class="subQuestions.correctAnswer ? subQuestions.correctAnswer.includes(option)
  193 + ? 'active'
  194 + : '' : ''
  195 + " :key="option" @click="changAnswer(subQuestions, option)">{{ option }}</span>
195 196 </p>
196 197 <p v-if="subQuestions.questionType == 2" class="answer-box">
197 198 <span class="answer-s" v-for="option in subQuestions.answerOptions.split(
198   - ','
199   - )" :class="subQuestions.correctAnswer == option ? 'active' : ''
200   - " :key="option" @click="subQuestions.correctAnswer = option">{{ option }}</span>
  199 + ','
  200 + )" :class="subQuestions.correctAnswer == option ? 'active' : ''
  201 + " :key="option" @click="subQuestions.correctAnswer = option">{{ option }}</span>
201 202 </p>
202 203 <p v-if="subQuestions.questionType == 3 ||
203   - subQuestions.questionType == 2
204   - " class="answer-box answer-box2">
  204 + subQuestions.questionType == 2
  205 + " class="answer-box answer-box2">
205 206 <el-button size="mini" type="primary" icon="el-icon-plus" circle
206 207 @click="addOptions(subQuestions)"></el-button>
207 208 <el-button size="mini" type="primary" icon="el-icon-minus" round circle
... ... @@ -269,8 +270,8 @@
269 270 :step-strictly="true" :step="1" label="label"></el-input-number>
270 271 </el-form-item>
271 272 <el-form-item label="选项个数:" v-show="questionForm.questionType != 4 &&
272   - questionForm.questionType != 5
273   - ">
  273 + questionForm.questionType != 5
  274 + ">
274 275 <el-input-number v-model="questionForm.selectNum" :min="3" :max="10" :step-strictly="true" :step="1"
275 276 label="label"></el-input-number>
276 277 </el-form-item>
... ... @@ -283,33 +284,33 @@
283 284 :step="0.5" label="label"></el-input-number>
284 285 </el-form-item>
285 286 <el-form-item label="设置答案:" v-show="questionForm.questionType != 5 &&
286   - questionForm.questionType != 6
287   - ">
  287 + questionForm.questionType != 6
  288 + ">
288 289 <div class="qs-options">
289 290 <p class="ipt">
290 291 <el-input v-if="questionForm.questionType == 2 ||
291   - questionForm.questionType == 3 ||
292   - questionForm.questionType == 6
293   - " ref="formAnsIpt2" v-model="questionForm.answerList" @keydown.native="
294   - keydownAnswer($event, questionForm.questionType, 1)
295   - " @input="
296   - setAllAnswer($event, questionForm.questionType, 1)
297   - "></el-input>
  292 + questionForm.questionType == 3 ||
  293 + questionForm.questionType == 6
  294 + " ref="formAnsIpt2" v-model="questionForm.answerList" @keydown.native="
  295 + keydownAnswer($event, questionForm.questionType, 1)
  296 + " @input="
  297 + setAllAnswer($event, questionForm.questionType, 1)
  298 + "></el-input>
298 299 <el-input v-if="questionForm.questionType == 4" v-model="questionForm.answerList"
299 300 readonly=""></el-input>
300 301 </p>
301 302 <p class="answer-box">
302 303 <template v-if="questionForm.questionType == 4">
303 304 <span class="answer-s active" @click="
304   - questionForm.answerList.length < questionForm.number
305   - ? (questionForm.answerList += '✓')
306   - : ''
307   - ">✓</span>
  305 + questionForm.answerList.length < questionForm.number
  306 + ? (questionForm.answerList += '✓')
  307 + : ''
  308 + ">✓</span>
308 309 <span class="answer-s active" @click="
309   - questionForm.answerList.length < questionForm.number
310   - ? (questionForm.answerList += '✗')
311   - : ''
312   - ">✗</span>
  310 + questionForm.answerList.length < questionForm.number
  311 + ? (questionForm.answerList += '✗')
  312 + : ''
  313 + ">✗</span>
313 314 </template>
314 315 <template v-if="questionForm.questionType == 3">
315 316 <template v-for="(option, opIdx) in rightOptions">
... ... @@ -319,21 +320,21 @@
319 320 <span class="answer-s active" @click="setMultiple(questionForm, ',', 1)">,</span>
320 321 </template>
321 322 <template v-if="questionForm.questionType == 2 ||
322   - questionForm.questionType == 6
323   - ">
  323 + questionForm.questionType == 6
  324 + ">
324 325 <template v-for="(option, opIdx) in rightOptions">
325 326 <span v-if="opIdx < questionForm.selectNum" class="answer-s active" :key="option" @click="
326   - questionForm.answerList.length <
327   - questionForm.number
328   - ? (questionForm.answerList += option)
329   - : ''
330   - ">{{ option }}</span>
  327 + questionForm.answerList.length <
  328 + questionForm.number
  329 + ? (questionForm.answerList += option)
  330 + : ''
  331 + ">{{ option }}</span>
331 332 </template>
332 333 </template>
333 334 <span class="answer-s delButton" @click="
334   - questionForm.answerList =
335   - questionForm.answerList.slice(0, -1)
336   - ">x</span>
  335 + questionForm.answerList =
  336 + questionForm.answerList.slice(0, -1)
  337 + ">x</span>
337 338 <span class="answer-s ac" @click="questionForm.answerList = ''">ac</span>
338 339 </p>
339 340 </div>
... ... @@ -377,9 +378,9 @@
377 378 </li>
378 379 <li v-for="(subQuestions, indexs) in question.subQuestions" :key="indexs">
379 380 <p class="set-ans-btn" v-if="subQuestions.qusType &&
380   - subQuestions.subNum &&
381   - subQuestions.subNum > 4
382   - ">
  381 + subQuestions.subNum &&
  382 + subQuestions.subNum > 4
  383 + ">
383 384 <el-button type="primary" @click="setFormAns(indexs, index)">批量设置答案</el-button>
384 385 </p>
385 386 <div v-else class="sub-questions">
... ... @@ -388,10 +389,10 @@
388 389 </div>
389 390 <div class="qs-type">
390 391 <el-select v-model="subQuestions.questionType" placeholder="选择题目类型"
391   - @change="changeSubQuestions($event, subQuestions)">
392   - <el-option v-for="options in questionOptions" :key="options.value" :label="options.label"
393   - :value="options.value"></el-option>
394   - </el-select>
  392 + @change="changeSubQuestions($event, subQuestions)">
  393 + <el-option v-for="options in questionOptions" :key="options.value" :label="options.label"
  394 + :value="options.value"></el-option>
  395 + </el-select>
395 396 </div>
396 397 <div class="qs-score">
397 398 <el-input-number class="number-ipt" size="medium" :min="1" :max="200" :precision="2"
... ... @@ -413,17 +414,17 @@
413 414 </p>
414 415 <p v-if="subQuestions.questionType == 3" class="answer-box">
415 416 <span class="answer-s" v-for="option in subQuestions.answerOptions.split(',')" :class="subQuestions.correctAnswer?.includes(option)
416   - ? 'active'
417   - : ''
418   - " :key="option" @click="changAnswer(subQuestions, option)">{{ option }}</span>
  417 + ? 'active'
  418 + : ''
  419 + " :key="option" @click="changAnswer(subQuestions, option)">{{ option }}</span>
419 420 </p>
420 421 <p v-if="subQuestions.questionType == 2" class="answer-box">
421 422 <span class="answer-s" v-for="option in subQuestions.answerOptions.split(',')" :class="subQuestions.correctAnswer == option ? 'active' : ''
422   - " :key="option" @click="subQuestions.correctAnswer = option">{{ option }}</span>
  423 + " :key="option" @click="subQuestions.correctAnswer = option">{{ option }}</span>
423 424 </p>
424 425 <p v-if="subQuestions.questionType == 3 ||
425   - subQuestions.questionType == 2
426   - " class="answer-box answer-box2">
  426 + subQuestions.questionType == 2
  427 + " class="answer-box answer-box2">
427 428 <el-button size="mini" type="primary" icon="el-icon-plus" circle
428 429 @click="addOptions(subQuestions)"></el-button>
429 430 <el-button size="mini" type="primary" icon="el-icon-minus" round circle
... ... @@ -470,15 +471,15 @@
470 471 <p class="answer-box">
471 472 <template v-if="formAns.qusType == 4">
472 473 <span class="answer-s active" @click="
473   - formAns.answerList.length < formAns.subNum
474   - ? (formAns.answerList += '✓')
475   - : ''
476   - ">✓</span>
  474 + formAns.answerList.length < formAns.subNum
  475 + ? (formAns.answerList += '✓')
  476 + : ''
  477 + ">✓</span>
477 478 <span class="answer-s active" @click="
478   - formAns.answerList.length < formAns.subNum
479   - ? (formAns.answerList += '✗')
480   - : ''
481   - ">✗</span>
  479 + formAns.answerList.length < formAns.subNum
  480 + ? (formAns.answerList += '✗')
  481 + : ''
  482 + ">✗</span>
482 483 </template>
483 484 <template v-if="formAns.qusType == 3">
484 485 <span class="answer-s active" v-for="option in formAns.answerOptions.split(',')" :key="option"
... ... @@ -487,10 +488,10 @@
487 488 </template>
488 489 <template v-if="formAns.qusType == 2">
489 490 <span class="answer-s active" v-for="option in formAns.answerOptions.split(',')" :key="option" @click="
490   - formAns.answerList.length < formAns.subNum
491   - ? (formAns.answerList += option)
492   - : ''
493   - ">{{ option }}</span>
  491 + formAns.answerList.length < formAns.subNum
  492 + ? (formAns.answerList += option)
  493 + : ''
  494 + ">{{ option }}</span>
494 495 </template>
495 496 <span class="answer-s delButton" @click="formAns.answerList = formAns.answerList.slice(0, -1)">x</span>
496 497 <span class="answer-s ac" @click="formAns.answerList = ''">ac</span>
... ... @@ -806,7 +807,7 @@ export default {
806 807 },
807 808 handleCheckedClassChange(value) {
808 809 var value = this.shareClass.filter(item => item.isChecked);
809   - var checkedCount = value.length;
  810 + var checkedCount = value.length;
810 811 this.checkAll = checkedCount === this.shareClass.length;
811 812 this.isIndeterminate = checkedCount > 0 && checkedCount < this.shareClass.length;
812 813 },
... ... @@ -1269,9 +1270,9 @@ export default {
1269 1270 id: item.id,
1270 1271 className: item.className
1271 1272 }
1272   - })];
  1273 + })];
1273 1274  
1274   - this.checkAll = this.checkedClass.length == this.shareClass.length;
  1275 + this.checkAll = this.checkedClass.length == this.shareClass.length;
1275 1276 },
1276 1277 openQuestion() {
1277 1278 this.questionForm = { ...questionForm };
... ... @@ -1491,7 +1492,7 @@ export default {
1491 1492 this.$message.error(info);
1492 1493 }
1493 1494 },
1494   - async addPaperType() {
  1495 + async addPaperType(type) {
1495 1496 //保存测验类型
1496 1497 if (!this.answerTypeName) {
1497 1498 this.$message.error("请填写测验名称!");
... ... @@ -1518,9 +1519,11 @@ export default {
1518 1519 if (status == 0) {
1519 1520 await this._TypeList();
1520 1521 this.tagList = deepClone(this.answerTypeList);
1521   - this.form.tagId = data || "";
1522 1522 this.answerTypeName = "";
1523   - this.$message.success("添加成功");
  1523 + if (type != -1) {
  1524 + this.form.tagId = data || "";
  1525 + this.$message.success("添加成功");
  1526 + }
1524 1527 } else {
1525 1528 this.$message.error(info);
1526 1529 }
... ... @@ -1591,13 +1594,21 @@ export default {
1591 1594 type: 1,
1592 1595 });
1593 1596 if (status == 0) {
  1597 + var hasWrongType = false;
1594 1598 this.answerTypeList =
1595 1599 data.list?.map((item) => {
  1600 + if (item.tag == '错题复习') {
  1601 + hasWrongType = true;
  1602 + }
1596 1603 return {
1597 1604 typeName: item.tag,
1598 1605 id: item.tagId,
1599 1606 };
1600 1607 }) || [];
  1608 + if (!hasWrongType) {
  1609 + this.answerTypeName = "错题复习";
  1610 + await this.addPaperType(-1);
  1611 + }
1601 1612 // if (this.type != 2) {
1602 1613 // this.form.tagId = this.answerTypeList[0]?.id || "";
1603 1614 // }
... ...