Commit 47e919133345e7f26f070bc2e1561b1a8141dbdd
1 parent
d8f38eeb
feat: 代码提交
Showing
2 changed files
with
193 additions
and
60 deletions
src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue
| 1 | 1 | <template> |
| 2 | - <el-dialog :visible.sync="visible" width="70%" :before-close="handleClose" :modal-append-to-body="false"> | |
| 2 | + <el-dialog | |
| 3 | + :visible.sync="visible" | |
| 4 | + width="70%" | |
| 5 | + :before-close="handleClose" | |
| 6 | + :modal-append-to-body="false" | |
| 7 | + > | |
| 3 | 8 | <div class="test-box" v-if="groups"> |
| 4 | 9 | <div class="test"> |
| 5 | 10 | <div class="test-title" @click="enableEditing"> |
| 6 | - <div class="test-title" v-if="!isEditing" @mouseenter="handleMouseEnter" @mouseleave="handleMouseLeave" | |
| 7 | - :class="isHovered ? 'hover' : ''"> | |
| 11 | + <div | |
| 12 | + class="test-title" | |
| 13 | + v-if="!isEditing" | |
| 14 | + @mouseenter="handleMouseEnter" | |
| 15 | + @mouseleave="handleMouseLeave" | |
| 16 | + :class="isHovered ? 'hover' : ''" | |
| 17 | + > | |
| 8 | 18 | {{ inputValue }} |
| 9 | 19 | </div> |
| 10 | - <div v-if="isHovered" class="tooltip" :style="{ | |
| 11 | - top: tooltipPosition.y + 'px', | |
| 12 | - left: tooltipPosition.x + 'px', | |
| 13 | - }"> | |
| 20 | + <div | |
| 21 | + v-if="isHovered" | |
| 22 | + class="tooltip" | |
| 23 | + :style="{ | |
| 24 | + top: tooltipPosition.y + 'px', | |
| 25 | + left: tooltipPosition.x + 'px', | |
| 26 | + }" | |
| 27 | + > | |
| 14 | 28 | 单击设置试卷标题 |
| 15 | 29 | </div> |
| 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" /> | |
| 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 | + /> | |
| 18 | 39 | </div> |
| 19 | 40 | <div class="test-group"> |
| 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')"> | |
| 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 | + > | |
| 25 | 56 | 删除 |
| 26 | 57 | </div> |
| 27 | 58 | <!-- 每个组的标题 --> |
| 28 | - <div class="test-group-title" :class="{ | |
| 29 | - border: selectedIndex == group.questionType, | |
| 30 | - }" @mouseenter="handleGroupMouseEnter(group.questionType, 'all')"> | |
| 59 | + <div | |
| 60 | + class="test-group-title" | |
| 61 | + :class="{ | |
| 62 | + border: selectedIndex == group.questionType, | |
| 63 | + }" | |
| 64 | + @mouseenter="handleGroupMouseEnter(group.questionType, 'all')" | |
| 65 | + > | |
| 31 | 66 | <div class="size-16" style="font-weight: 600"> |
| 32 | 67 | {{ index + 1 }}、 |
| 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 | - }"> | |
| 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 | + > | |
| 44 | 98 | 单击设置试卷标题 |
| 45 | 99 | </div> |
| 46 | 100 | |
| 47 | - <span v-if="group.subQuestionIds" class="size-16" style="margin-left: 10px">(共{{ | |
| 48 | - group.subQuestionIds.length }}题 / 共{{ | |
| 101 | + <span | |
| 102 | + v-if="group.subQuestionIds" | |
| 103 | + class="size-16" | |
| 104 | + style="margin-left: 10px" | |
| 105 | + >(共{{ group.subQuestionIds.length }}题 / 共{{ | |
| 49 | 106 | group.questionScore * group.subQuestionIds.length |
| 50 | - }}分)</span> | |
| 107 | + }}分)</span | |
| 108 | + > | |
| 51 | 109 | </div> |
| 52 | 110 | </div> |
| 53 | 111 | |
| 54 | 112 | <!-- 内部的题目列表,允许组内排序 --> |
| 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)"> | |
| 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 | + > | |
| 61 | 129 | 删除 |
| 62 | 130 | </div> |
| 63 | 131 | <div class="size color" style="margin-top: 20px"> |
| 64 | - <div style="max-width: 100px; white-space: nowrap; /* 不换行 */"> | |
| 132 | + <div | |
| 133 | + style="max-width: 100px; white-space: nowrap; /* 不换行 */" | |
| 134 | + > | |
| 65 | 135 | {{ question.globalIndex }}、 |
| 66 | 136 | </div> |
| 67 | 137 | </div> |
| 68 | 138 | |
| 69 | - <iframe :src="question.screenshot" :ref="'iframe' + question.id" @load="onIFrameLoad(question.id)" style=" | |
| 139 | + <iframe | |
| 140 | + :src="question.screenshot" | |
| 141 | + :ref="'iframe' + question.id" | |
| 142 | + @load="onIFrameLoad(question.id)" | |
| 143 | + style=" | |
| 70 | 144 | width: 100%; |
| 71 | 145 | pointer-events: none; |
| 72 | 146 | border: none; /* 启用点击穿透 */ |
| 73 | - "></iframe> | |
| 147 | + " | |
| 148 | + ></iframe> | |
| 74 | 149 | </div> |
| 75 | 150 | </div> |
| 76 | 151 | </div> |
| ... | ... | @@ -78,23 +153,43 @@ |
| 78 | 153 | <div class="edit"> |
| 79 | 154 | <div class="edit-title"> |
| 80 | 155 | <div class="edit-title-info"> |
| 81 | - 共<span>{{ list.length }}</span>小题,卷面分<span>{{ sumValues() }}</span>分 | |
| 156 | + 共<span>{{ list.length }}</span | |
| 157 | + >小题,卷面分<span>{{ sumValues() }}</span | |
| 158 | + >分 | |
| 82 | 159 | </div> |
| 83 | 160 | <div class="edit-button"> |
| 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> | |
| 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 | + > | |
| 88 | 177 | </div> |
| 89 | 178 | </div> |
| 90 | 179 | <div class="edit-info"> |
| 91 | 180 | <div class="title size color" style="padding: 15px 0 0 10px"> |
| 92 | 181 | 题目排序 |
| 93 | - <span class="title size" style="color: #999999">(拖拽题号可拖拽排序)</span> | |
| 182 | + <span class="title size" style="color: #999999" | |
| 183 | + >(拖拽题号可拖拽排序)</span | |
| 184 | + > | |
| 94 | 185 | </div> |
| 95 | 186 | <!-- 外层容器,允许拖拽整个组 --> |
| 96 | 187 | <draggable v-model="groups" group="groups" @end="onEnd"> |
| 97 | - <div v-for="(group, index) in groups" :key="group.id" class="group-item"> | |
| 188 | + <div | |
| 189 | + v-for="(group, index) in groups" | |
| 190 | + :key="group.id" | |
| 191 | + class="group-item" | |
| 192 | + > | |
| 98 | 193 | <!-- 每个组的标题 --> |
| 99 | 194 | <div class="group-title"> |
| 100 | 195 | <div class="size" style="font-weight: 600"> |
| ... | ... | @@ -102,14 +197,28 @@ |
| 102 | 197 | </div> |
| 103 | 198 | <div class="size"> |
| 104 | 199 | 单题分值: |
| 105 | - <el-input-number size="mini" v-model="group.questionScore" :min="1" :max="30" | |
| 106 | - style="width: 100px"></el-input-number> | |
| 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> | |
| 107 | 207 | </div> |
| 108 | 208 | </div> |
| 109 | 209 | |
| 110 | 210 | <!-- 内部的题目列表,允许组内排序 --> |
| 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"> | |
| 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 | + > | |
| 113 | 222 | {{ question.globalIndex }} |
| 114 | 223 | </div> |
| 115 | 224 | </draggable> |
| ... | ... | @@ -157,6 +266,13 @@ export default { |
| 157 | 266 | return null; |
| 158 | 267 | }, |
| 159 | 268 | }, |
| 269 | + sectionId: { | |
| 270 | + // 科目 | |
| 271 | + type: [String, Number], | |
| 272 | + default() { | |
| 273 | + return null; | |
| 274 | + }, | |
| 275 | + }, | |
| 160 | 276 | }, |
| 161 | 277 | data() { |
| 162 | 278 | return { |
| ... | ... | @@ -279,8 +395,9 @@ export default { |
| 279 | 395 | const iframeRef = this.$refs["iframe" + id][0]; // 获取对应的 iframe |
| 280 | 396 | const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; |
| 281 | 397 | const body = iframeRef.contentWindow.document.body; |
| 398 | + body.style.overflowX = "hidden"; // 不允许出现横向滚动条 | |
| 282 | 399 | const height = body.scrollHeight; // 获取内容的高度 |
| 283 | - iframeRef.style.height = `${height}px`; // 设置 iframe 的高度 | |
| 400 | + iframeRef.style.height = `${height + 20}px`; // 设置 iframe 的高度 | |
| 284 | 401 | // 获取第一个P标签 |
| 285 | 402 | const firstP = doc.getElementsByTagName("p")[0]; |
| 286 | 403 | // 或者修改第一个 < p > 标签的内容; |
| ... | ... | @@ -547,6 +664,7 @@ export default { |
| 547 | 664 | let param = { |
| 548 | 665 | paperTitle: this.inputValue, |
| 549 | 666 | subjectName: this.subjectName, |
| 667 | + sectionId: this.sectionId, | |
| 550 | 668 | gradeId: this.gradeId, |
| 551 | 669 | questions: this.groups.filter((item) => item.subQuestionIds.length > 0), |
| 552 | 670 | }; |
| ... | ... | @@ -559,11 +677,13 @@ export default { |
| 559 | 677 | this.$emit("setQuestions"); |
| 560 | 678 | this.handleClose(); |
| 561 | 679 | if (type) { |
| 562 | - this.$request.tPaperDetail({ | |
| 563 | - paperId: res.data | |
| 564 | - }).then(detail => { | |
| 565 | - paperPrint(detail.data); | |
| 566 | - }); | |
| 680 | + this.$request | |
| 681 | + .tPaperDetail({ | |
| 682 | + paperId: res.data, | |
| 683 | + }) | |
| 684 | + .then((detail) => { | |
| 685 | + paperPrint(detail.data); | |
| 686 | + }); | |
| 567 | 687 | } |
| 568 | 688 | } |
| 569 | 689 | }); | ... | ... |
src/views/basic/askTestQuestion/wrongQuestion.vue
| ... | ... | @@ -507,7 +507,11 @@ export default { |
| 507 | 507 | |
| 508 | 508 | // 获取科目列表 |
| 509 | 509 | async getSubject(params) { |
| 510 | + console.log(params, "params"); | |
| 511 | + | |
| 510 | 512 | let data = await this.$request.getSubjectList(params); |
| 513 | + console.log(data, "--------"); | |
| 514 | + | |
| 511 | 515 | this.subjectList = data.data.subjectNames; |
| 512 | 516 | this.formData.subjectName = this.subjectList[0]; |
| 513 | 517 | this.getClassList(); |
| ... | ... | @@ -515,10 +519,15 @@ export default { |
| 515 | 519 | // 获取年级列表 |
| 516 | 520 | async getGradeList() { |
| 517 | 521 | let data = await this.$request.getClassList(); |
| 522 | + console.log(data, "----------data"); | |
| 523 | + | |
| 518 | 524 | this.gradeList = Array.from( |
| 519 | - new Map(data.data.list.map((item) => [item.section, item])).values() | |
| 525 | + new Map(data.data.list.map((item) => [item.grade, item])).values() | |
| 520 | 526 | ); |
| 527 | + console.log(this.gradeList, "gradeList"); | |
| 528 | + | |
| 521 | 529 | this.formData.grade = this.gradeList[0].grade; |
| 530 | + this.formData.sectionId = this.gradeList[0].section; | |
| 522 | 531 | this.formData.gradeName = this.gradeList.find( |
| 523 | 532 | (itme) => itme.grade == this.formData.grade |
| 524 | 533 | ).gradeName; |
| ... | ... | @@ -539,9 +548,12 @@ export default { |
| 539 | 548 | }, |
| 540 | 549 | |
| 541 | 550 | // 年级改变 |
| 542 | - changeGrade() { | |
| 551 | + changeGrade(value) { | |
| 552 | + let item = this.gradeList.find((subItem) => subItem.grade == value); | |
| 553 | + this.formData.sectionId = item.section; | |
| 554 | + this.formData.gradeName = item.gradeName; | |
| 543 | 555 | this.queryLoading = true; |
| 544 | - this.getSubject(); | |
| 556 | + this.getSubject({ gradeName: this.formData.gradeName }); | |
| 545 | 557 | }, |
| 546 | 558 | // 科目改变 |
| 547 | 559 | changeSubject() { |
| ... | ... | @@ -569,6 +581,7 @@ export default { |
| 569 | 581 | const iframeRef = this.$refs["iframe" + index][0]; // 获取对应的 iframe |
| 570 | 582 | const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; |
| 571 | 583 | const body = iframeRef.contentWindow.document.body; |
| 584 | + body.style.overflowX = "hidden"; // 不允许出现横向滚动条 | |
| 572 | 585 | const height = body.scrollHeight; // 获取内容的高度 |
| 573 | 586 | iframeRef.style.height = `${height}px`; // 设置 iframe 的高度 |
| 574 | 587 | // 获取第一个P标签 | ... | ... |