Commit cb6ceaa8ef0af648a0a72fa3a7cde6d89b1e68b4
1 parent
3ca58022
添加备题,组卷参数调整
Showing
2 changed files
with
168 additions
and
43 deletions
src/views/examinationPaper/add.vue
... | ... | @@ -394,7 +394,9 @@ |
394 | 394 | v-if="subQuestions.screenshot && !subQuestions.screenshot.includes('html')" |
395 | 395 | :src="subQuestions.screenshot" alt=""> |
396 | 396 | <p style="textAlign:center"><el-button type="primary" round size="mini" icon="el-icon-upload" |
397 | - @click="openStem(subQuestions, index, indexs, 1)">{{subQuestions.answerScreenshot?"重新选择图片":"上传题干"}}</el-button></p> | |
397 | + @click="openStem(subQuestions, index, indexs, 1)">{{ subQuestions.answerScreenshot ? "重新选择图片" | |
398 | + : "上传题干" }}</el-button> | |
399 | + </p> | |
398 | 400 | </div> |
399 | 401 | <el-button slot="reference" class="icon-tickets" type="primary" circle size="mini" |
400 | 402 | icon="el-icon-tickets"></el-button> |
... | ... | @@ -410,7 +412,9 @@ |
410 | 412 | v-if="subQuestions.answerScreenshot && !subQuestions.answerScreenshot.includes('html')" |
411 | 413 | :src="subQuestions.answerScreenshot" alt=""> |
412 | 414 | <p style="textAlign:center"><el-button type="primary" round size="mini" icon="el-icon-upload" |
413 | - @click="openStem(subQuestions, index, indexs, 2)">{{subQuestions.answerScreenshot?"重新选择图片":"上传题目解析"}}</el-button></p> | |
415 | + @click="openStem(subQuestions, index, indexs, 2)">{{ subQuestions.answerScreenshot ? "重新选择图片" | |
416 | + : "上传题目解析" }}</el-button> | |
417 | + </p> | |
414 | 418 | </div> |
415 | 419 | <el-button slot="reference" class="icon-tickets" type="primary" circle size="mini" |
416 | 420 | icon="el-icon-tickets"></el-button> |
... | ... | @@ -542,7 +546,8 @@ |
542 | 546 | <el-form ref="form" :model="stem" label-width="160px"> |
543 | 547 | <el-form-item label="知识点:"> |
544 | 548 | <el-cascader size="small" filterable :show-all-levels="false" collapse clearable placeholder="选择知识点" |
545 | - v-model="stem.knowledge" :options="knowledgeData" :props="{ expandTrigger: 'hover' }"></el-cascader> | |
549 | + v-model="stem.knowledge" :options="knowledgeData" | |
550 | + :props="{ expandTrigger: 'hover', multiple: true }"></el-cascader> | |
546 | 551 | </el-form-item> |
547 | 552 | </el-form> |
548 | 553 | </div> |
... | ... | @@ -742,13 +747,7 @@ export default { |
742 | 747 | |
743 | 748 | this.dialogStem = true; |
744 | 749 | }, |
745 | - // 知识点 | |
746 | - openKnowledge(obj, index, indexs) { | |
747 | - this.stem.index = index; | |
748 | - this.stem.indexs = indexs; | |
749 | - this.stem.knowledge = (obj.knowledge && obj.knowledge.split(",")) || []; | |
750 | - this.dialogKnowledge = true; | |
751 | - }, | |
750 | + | |
752 | 751 | // 图片上传成功 |
753 | 752 | upSuccess(res) { |
754 | 753 | if (res && res.status == 0) { |
... | ... | @@ -767,11 +766,26 @@ export default { |
767 | 766 | upError(res) { |
768 | 767 | this.$message.error("上传失败"); |
769 | 768 | }, |
770 | - // 知识点 | |
769 | + // 打开知识点 | |
770 | + openKnowledge(obj, index, indexs) { | |
771 | + this.stem.index = index; | |
772 | + this.stem.indexs = indexs; | |
773 | + let knowledgeArr = (obj.knowledge && obj.knowledge.split(",")) || []; | |
774 | + console.log(obj.knowledge) | |
775 | + console.log(knowledgeArr) | |
776 | + this.stem.knowledge = knowledgeArr.map(item => { | |
777 | + return item.split("#") | |
778 | + }) | |
779 | + this.dialogKnowledge = true; | |
780 | + }, | |
781 | + // 选择知识点 | |
771 | 782 | setKnowledge() { |
783 | + let knowledge = this.stem.knowledge.map(item => { | |
784 | + return item.join("#") | |
785 | + }) | |
772 | 786 | this.form.questionList[this.stem.index].subQuestions[ |
773 | 787 | this.stem.indexs |
774 | - ].knowledge = this.stem.knowledge.join(","); | |
788 | + ].knowledge = knowledge.join(",") | |
775 | 789 | this.dialogKnowledge = false; |
776 | 790 | }, |
777 | 791 | //end |
... | ... | @@ -1550,13 +1564,12 @@ export default { |
1550 | 1564 | let subQuestions = |
1551 | 1565 | item.subQuestions?.map((items) => { |
1552 | 1566 | return { |
1553 | - questionType: items.questionType, | |
1554 | - score: items.score, | |
1555 | - partScore: items.partScore, | |
1567 | + ...items, | |
1556 | 1568 | selectNum: items.answerOptions.split(",").length, |
1557 | 1569 | answerOptions: items.answerOptions || "A,B,C,D", |
1558 | - correctAnswer: items.correctAnswer, | |
1559 | 1570 | screenshot: items.screenshot || "", |
1571 | + correctAnswer: items.correctAnswer || "", | |
1572 | + knowledge: items.knowledge || "", | |
1560 | 1573 | }; |
1561 | 1574 | }) || []; |
1562 | 1575 | return { | ... | ... |
src/views/examinationPaper/addAsk.vue
... | ... | @@ -56,6 +56,8 @@ |
56 | 56 | <div class="qs-partScore">漏选得分</div> |
57 | 57 | <div class="qs-options qs-options2">选项设置</div> |
58 | 58 | <div class="qs-upload">提干</div> |
59 | + <div class="qs-upload">题目解析</div> | |
60 | + <div class="qs-upload">知识点</div> | |
59 | 61 | <div class="qs-set"></div> |
60 | 62 | </li> |
61 | 63 | <li v-for="(subQuestions, index) in form.questionList" :key="index"> |
... | ... | @@ -116,12 +118,34 @@ |
116 | 118 | v-if="subQuestions.screenshot && !subQuestions.screenshot.includes('html')" |
117 | 119 | :src="subQuestions.screenshot" alt=""> |
118 | 120 | <p style="textAlign:center"><el-button type="primary" round size="mini" icon="el-icon-upload" |
119 | - @click="openStem(subQuestions, index)">重新选择图片</el-button></p> | |
121 | + @click="openStem(subQuestions, index, 1)">重新选择图片</el-button></p> | |
120 | 122 | </div> |
121 | 123 | <el-button slot="reference" class="icon-tickets" type="primary" circle size="mini" |
122 | 124 | icon="el-icon-tickets"></el-button> |
123 | 125 | </el-popover> |
124 | 126 | </div> |
127 | + <div class="qs-upload"> | |
128 | + <el-popover placement="right" width="400" trigger="click"> | |
129 | + <div class="screenshot-box"> | |
130 | + <iframe class="screenshot" | |
131 | + v-if="subQuestions.answerScreenshot && subQuestions.answerScreenshot.includes('html')" | |
132 | + :src="subQuestions.answerScreenshot"></iframe> | |
133 | + <img class="screenshot screenshot-img" | |
134 | + v-if="subQuestions.answerScreenshot && !subQuestions.answerScreenshot.includes('html')" | |
135 | + :src="subQuestions.answerScreenshot" alt=""> | |
136 | + <p style="textAlign:center"><el-button type="primary" round size="mini" icon="el-icon-upload" | |
137 | + @click="openStem(subQuestions, index, 2)">{{ subQuestions.answerScreenshot ? "重新选择图片" : | |
138 | + "上传题目解析" }}</el-button> | |
139 | + </p> | |
140 | + </div> | |
141 | + <el-button slot="reference" class="icon-tickets" type="primary" circle size="mini" | |
142 | + icon="el-icon-tickets"></el-button> | |
143 | + </el-popover> | |
144 | + </div> | |
145 | + <div class="qs-upload"> | |
146 | + <el-button type="primary" circle size="mini" icon="el-icon-price-tag" | |
147 | + @click="openKnowledge(subQuestions, index)"></el-button> | |
148 | + </div> | |
125 | 149 | <div class="qs-set"> |
126 | 150 | <el-popconfirm title="确定删除这道题吗?" @confirm="delTabData(index)"> |
127 | 151 | <el-button slot="reference" class="delete" type="danger" size="mini" circle |
... | ... | @@ -184,20 +208,44 @@ |
184 | 208 | <el-button round @click="step = 0">上一步</el-button> |
185 | 209 | <el-button type="primary" round @click="toStep(2)">下一步</el-button> |
186 | 210 | </div> |
187 | - <el-dialog :close-on-click-modal="false" title="上传题干" :visible.sync="dialogStem" v-if="dialogStem" width="500"> | |
211 | + <el-dialog :close-on-click-modal="false" :title="stem.type == 1 ? '上传题干' : '上传题目解析'" :visible.sync="dialogStem" | |
212 | + v-if="dialogStem" width="500"> | |
188 | 213 | <div class="upload-box"> |
189 | - <img v-if="stem.screenshot && !stem.screenshot.includes('html')" :src="stem.screenshot" class="stem-pic" /> | |
214 | + <template v-show="stem.type == 1"> | |
215 | + <img v-if="stem.screenshot && !stem.screenshot.includes('html')" :src="stem.screenshot" class="stem-pic" /> | |
216 | + </template> | |
217 | + <template v-show="stem.type == 2"> | |
218 | + <img v-if="stem.answerScreenshot && !stem.answerScreenshot.includes('html')" :src="stem.answerScreenshot" | |
219 | + class="stem-pic" /> | |
220 | + </template> | |
190 | 221 | <el-upload class="upload-demo" action="http://121.40.127.171/file/uploadImg" :limit="1" |
191 | 222 | :on-success="upSuccess" :on-error="upError" accept="image/*"> |
192 | - <el-button size="small" type="primary">{{ | |
223 | + <el-button v-show="stem.type == 1" size="small" type="primary">{{ | |
193 | 224 | stem.screenshot && !stem.screenshot.includes('html') ? "重新上传" : "选择照片" |
194 | 225 | }}</el-button> |
226 | + <el-button v-show="stem.type == 2" size="small" type="primary">{{ | |
227 | + stem.answerScreenshot && !stem.answerScreenshot.includes('html') ? "重新上传" : "选择照片" | |
228 | + }}</el-button> | |
195 | 229 | </el-upload> |
196 | 230 | </div> |
197 | 231 | <div slot="footer"> |
198 | 232 | <el-button @click="dialogStem = false">确定</el-button> |
199 | 233 | </div> |
200 | 234 | </el-dialog> |
235 | + <el-dialog :close-on-click-modal="false" title="知识点" :visible.sync="dialogKnowledge" width="500"> | |
236 | + <div> | |
237 | + <el-form ref="form" :model="stem" label-width="160px"> | |
238 | + <el-form-item label="知识点:"> | |
239 | + <el-cascader size="small" filterable :show-all-levels="false" collapse clearable placeholder="选择知识点" | |
240 | + v-model="stem.knowledge" :options="knowledgeData" :props="{ expandTrigger: 'hover' }"></el-cascader> | |
241 | + </el-form-item> | |
242 | + </el-form> | |
243 | + </div> | |
244 | + <div slot="footer"> | |
245 | + <el-button @click="dialogKnowledge = false">取 消</el-button> | |
246 | + <el-button type="primary" @click="setKnowledge">确 定</el-button> | |
247 | + </div> | |
248 | + </el-dialog> | |
201 | 249 | </div> |
202 | 250 | <div v-show="step == 2"> |
203 | 251 | <div class="answer-title"> |
... | ... | @@ -224,15 +272,28 @@ |
224 | 272 | |
225 | 273 | <script> |
226 | 274 | import { deepClone, checkAnswer } from "utils"; |
227 | -const subQuesOptions = { | |
228 | - questionType: 2, | |
229 | - score: 1, | |
230 | - partScore: 0, | |
231 | - selectNum: 4, | |
232 | - answerOptions: "A,B,C,D", | |
233 | - correctAnswer: "", | |
234 | -}; | |
275 | +import knowledgeList from "assets/js/knowledgeList.js"; | |
235 | 276 | export default { |
277 | + computed: { | |
278 | + // 知识点列表 根据学段-科目筛选 | |
279 | + knowledgeData: function () { | |
280 | + let jsons = [] | |
281 | + if (this.form.gradeName && this.form.subjectName) { | |
282 | + let sectionName = "" | |
283 | + this.gradeClassList.map(item => { | |
284 | + if (this.form.gradeName == item.gradeName) { | |
285 | + sectionName = item.sectionName | |
286 | + } | |
287 | + }) | |
288 | + if (sectionName && Object.keys(this.knowledgeList).includes(sectionName)) { | |
289 | + if (Object.keys(this.knowledgeList[sectionName]).includes(this.form.subjectName)) { | |
290 | + jsons = this.knowledgeList[sectionName][this.form.subjectName] | |
291 | + } | |
292 | + } | |
293 | + } | |
294 | + return jsons | |
295 | + }, | |
296 | + }, | |
236 | 297 | watch: { |
237 | 298 | step: function () { |
238 | 299 | this.$nextTick(function () { |
... | ... | @@ -244,6 +305,7 @@ export default { |
244 | 305 | return { |
245 | 306 | role: "", |
246 | 307 | step: 0, //步骤 |
308 | + gradeClassList: [], //年级-班级数据 | |
247 | 309 | gradeList: [], //年级 |
248 | 310 | subjectList: [], //科目 |
249 | 311 | form: { |
... | ... | @@ -274,6 +336,7 @@ export default { |
274 | 336 | }, |
275 | 337 | tagList: [], |
276 | 338 | diaSetAns: false, //答案开关 |
339 | + dialogKnowledge: false, //知识点 | |
277 | 340 | dialogStem: false, //截图开关 |
278 | 341 | formAns: { |
279 | 342 | index: 0, //相同题目最后一位题目的位置 |
... | ... | @@ -283,8 +346,11 @@ export default { |
283 | 346 | answerList: "", //答案列表-字符串 |
284 | 347 | }, |
285 | 348 | stem: { |
349 | + type: 1, | |
286 | 350 | index: 0, //大题位置 |
287 | 351 | screenshot: "", //题干图片地址 |
352 | + answerScreenshot: "", //题目解析图片地址 | |
353 | + knowledge: [], //知识点 | |
288 | 354 | }, |
289 | 355 | type: 1, //1-创建,2-复制答题卡 |
290 | 356 | questionOptions: [ |
... | ... | @@ -294,6 +360,7 @@ export default { |
294 | 360 | { label: "主观题", value: 5 }, |
295 | 361 | ], |
296 | 362 | rightOptions: ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"], |
363 | + knowledgeList: { ...knowledgeList } | |
297 | 364 | }; |
298 | 365 | }, |
299 | 366 | async created() { |
... | ... | @@ -321,16 +388,28 @@ export default { |
321 | 388 | methods: { |
322 | 389 | // v1.5 |
323 | 390 | //上传截图 |
324 | - openStem(obj, index) { | |
391 | + openStem(obj, index, type) { | |
325 | 392 | this.stem.index = index; |
326 | 393 | this.stem.screenshot = obj.screenshot || ""; |
394 | + if (type == 1) { | |
395 | + this.stem.screenshot = obj.screenshot || ""; | |
396 | + this.stem.answerScreenshot = ""; | |
397 | + } else { | |
398 | + this.stem.answerScreenshot = obj.answerScreenshot || ""; | |
399 | + this.stem.screenshot = ""; | |
400 | + } | |
327 | 401 | this.dialogStem = true; |
328 | 402 | }, |
329 | 403 | //图片上传成功 |
330 | 404 | upSuccess(res, file) { |
331 | 405 | if (res && res.status == 0) { |
332 | - this.stem.screenshot = res.data.url; | |
333 | - this.form.questionList[this.stem.index].screenshot = this.stem.screenshot; | |
406 | + if (this.stem.type == 1) { | |
407 | + this.stem.screenshot = res.data.url; | |
408 | + this.form.questionList[this.stem.index].screenshot = this.stem.screenshot; | |
409 | + } else { | |
410 | + this.stem.answerScreenshot = res.data.url; | |
411 | + this.form.questionList[this.stem.index].answerScreenshot = this.stem.answerScreenshot; | |
412 | + } | |
334 | 413 | this.$message.success("上传成功"); |
335 | 414 | } else { |
336 | 415 | this.$message.error(res.info); |
... | ... | @@ -340,6 +419,24 @@ export default { |
340 | 419 | upError(res) { |
341 | 420 | this.$message.error("上传失败"); |
342 | 421 | }, |
422 | + // 知识点 | |
423 | + openKnowledge(obj, index) { | |
424 | + this.stem.index = index; | |
425 | + let knowledgeArr = (obj.knowledge && obj.knowledge.split(",")) || []; | |
426 | + this.stem.knowledge = knowledgeArr.map(item => { | |
427 | + return item.split("#") | |
428 | + }) | |
429 | + this.dialogKnowledge = true; | |
430 | + }, | |
431 | + // 知识点 | |
432 | + setKnowledge() { | |
433 | + let knowledge = this.stem.knowledge.join(","); | |
434 | + this.form.questionList[this.stem.index].knowledge = knowledge.map(item => { | |
435 | + item = item.join("#") | |
436 | + }) | |
437 | + this.dialogKnowledge = false; | |
438 | + }, | |
439 | + | |
343 | 440 | //end |
344 | 441 | linkBack() { |
345 | 442 | this.$confirm( |
... | ... | @@ -579,7 +676,7 @@ export default { |
579 | 676 | toStep(step) { |
580 | 677 | this.formatQuestionList(); |
581 | 678 | this.step = step; |
582 | - if(step==1){ | |
679 | + if (step == 1) { | |
583 | 680 | this.formateQuestion() |
584 | 681 | } |
585 | 682 | }, |
... | ... | @@ -706,9 +803,24 @@ export default { |
706 | 803 | |
707 | 804 | async _GradeList() { |
708 | 805 | //查询年级列表 |
709 | - const { data, status, info } = await this.$request.fetchGradeList(); | |
806 | + // const { data, status, info } = await this.$request.fetchGradeList(); | |
807 | + // 查找班级 | |
808 | + | |
809 | + let fetchClassList = | |
810 | + this.role == "ROLE_PERSONAL" | |
811 | + ? this.$request.pClassList | |
812 | + : this.$request.fetchClassList; | |
813 | + | |
814 | + const { data, status, info } = await fetchClassList(); | |
710 | 815 | if (status == 0) { |
711 | - this.gradeList = (data.gradeNames && [...data.gradeNames]) || []; | |
816 | + this.gradeClassList = data.list?.map((item) => { | |
817 | + console.log(!this.gradeList.includes(item.gradeName)) | |
818 | + if (!this.gradeList.includes(item.gradeName)) { | |
819 | + this.gradeList.push(item.gradeName) | |
820 | + } | |
821 | + return item | |
822 | + }) | |
823 | + // this.gradeList = (data.gradeNames && [...data.gradeNames]) || []; | |
712 | 824 | if (this.type != 2) { |
713 | 825 | this.form.gradeName = this.gradeList[0]; |
714 | 826 | } |
... | ... | @@ -788,14 +900,12 @@ export default { |
788 | 900 | } |
789 | 901 | this.form.questionList = data.questionList?.map((item) => { |
790 | 902 | return { |
791 | - questionTitle: item.questionTitle, | |
792 | - questionType: item.questionType, | |
793 | - score: item.score, | |
794 | - partScore: item.partScore, | |
795 | - selectNum: item.answerOptions.split(",").length, | |
796 | - answerOptions: item.answerOptions || "A,B,C,D", | |
797 | - correctAnswer: item.correctAnswer, | |
798 | - screenshot: item.screenshot || "", | |
903 | + ...items, | |
904 | + selectNum: items.answerOptions.split(",").length, | |
905 | + answerOptions: items.answerOptions || "A,B,C,D", | |
906 | + screenshot: items.screenshot || "", | |
907 | + correctAnswer: items.correctAnswer || "", | |
908 | + knowledge: items.knowledge || "", | |
799 | 909 | } |
800 | 910 | }); |
801 | 911 | } |
... | ... | @@ -1125,9 +1235,11 @@ export default { |
1125 | 1235 | .qs-options { |
1126 | 1236 | flex: 1; |
1127 | 1237 | } |
1128 | - .qs-upload{ | |
1238 | + | |
1239 | + .qs-upload { | |
1129 | 1240 | width: 60px; |
1130 | 1241 | } |
1242 | + | |
1131 | 1243 | .qs-set { |
1132 | 1244 | width: 60px; |
1133 | 1245 | } | ... | ... |