Commit 8af7657ffc22b8d179e7f66c22c2ebf96b1ee4a0
1 parent
352c53cc
修改添加备题,组卷
Showing
2 changed files
with
390 additions
and
892 deletions
src/views/examinationPaper/add.vue
| @@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
| 10 | <el-step title="基础信息" icon="el-icon-edit"></el-step> | 10 | <el-step title="基础信息" icon="el-icon-edit"></el-step> |
| 11 | <el-step v-if="!isUpload" title="题目编辑" icon="el-icon-tickets"></el-step> | 11 | <el-step v-if="!isUpload" title="题目编辑" icon="el-icon-tickets"></el-step> |
| 12 | <el-step title="设置答案" icon="el-icon-edit-outline"></el-step> | 12 | <el-step title="设置答案" icon="el-icon-edit-outline"></el-step> |
| 13 | + <el-step v-if="isUpload" title="试卷预览" icon="el-icon-edit-outline"></el-step> | ||
| 13 | </el-steps> | 14 | </el-steps> |
| 14 | <div v-show="step == 0"> | 15 | <div v-show="step == 0"> |
| 15 | <el-form ref="forms" :model="form" :rules="formRules" label-width="140px"> | 16 | <el-form ref="forms" :model="form" :rules="formRules" label-width="140px"> |
| @@ -324,6 +325,8 @@ | @@ -324,6 +325,8 @@ | ||
| 324 | <div class="qs-score">分数</div> | 325 | <div class="qs-score">分数</div> |
| 325 | <div class="qs-partScore">漏选得分</div> | 326 | <div class="qs-partScore">漏选得分</div> |
| 326 | <div class="qs-options qs-options2">选项设置</div> | 327 | <div class="qs-options qs-options2">选项设置</div> |
| 328 | + <div class="qs-upload" v-if="isUpload">提干</div> | ||
| 329 | + <div class="qs-set">操作</div> | ||
| 327 | </li> | 330 | </li> |
| 328 | <li v-for="(subQuestions, indexs) in question.subQuestions" :key="indexs"> | 331 | <li v-for="(subQuestions, indexs) in question.subQuestions" :key="indexs"> |
| 329 | <p class="set-ans-btn" v-if="subQuestions.qusType && | 332 | <p class="set-ans-btn" v-if="subQuestions.qusType && |
| @@ -337,7 +340,18 @@ | @@ -337,7 +340,18 @@ | ||
| 337 | {{ setNum(index, indexs, subQuestions) }} | 340 | {{ setNum(index, indexs, subQuestions) }} |
| 338 | </div> | 341 | </div> |
| 339 | <div class="qs-type"> | 342 | <div class="qs-type"> |
| 340 | - {{ setSubPro(subQuestions.questionType) }} | 343 | + <template v-if="isUpload"> |
| 344 | + <el-select v-model="subQuestions.questionType" placeholder="选择题目类型" | ||
| 345 | + @change="changeSubQuestions($event, subQuestions)"> | ||
| 346 | + <el-option label="单选题" :value="2"></el-option> | ||
| 347 | + <el-option label="多选题" :value="3"></el-option> | ||
| 348 | + <el-option label="判断题" :value="4"></el-option> | ||
| 349 | + <el-option label="主观题" :value="5"></el-option> | ||
| 350 | + </el-select> | ||
| 351 | + </template> | ||
| 352 | + <template v-else> | ||
| 353 | + {{ setSubPro(subQuestions.questionType) }} | ||
| 354 | + </template> | ||
| 341 | </div> | 355 | </div> |
| 342 | <div class="qs-score"> | 356 | <div class="qs-score"> |
| 343 | <el-input-number class="number-ipt" size="medium" :min="1" :max="200" :precision="2" | 357 | <el-input-number class="number-ipt" size="medium" :min="1" :max="200" :precision="2" |
| @@ -367,6 +381,29 @@ | @@ -367,6 +381,29 @@ | ||
| 367 | " :key="option" @click="subQuestions.correctAnswer = option">{{ option }}</span> | 381 | " :key="option" @click="subQuestions.correctAnswer = option">{{ option }}</span> |
| 368 | </p> | 382 | </p> |
| 369 | </div> | 383 | </div> |
| 384 | + <div class="qs-upload" v-if="isUpload"> | ||
| 385 | + <el-popover placement="right" width="400" trigger="click"> | ||
| 386 | + <div class="screenshot-box"> | ||
| 387 | + <iframe class="screenshot" | ||
| 388 | + v-if="subQuestions.screenshot && subQuestions.screenshot.includes('html')" | ||
| 389 | + :src="subQuestions.screenshot"></iframe> | ||
| 390 | + <img class="screenshot screenshot-img" | ||
| 391 | + v-if="subQuestions.screenshot && !subQuestions.screenshot.includes('html')" | ||
| 392 | + :src="subQuestions.screenshot" alt=""> | ||
| 393 | + <p style="textAlign:center"><el-button type="primary" round size="mini" icon="el-icon-upload" | ||
| 394 | + @click="openStem(subQuestions, index, indexs)">重新选择图片</el-button></p> | ||
| 395 | + </div> | ||
| 396 | + <el-button slot="reference" class="icon-tickets" type="primary" circle size="mini" | ||
| 397 | + icon="el-icon-tickets"></el-button> | ||
| 398 | + </el-popover> | ||
| 399 | + </div> | ||
| 400 | + <div class="qs-set"> | ||
| 401 | + | ||
| 402 | + <el-popconfirm title="确定删除这道题吗?" @confirm="delTabData(indexs, index)"> | ||
| 403 | + <el-button slot="reference" class="delete" type="danger" size="mini" circle | ||
| 404 | + icon="el-icon-delete"></el-button> | ||
| 405 | + </el-popconfirm> | ||
| 406 | + </div> | ||
| 370 | </div> | 407 | </div> |
| 371 | </li> | 408 | </li> |
| 372 | </ul> | 409 | </ul> |
| @@ -420,22 +457,50 @@ | @@ -420,22 +457,50 @@ | ||
| 420 | </el-dialog> | 457 | </el-dialog> |
| 421 | <div class="btn-box"> | 458 | <div class="btn-box"> |
| 422 | <el-button type="danger" plain round @click="linkBack">取消</el-button> | 459 | <el-button type="danger" plain round @click="linkBack">取消</el-button> |
| 423 | - <el-button round @click="backStep1">上一步</el-button> | 460 | + <template v-if="!isUpload"> |
| 461 | + <el-button round @click="toStep(1)">上一步</el-button> | ||
| 462 | + <el-button type="primary" round @click="save">保存</el-button> | ||
| 463 | + </template> | ||
| 464 | + <template v-else> | ||
| 465 | + <el-button round @click="step = 0">上一步</el-button> | ||
| 466 | + <el-button type="primary" round @click="toStep(3)">下一步</el-button> | ||
| 467 | + </template> | ||
| 468 | + </div> | ||
| 469 | + </div> | ||
| 470 | + <div v-show="step == 3"> | ||
| 471 | + <div class="answer-title"> | ||
| 472 | + <p class="name">{{ form.title }}</p> | ||
| 473 | + </div> | ||
| 474 | + <div class="question-box"> | ||
| 475 | + <template v-for="(question, index) in form.questionList"> | ||
| 476 | + <div class="screenshot-box" v-for="(subQuestions, indexs) in question.subQuestions" | ||
| 477 | + :key="index + '-' + indexs"> | ||
| 478 | + <iframe class="screenshot" v-if="subQuestions.screenshot && subQuestions.screenshot.includes('html')" | ||
| 479 | + :src="subQuestions.screenshot"></iframe> | ||
| 480 | + <img class="screenshot screenshot-img" | ||
| 481 | + v-if="subQuestions.screenshot && !subQuestions.screenshot.includes('html')" :src="subQuestions.screenshot" | ||
| 482 | + alt=""> | ||
| 483 | + </div> | ||
| 484 | + </template> | ||
| 485 | + </div> | ||
| 486 | + <div class="btn-box"> | ||
| 487 | + <el-button type="danger" plain round @click="linkBack">取消</el-button> | ||
| 488 | + <el-button round @click="toStep(2)">上一步</el-button> | ||
| 424 | <el-button type="primary" round @click="save">保存</el-button> | 489 | <el-button type="primary" round @click="save">保存</el-button> |
| 425 | </div> | 490 | </div> |
| 426 | </div> | 491 | </div> |
| 427 | <el-dialog :close-on-click-modal="false" title="上传题干" :visible.sync="dialogStem" v-if="dialogStem" width="500"> | 492 | <el-dialog :close-on-click-modal="false" title="上传题干" :visible.sync="dialogStem" v-if="dialogStem" width="500"> |
| 428 | <div class="upload-box"> | 493 | <div class="upload-box"> |
| 429 | - <img v-if="stem.screenshot" :src="stem.screenshot" class="stem-pic" /> | 494 | + <img v-if="stem.screenshot && !stem.screenshot.includes('html')" :src="stem.screenshot" class="stem-pic" /> |
| 430 | <el-upload class="upload-demo" action="http://121.40.127.171/file/uploadImg" :limit="1" :on-success="upSuccess" | 495 | <el-upload class="upload-demo" action="http://121.40.127.171/file/uploadImg" :limit="1" :on-success="upSuccess" |
| 431 | :on-error="upError" accept="image/*"> | 496 | :on-error="upError" accept="image/*"> |
| 432 | <el-button size="small" type="primary">{{ | 497 | <el-button size="small" type="primary">{{ |
| 433 | - stem.screenshot ? "重新上传" : "选择照片" | 498 | + stem.screenshot && !stem.screenshot.includes('html') ? "重新上传" : "选择照片" |
| 434 | }}</el-button> | 499 | }}</el-button> |
| 435 | </el-upload> | 500 | </el-upload> |
| 436 | </div> | 501 | </div> |
| 437 | <div slot="footer"> | 502 | <div slot="footer"> |
| 438 | - <el-button @click="dialogStem = false">关闭弹窗</el-button> | 503 | + <el-button @click="dialogStem = false">确定</el-button> |
| 439 | </div> | 504 | </div> |
| 440 | </el-dialog> | 505 | </el-dialog> |
| 441 | </div> | 506 | </div> |
| @@ -443,7 +508,7 @@ | @@ -443,7 +508,7 @@ | ||
| 443 | </template> | 508 | </template> |
| 444 | 509 | ||
| 445 | <script> | 510 | <script> |
| 446 | -import { deepClone, checkAnswer } from "utils"; | 511 | +import { deepClone, checkAnswer, cNum } from "utils"; |
| 447 | const questionForm = { | 512 | const questionForm = { |
| 448 | questionTitle: "", | 513 | questionTitle: "", |
| 449 | questionType: 2, | 514 | questionType: 2, |
| @@ -577,6 +642,8 @@ export default { | @@ -577,6 +642,8 @@ export default { | ||
| 577 | let params = this.$route.query.params && JSON.parse(this.$route.query.params) || null | 642 | let params = this.$route.query.params && JSON.parse(this.$route.query.params) || null |
| 578 | this.form.title = params?.name | 643 | this.form.title = params?.name |
| 579 | this.form.id = params?.id | 644 | this.form.id = params?.id |
| 645 | + this.form.examsDuration = params?.examsDuration || 90 | ||
| 646 | + this.form.sharingType = params?.sharingType || 0 | ||
| 580 | this.formatData(params) | 647 | this.formatData(params) |
| 581 | } | 648 | } |
| 582 | await this._QuerySubjectList(this.gradeList[0]); | 649 | await this._QuerySubjectList(this.gradeList[0]); |
| @@ -586,26 +653,19 @@ export default { | @@ -586,26 +653,19 @@ export default { | ||
| 586 | } | 653 | } |
| 587 | }, | 654 | }, |
| 588 | methods: { | 655 | methods: { |
| 589 | - | ||
| 590 | // v1.5 | 656 | // v1.5 |
| 591 | //上传截图 | 657 | //上传截图 |
| 592 | openStem(obj, index, indexs) { | 658 | openStem(obj, index, indexs) { |
| 593 | this.stem.index = index; | 659 | this.stem.index = index; |
| 594 | this.stem.indexs = indexs; | 660 | this.stem.indexs = indexs; |
| 595 | - if (type == 1) { | ||
| 596 | - this.stem.screenshot = obj.screenshot || ""; | ||
| 597 | - } else { | ||
| 598 | - this.stem.screenshot = ""; | ||
| 599 | - } | 661 | + this.stem.screenshot = obj.screenshot || ""; |
| 600 | this.dialogStem = true; | 662 | this.dialogStem = true; |
| 601 | }, | 663 | }, |
| 602 | //图片上传成功 | 664 | //图片上传成功 |
| 603 | upSuccess(res, file) { | 665 | upSuccess(res, file) { |
| 604 | if (res && res.status == 0) { | 666 | if (res && res.status == 0) { |
| 605 | this.stem.screenshot = res.data.url; | 667 | this.stem.screenshot = res.data.url; |
| 606 | - this.form.questionList[this.stem.index].subQuestions[this.stem.indexs][ | ||
| 607 | - keys | ||
| 608 | - ] = this.stem.screenshot; | 668 | + this.form.questionList[this.stem.index].subQuestions[this.stem.indexs].screenshot = this.stem.screenshot; |
| 609 | this.$message.success("上传成功"); | 669 | this.$message.success("上传成功"); |
| 610 | } else { | 670 | } else { |
| 611 | this.$message.error(res.info); | 671 | this.$message.error(res.info); |
| @@ -617,6 +677,7 @@ export default { | @@ -617,6 +677,7 @@ export default { | ||
| 617 | }, | 677 | }, |
| 618 | //end | 678 | //end |
| 619 | 679 | ||
| 680 | + //取消创建 | ||
| 620 | linkBack() { | 681 | linkBack() { |
| 621 | this.$confirm( | 682 | this.$confirm( |
| 622 | (this.type == 2 ? "修改复制的" : "组建的") + | 683 | (this.type == 2 ? "修改复制的" : "组建的") + |
| @@ -640,6 +701,7 @@ export default { | @@ -640,6 +701,7 @@ export default { | ||
| 640 | }); | 701 | }); |
| 641 | }); | 702 | }); |
| 642 | }, | 703 | }, |
| 704 | + //转换题型显示方式 | ||
| 643 | setSubPro(type) { | 705 | setSubPro(type) { |
| 644 | let tit; | 706 | let tit; |
| 645 | switch (type) { | 707 | switch (type) { |
| @@ -658,16 +720,16 @@ export default { | @@ -658,16 +720,16 @@ export default { | ||
| 658 | } | 720 | } |
| 659 | return tit; | 721 | return tit; |
| 660 | }, | 722 | }, |
| 723 | + //计算题号 | ||
| 661 | setNum(index, indexs, sub) { | 724 | setNum(index, indexs, sub) { |
| 662 | - let lengths = 0; | ||
| 663 | - let subIndex = 0; | 725 | + let lengths = 0;//所在大题之前的所有小题数量 |
| 726 | + let subIndex = 0;//所在大题的位置 | ||
| 664 | for (let i = 0; i < index; i++) { | 727 | for (let i = 0; i < index; i++) { |
| 665 | let subArr = this.form.questionList[i].subQuestions.filter((item) => { | 728 | let subArr = this.form.questionList[i].subQuestions.filter((item) => { |
| 666 | return !!item.questionType; | 729 | return !!item.questionType; |
| 667 | }); | 730 | }); |
| 668 | lengths += subArr.length; | 731 | lengths += subArr.length; |
| 669 | } | 732 | } |
| 670 | - | ||
| 671 | for (let i = 0; i < indexs; i++) { | 733 | for (let i = 0; i < indexs; i++) { |
| 672 | if (!!this.form.questionList[index].subQuestions[i].questionType) { | 734 | if (!!this.form.questionList[index].subQuestions[i].questionType) { |
| 673 | subIndex += 1; | 735 | subIndex += 1; |
| @@ -675,6 +737,7 @@ export default { | @@ -675,6 +737,7 @@ export default { | ||
| 675 | } | 737 | } |
| 676 | return lengths + subIndex + 1; | 738 | return lengths + subIndex + 1; |
| 677 | }, | 739 | }, |
| 740 | + //统计小题数量 | ||
| 678 | setNums(ques) { | 741 | setNums(ques) { |
| 679 | let lengths = 0; | 742 | let lengths = 0; |
| 680 | let subArr = ques?.filter((item) => { | 743 | let subArr = ques?.filter((item) => { |
| @@ -683,30 +746,10 @@ export default { | @@ -683,30 +746,10 @@ export default { | ||
| 683 | lengths = subArr.length; | 746 | lengths = subArr.length; |
| 684 | return lengths; | 747 | return lengths; |
| 685 | }, | 748 | }, |
| 749 | + //转换中文大题题号 | ||
| 686 | setBigNum(num) { | 750 | setBigNum(num) { |
| 687 | let txt = ""; | 751 | let txt = ""; |
| 688 | - let bigNum = [ | ||
| 689 | - "一", | ||
| 690 | - "二", | ||
| 691 | - "三", | ||
| 692 | - "四", | ||
| 693 | - "五", | ||
| 694 | - "六", | ||
| 695 | - "七", | ||
| 696 | - "八", | ||
| 697 | - "九", | ||
| 698 | - "十", | ||
| 699 | - "十一", | ||
| 700 | - "十二", | ||
| 701 | - "十三", | ||
| 702 | - "十四", | ||
| 703 | - "十五", | ||
| 704 | - "十六", | ||
| 705 | - "十七", | ||
| 706 | - "十八", | ||
| 707 | - "十九", | ||
| 708 | - "二十", | ||
| 709 | - ]; | 752 | + let bigNum = [...cNum] |
| 710 | txt = bigNum[num]; | 753 | txt = bigNum[num]; |
| 711 | 754 | ||
| 712 | return txt; | 755 | return txt; |
| @@ -736,24 +779,18 @@ export default { | @@ -736,24 +779,18 @@ export default { | ||
| 736 | setFormAns(indexs, index) { | 779 | setFormAns(indexs, index) { |
| 737 | this.formAns = { ...this.form.questionList[index].subQuestions[indexs] }; | 780 | this.formAns = { ...this.form.questionList[index].subQuestions[indexs] }; |
| 738 | this.formAns.listIndex = index; | 781 | this.formAns.listIndex = index; |
| 739 | - let startIndex = this.formAns.index + 1 - this.formAns.subNum; //批量设置大难开始位置 | ||
| 740 | - this.formAns.answerList = []; | ||
| 741 | let answerList = ""; | 782 | let answerList = ""; |
| 783 | + let startIndex = indexs - this.formAns.subNum; //批量设置大难开始位置 | ||
| 742 | this.form.questionList[index].subQuestions.map((item, subIdx) => { | 784 | this.form.questionList[index].subQuestions.map((item, subIdx) => { |
| 743 | - if (subIdx >= startIndex) { | 785 | + if (subIdx >= startIndex && subIdx < indexs) { |
| 744 | answerList += this.setAnswer(item.questionType, item.correctAnswer); | 786 | answerList += this.setAnswer(item.questionType, item.correctAnswer); |
| 745 | - if (subIdx != indexs) { | ||
| 746 | - if (!!item.qusType) { | ||
| 747 | - answerList = ""; | ||
| 748 | - } | ||
| 749 | - } else { | ||
| 750 | - if (item.qusType == 3) { | ||
| 751 | - answerList = answerList.slice(0, -1); | ||
| 752 | - } | ||
| 753 | - this.formAns.answerList = answerList; | 787 | + |
| 788 | + if (item.qusType == 3) { | ||
| 789 | + answerList = answerList.slice(0, -1); | ||
| 754 | } | 790 | } |
| 755 | } | 791 | } |
| 756 | }); | 792 | }); |
| 793 | + this.formAns.answerList = answerList; | ||
| 757 | 794 | ||
| 758 | this.diaSetAns = true; | 795 | this.diaSetAns = true; |
| 759 | }, | 796 | }, |
| @@ -808,11 +845,11 @@ export default { | @@ -808,11 +845,11 @@ export default { | ||
| 808 | (item, index) => { | 845 | (item, index) => { |
| 809 | if (this.formAns.endIndex == item.questionIndex) { | 846 | if (this.formAns.endIndex == item.questionIndex) { |
| 810 | EndIndex = index; | 847 | EndIndex = index; |
| 811 | - return; | ||
| 812 | } | 848 | } |
| 849 | + return this.formAns.endIndex == item.questionIndex | ||
| 813 | } | 850 | } |
| 814 | ); | 851 | ); |
| 815 | - | 852 | + console.log(EndIndex) |
| 816 | for (let i = 0; i <= subNum; i++) { | 853 | for (let i = 0; i <= subNum; i++) { |
| 817 | let correctAnswer = ""; | 854 | let correctAnswer = ""; |
| 818 | if (this.formAns.qusType == 2) { | 855 | if (this.formAns.qusType == 2) { |
| @@ -897,9 +934,13 @@ export default { | @@ -897,9 +934,13 @@ export default { | ||
| 897 | } | 934 | } |
| 898 | return txt; | 935 | return txt; |
| 899 | }, | 936 | }, |
| 900 | - backStep1() { | ||
| 901 | - this.formatQuestionList(); | ||
| 902 | - this.step = this.isUpload ? 0 : 1 | 937 | + toStep(step) { |
| 938 | + if (step == 2) { | ||
| 939 | + this.setStep2() | ||
| 940 | + } else { | ||
| 941 | + this.formatQuestionList(); | ||
| 942 | + this.step = step; | ||
| 943 | + } | ||
| 903 | }, | 944 | }, |
| 904 | setStep1() { | 945 | setStep1() { |
| 905 | if (this.subjectList.length == 0) { | 946 | if (this.subjectList.length == 0) { |
| @@ -920,7 +961,7 @@ export default { | @@ -920,7 +961,7 @@ export default { | ||
| 920 | if (!this.form.questionList.length) { | 961 | if (!this.form.questionList.length) { |
| 921 | this.$message.warning("请添加题目!"); | 962 | this.$message.warning("请添加题目!"); |
| 922 | return; | 963 | return; |
| 923 | - } | 964 | + } this.formatQuestionList() |
| 924 | //添加题目ID、序号 | 965 | //添加题目ID、序号 |
| 925 | this.form.questionList.map((item, index) => { | 966 | this.form.questionList.map((item, index) => { |
| 926 | item.questionType = 0; | 967 | item.questionType = 0; |
| @@ -930,6 +971,12 @@ export default { | @@ -930,6 +971,12 @@ export default { | ||
| 930 | }); | 971 | }); |
| 931 | }); | 972 | }); |
| 932 | //整理问题 | 973 | //整理问题 |
| 974 | + this.formateQuestion() | ||
| 975 | + this.step = 2; | ||
| 976 | + return; | ||
| 977 | + }, | ||
| 978 | + formateQuestion() { | ||
| 979 | + this.formatQuestionList() | ||
| 933 | this.form.questionList?.map((item) => { | 980 | this.form.questionList?.map((item) => { |
| 934 | let types = [{}]; | 981 | let types = [{}]; |
| 935 | let addndex = 0; | 982 | let addndex = 0; |
| @@ -986,9 +1033,8 @@ export default { | @@ -986,9 +1033,8 @@ export default { | ||
| 986 | } | 1033 | } |
| 987 | } | 1034 | } |
| 988 | }); | 1035 | }); |
| 989 | - this.step = 2; | ||
| 990 | - return; | ||
| 991 | }, | 1036 | }, |
| 1037 | + | ||
| 992 | //删除批量操作数据 | 1038 | //删除批量操作数据 |
| 993 | formatQuestionList() { | 1039 | formatQuestionList() { |
| 994 | for (let i = 0; i < this.form.questionList.length; i++) { | 1040 | for (let i = 0; i < this.form.questionList.length; i++) { |
| @@ -1068,6 +1114,7 @@ export default { | @@ -1068,6 +1114,7 @@ export default { | ||
| 1068 | //删除小题 | 1114 | //删除小题 |
| 1069 | delTabData(subIndex, index) { | 1115 | delTabData(subIndex, index) { |
| 1070 | this.form.questionList[index].subQuestions.splice(subIndex, 1); | 1116 | this.form.questionList[index].subQuestions.splice(subIndex, 1); |
| 1117 | + this.formateQuestion() | ||
| 1071 | }, | 1118 | }, |
| 1072 | setScore(question) { | 1119 | setScore(question) { |
| 1073 | let score = question.subQuestions?.reduce((a, b) => { | 1120 | let score = question.subQuestions?.reduce((a, b) => { |
| @@ -1353,7 +1400,10 @@ export default { | @@ -1353,7 +1400,10 @@ export default { | ||
| 1353 | if (status == 0) { | 1400 | if (status == 0) { |
| 1354 | this.form.title = data.title + "_副本"; | 1401 | this.form.title = data.title + "_副本"; |
| 1355 | this.form.tagId = data.tagId === 0 ? "" : data.tagId; | 1402 | this.form.tagId = data.tagId === 0 ? "" : data.tagId; |
| 1356 | - | 1403 | + this.form.examsDuration = data.examsDuration; |
| 1404 | + if (this.role != "ROLE_PERSONAL") { | ||
| 1405 | + this.form.sharingType = data.sharingType; | ||
| 1406 | + } | ||
| 1357 | this.formatData(data) | 1407 | this.formatData(data) |
| 1358 | } else { | 1408 | } else { |
| 1359 | this.$message.error(info); | 1409 | this.$message.error(info); |
| @@ -1370,9 +1420,8 @@ export default { | @@ -1370,9 +1420,8 @@ export default { | ||
| 1370 | } else { | 1420 | } else { |
| 1371 | this.form.subjectName = ""; | 1421 | this.form.subjectName = ""; |
| 1372 | } | 1422 | } |
| 1373 | - this.form.examsDuration = data.examsDuration; | 1423 | + |
| 1374 | if (this.role != "ROLE_PERSONAL") { | 1424 | if (this.role != "ROLE_PERSONAL") { |
| 1375 | - this.form.sharingType = data.sharingType; | ||
| 1376 | if (this.gradeList.length) { | 1425 | if (this.gradeList.length) { |
| 1377 | this.gradeList.map((item) => { | 1426 | this.gradeList.map((item) => { |
| 1378 | if (item == data.gradeName) { | 1427 | if (item == data.gradeName) { |
| @@ -1406,7 +1455,6 @@ export default { | @@ -1406,7 +1455,6 @@ export default { | ||
| 1406 | }, | 1455 | }, |
| 1407 | }; | 1456 | }; |
| 1408 | </script> | 1457 | </script> |
| 1409 | - | ||
| 1410 | <style lang="scss" scoped> | 1458 | <style lang="scss" scoped> |
| 1411 | .red { | 1459 | .red { |
| 1412 | color: #f30; | 1460 | color: #f30; |
| @@ -1557,6 +1605,16 @@ export default { | @@ -1557,6 +1605,16 @@ export default { | ||
| 1557 | 1605 | ||
| 1558 | .question-box { | 1606 | .question-box { |
| 1559 | margin-bottom: 20px; | 1607 | margin-bottom: 20px; |
| 1608 | + | ||
| 1609 | + .screenshot-box { | ||
| 1610 | + width: 100%; | ||
| 1611 | + border: 1px solid #e2e2e2; | ||
| 1612 | + margin-bottom: 20px; | ||
| 1613 | + | ||
| 1614 | + .screenshot-img { | ||
| 1615 | + margin: 0; | ||
| 1616 | + } | ||
| 1617 | + } | ||
| 1560 | } | 1618 | } |
| 1561 | 1619 | ||
| 1562 | .question-title { | 1620 | .question-title { |
| @@ -1701,6 +1759,10 @@ export default { | @@ -1701,6 +1759,10 @@ export default { | ||
| 1701 | flex: 1; | 1759 | flex: 1; |
| 1702 | } | 1760 | } |
| 1703 | 1761 | ||
| 1762 | + .qs-upload { | ||
| 1763 | + width: 60px; | ||
| 1764 | + } | ||
| 1765 | + | ||
| 1704 | .qs-set { | 1766 | .qs-set { |
| 1705 | width: 60px; | 1767 | width: 60px; |
| 1706 | } | 1768 | } |
| @@ -1730,4 +1792,17 @@ export default { | @@ -1730,4 +1792,17 @@ export default { | ||
| 1730 | } | 1792 | } |
| 1731 | } | 1793 | } |
| 1732 | } | 1794 | } |
| 1795 | + | ||
| 1796 | +.upload-box { | ||
| 1797 | + .upload-demo { | ||
| 1798 | + text-align: center; | ||
| 1799 | + } | ||
| 1800 | + | ||
| 1801 | + .stem-pic { | ||
| 1802 | + display: block; | ||
| 1803 | + margin: 0 auto 20px; | ||
| 1804 | + height: 200px; | ||
| 1805 | + object-fit: cover; | ||
| 1806 | + } | ||
| 1807 | +} | ||
| 1733 | </style> | 1808 | </style> |
| 1734 | \ No newline at end of file | 1809 | \ No newline at end of file |
src/views/examinationPaper/addAsk.vue
| @@ -2,30 +2,22 @@ | @@ -2,30 +2,22 @@ | ||
| 2 | <div ref="content" class="content-box"> | 2 | <div ref="content" class="content-box"> |
| 3 | <back-box> | 3 | <back-box> |
| 4 | <template slot="title"> | 4 | <template slot="title"> |
| 5 | - <span>{{ "创建答题卡" }}</span> | 5 | + <span>导入课件</span> |
| 6 | </template> | 6 | </template> |
| 7 | </back-box> | 7 | </back-box> |
| 8 | <div class="content"> | 8 | <div class="content"> |
| 9 | <el-steps :active="step" finish-status="success" simple style="margin: 20px 0"> | 9 | <el-steps :active="step" finish-status="success" simple style="margin: 20px 0"> |
| 10 | <el-step title="基础信息" icon="el-icon-edit"></el-step> | 10 | <el-step title="基础信息" icon="el-icon-edit"></el-step> |
| 11 | <el-step title="题目编辑" icon="el-icon-tickets"></el-step> | 11 | <el-step title="题目编辑" icon="el-icon-tickets"></el-step> |
| 12 | - <el-step title="设置答案" icon="el-icon-edit-outline"></el-step> | 12 | + <el-step title="课件预览" icon="el-icon-edit-outline"></el-step> |
| 13 | </el-steps> | 13 | </el-steps> |
| 14 | <div v-show="step == 0"> | 14 | <div v-show="step == 0"> |
| 15 | <el-form ref="forms" :model="form" :rules="formRules" label-width="140px"> | 15 | <el-form ref="forms" :model="form" :rules="formRules" label-width="140px"> |
| 16 | - <el-form-item label="答题卡名称:" prop="title"> | 16 | + <el-form-item label="课件名称:" prop="title"> |
| 17 | <el-input class="sel2" type="text" placeholder="请输入答题卡名称" v-model.trim="form.title" maxlength="30" size="45" | 17 | <el-input class="sel2" type="text" placeholder="请输入答题卡名称" v-model.trim="form.title" maxlength="30" size="45" |
| 18 | show-word-limit> | 18 | show-word-limit> |
| 19 | </el-input> | 19 | </el-input> |
| 20 | </el-form-item> | 20 | </el-form-item> |
| 21 | - <el-form-item label="测验类型:"> | ||
| 22 | - <el-select v-model="form.tagId" placeholder="选择测验类型"> | ||
| 23 | - <el-option label="--" value=""> </el-option> | ||
| 24 | - <el-option v-for="item in answerTypeList" :key="item.id" :label="item.typeName" :value="item.id">{{ | ||
| 25 | - item.typeName }}</el-option> | ||
| 26 | - </el-select> | ||
| 27 | - <el-button class="ml-20" type="primary" round circle icon="el-icon-edit" @click="openTagDia"></el-button> | ||
| 28 | - </el-form-item> | ||
| 29 | <el-form-item v-if="role != 'ROLE_PERSONAL'" label="年级:" prop="gradeName"> | 21 | <el-form-item v-if="role != 'ROLE_PERSONAL'" label="年级:" prop="gradeName"> |
| 30 | <el-select class="sel" v-model="form.gradeName" placeholder="" @change="changeGrade"> | 22 | <el-select class="sel" v-model="form.gradeName" placeholder="" @change="changeGrade"> |
| 31 | <el-option v-for="item in gradeList" :key="item" :label="item" :value="item"> | 23 | <el-option v-for="item in gradeList" :key="item" :label="item" :value="item"> |
| @@ -39,10 +31,6 @@ | @@ -39,10 +31,6 @@ | ||
| 39 | </el-option> | 31 | </el-option> |
| 40 | </el-select> | 32 | </el-select> |
| 41 | </el-form-item> | 33 | </el-form-item> |
| 42 | - <el-form-item label="考试时长:"> | ||
| 43 | - <el-input-number size="medium" :min="1" :max="140" :step-strictly="true" :step="1" | ||
| 44 | - v-model="form.examsDuration" label="考试时长"></el-input-number> | ||
| 45 | - </el-form-item> | ||
| 46 | <el-form-item v-if="role != 'ROLE_PERSONAL'" label="分享范围:" prop="sharingType"> | 34 | <el-form-item v-if="role != 'ROLE_PERSONAL'" label="分享范围:" prop="sharingType"> |
| 47 | <el-radio-group v-model="form.sharingType"> | 35 | <el-radio-group v-model="form.sharingType"> |
| 48 | <el-radio :label="0">任课班级分享</el-radio> | 36 | <el-radio :label="0">任课班级分享</el-radio> |
| @@ -54,278 +42,12 @@ | @@ -54,278 +42,12 @@ | ||
| 54 | <el-button type="danger" plain round @click="linkBack">取消</el-button> | 42 | <el-button type="danger" plain round @click="linkBack">取消</el-button> |
| 55 | <el-button type="primary" round @click="setStep1">下一步</el-button> | 43 | <el-button type="primary" round @click="setStep1">下一步</el-button> |
| 56 | </div> | 44 | </div> |
| 57 | - <el-dialog :close-on-click-modal="false" title="设置测验类型" :visible.sync="dialogVisible" width="500px"> | ||
| 58 | - <div class="dia-content"> | ||
| 59 | - <p class="add-type" v-for="item in tagList" :key="item.id"> | ||
| 60 | - <el-row :gutter="10"> | ||
| 61 | - <el-col :span="18"><el-input v-model="item.typeName" :maxlength="10" | ||
| 62 | - placeholder="请输入答题卡类型名称"></el-input></el-col> | ||
| 63 | - <el-col :span="6"> | ||
| 64 | - <el-tooltip effect="dark" content="保存" placement="top"> | ||
| 65 | - <el-button class="js-set" type="primary" size="small" round circle icon="el-icon-check" | ||
| 66 | - @click="editTypeName(item)"></el-button> | ||
| 67 | - </el-tooltip> | ||
| 68 | - <el-tooltip effect="dark" content="删除" placement="right"> | ||
| 69 | - <el-popconfirm title="确定删除这道大题吗?" @confirm="removeTypeName(item)"> | ||
| 70 | - <el-button class="js-set" type="danger" size="small" round circle icon="el-icon-delete" | ||
| 71 | - slot="reference"></el-button> | ||
| 72 | - </el-popconfirm> | ||
| 73 | - </el-tooltip> | ||
| 74 | - </el-col> | ||
| 75 | - </el-row> | ||
| 76 | - </p> | ||
| 77 | - <p class="add-type"> | ||
| 78 | - <el-row :gutter="10"> | ||
| 79 | - <el-col :span="18"> | ||
| 80 | - <el-input type="text" placeholder="请输入答题卡类型名称" v-model.trim="answerTypeName" :maxlength="10"> | ||
| 81 | - </el-input> | ||
| 82 | - </el-col> | ||
| 83 | - <el-col :span="6"> | ||
| 84 | - <el-tooltip effect="dark" content="添加" placement="right"> | ||
| 85 | - <el-button class="js-set" type="primary" size="small" round circle icon="el-icon-plus" | ||
| 86 | - @click="addPaperType"></el-button> | ||
| 87 | - </el-tooltip> | ||
| 88 | - </el-col> | ||
| 89 | - </el-row> | ||
| 90 | - </p> | ||
| 91 | - </div> | ||
| 92 | - <div class="" slot="footer"> | ||
| 93 | - <el-button @click="dialogVisible = false">关 闭</el-button> | ||
| 94 | - </div> | ||
| 95 | - </el-dialog> | ||
| 96 | </div> | 45 | </div> |
| 97 | <div v-show="step == 1"> | 46 | <div v-show="step == 1"> |
| 98 | - <div class="question-box" v-for="(question, index) in form.questionList" :key="index"> | ||
| 99 | - <p class="question-title"> | ||
| 100 | - <el-tooltip effect="dark" :content="question.show ? '收起' : '展开'" placement="left"> | ||
| 101 | - <i class="el-icon-caret-right" :class="question.show ? 'active' : ''" | ||
| 102 | - @click="question.show = !question.show"></i> | ||
| 103 | - </el-tooltip> | ||
| 104 | - <span>{{ setBigNum(index) }}、</span> | ||
| 105 | - <el-input class="ipt" v-model.trim="question.questionTitle" maxlength="30" placeholder="填写大题名称"></el-input> | ||
| 106 | - <el-popconfirm title="确定删除这道大题吗?" @confirm="form.questionList.splice(index, 1)"> | ||
| 107 | - <el-button slot="reference" class="delete" type="danger" size="mini" circle | ||
| 108 | - icon="el-icon-delete"></el-button> | ||
| 109 | - </el-popconfirm> | ||
| 110 | - <span class="m20">共:{{ question.subQuestions.length }}题</span> | ||
| 111 | - <span>共:{{ setScore(question) }}分</span> | ||
| 112 | - </p> | ||
| 113 | - <transition name="el-zoom-in-top"> | ||
| 114 | - <ul v-show="question.show" class="questions-ul"> | ||
| 115 | - <li class="sub-questions"> | ||
| 116 | - <div class="qs-num">题号</div> | ||
| 117 | - <div class="qs-type">题型</div> | ||
| 118 | - <div class="qs-score">分数</div> | ||
| 119 | - <div class="qs-partScore">漏选得分</div> | ||
| 120 | - <div class="qs-options">选项设置</div> | ||
| 121 | - <div class="qs-set">操作</div> | ||
| 122 | - </li> | ||
| 123 | - <li class="sub-questions" v-for="(subQuestions, indexs) in question.subQuestions" :key="indexs"> | ||
| 124 | - <div class="qs-num">{{ setNum(index, indexs) }}</div> | ||
| 125 | - <div class="qs-type"> | ||
| 126 | - <el-select v-model="subQuestions.questionType" placeholder="选择题目类型" | ||
| 127 | - @change="changeSubQuestions($event, subQuestions)"> | ||
| 128 | - <el-option label="单选题" :value="2"></el-option> | ||
| 129 | - <el-option label="多选题" :value="3"></el-option> | ||
| 130 | - <el-option label="判断题" :value="4"></el-option> | ||
| 131 | - <el-option label="主观题" :value="5"></el-option> | ||
| 132 | - </el-select> | ||
| 133 | - </div> | ||
| 134 | - <div class="qs-score"> | ||
| 135 | - <el-input-number class="number-ipt" size="medium" :min="1" :max="200" :precision="2" :step="1" | ||
| 136 | - v-model="subQuestions.score" label="单题分值"></el-input-number> | ||
| 137 | - </div> | ||
| 138 | - <div class="qs-partScore"> | ||
| 139 | - <p v-if="subQuestions.questionType != 3">--</p> | ||
| 140 | - <el-input-number class="number-ipt" v-else size="medium" :min="0" :precision="2" | ||
| 141 | - :max="subQuestions.score" :step="0.5" v-model="subQuestions.partScore" label="漏选得分"></el-input-number> | ||
| 142 | - </div> | ||
| 143 | - <div class="qs-options"> | ||
| 144 | - <p v-if="subQuestions.questionType == 5">--</p> | ||
| 145 | - <p v-if="subQuestions.questionType == 4" class="answer-box"> | ||
| 146 | - <span class="answer-s" :class="subQuestions.correctAnswer == 1 ? 'active' : ''" | ||
| 147 | - @click="subQuestions.correctAnswer = 1">✓</span> | ||
| 148 | - <span class="answer-s" :class="subQuestions.correctAnswer == 2 ? 'active' : ''" | ||
| 149 | - @click="subQuestions.correctAnswer = 2">✗</span> | ||
| 150 | - </p> | ||
| 151 | - <p v-if="subQuestions.questionType == 3" class="answer-box"> | ||
| 152 | - <span class="answer-s" v-for="option in subQuestions.answerOptions.split(',')" :class="subQuestions.correctAnswer?.includes(option) | ||
| 153 | - ? 'active' | ||
| 154 | - : '' | ||
| 155 | - " :key="option" @click="changAnswer(subQuestions, option)">{{ option }}</span> | ||
| 156 | - </p> | ||
| 157 | - <p v-if="subQuestions.questionType == 2" class="answer-box"> | ||
| 158 | - <span class="answer-s" v-for="option in subQuestions.answerOptions.split(',')" :class="subQuestions.correctAnswer == option ? 'active' : '' | ||
| 159 | - " :key="option" @click="subQuestions.correctAnswer = option">{{ option }}</span> | ||
| 160 | - </p> | ||
| 161 | - <p v-if="subQuestions.questionType == 3 || | ||
| 162 | - subQuestions.questionType == 2 | ||
| 163 | - " class="answer-box answer-box2"> | ||
| 164 | - <el-button size="mini" type="primary" icon="el-icon-plus" circle | ||
| 165 | - @click="addOptions(subQuestions)"></el-button> | ||
| 166 | - <el-button size="mini" type="primary" icon="el-icon-minus" round circle | ||
| 167 | - @click="removeOptions(subQuestions)"></el-button> | ||
| 168 | - </p> | ||
| 169 | - </div> | ||
| 170 | - <div class="qs-set"> | ||
| 171 | - <el-tooltip effect="dark" content="上传提干" placement="top"> | ||
| 172 | - <el-button type="primary" circle size="mini" icon="el-icon-tickets" | ||
| 173 | - @click="openStem(subQuestions, 1, index, indexs)"></el-button> | ||
| 174 | - </el-tooltip> | ||
| 175 | - <el-tooltip effect="dark" content="题目打标" placement="top"> | ||
| 176 | - <el-button type="primary" circle size="mini" icon="el-icon-price-tag" | ||
| 177 | - @click="openTag(subQuestions, 3, index, indexs)"></el-button> | ||
| 178 | - </el-tooltip> | ||
| 179 | - <el-tooltip effect="dark" content="上传题目解析" placement="top"> | ||
| 180 | - <el-button type="primary" circle size="mini" icon="el-icon-upload" | ||
| 181 | - @click="openStem(subQuestions, 2, index, indexs)"></el-button> | ||
| 182 | - </el-tooltip> | ||
| 183 | - <el-popconfirm title="确定删除这道题吗?" @confirm="delTabData(indexs, index)"> | ||
| 184 | - <el-button slot="reference" class="delete" type="danger" size="mini" circle | ||
| 185 | - icon="el-icon-delete"></el-button> | ||
| 186 | - </el-popconfirm> | ||
| 187 | - </div> | ||
| 188 | - </li> | ||
| 189 | - <li class="sub-questions"> | ||
| 190 | - <div class="qs-num">添加</div> | ||
| 191 | - <div class="qs-type"> | ||
| 192 | - <el-select v-model="addSubQuestionsType" placeholder="选择题目类型" | ||
| 193 | - @change="changeAddSubQuestions($event, question)"> | ||
| 194 | - <el-option label="单选题" :value="2"></el-option> | ||
| 195 | - <el-option label="多选题" :value="3"></el-option> | ||
| 196 | - <el-option label="判断题" :value="4"></el-option> | ||
| 197 | - <el-option label="主观题" :value="5"></el-option> | ||
| 198 | - </el-select> | ||
| 199 | - </div> | ||
| 200 | - <div class="qs-score"></div> | ||
| 201 | - <div class="qs-partScore"></div> | ||
| 202 | - <div class="qs-options"></div> | ||
| 203 | - <div class="qs-set"></div> | ||
| 204 | - </li> | ||
| 205 | - </ul> | ||
| 206 | - </transition> | ||
| 207 | - </div> | ||
| 208 | - <div class="add-box"> | ||
| 209 | - <p class="add-question" @click="openQuestion"> | ||
| 210 | - <el-button size="mini" type="primary" icon="el-icon-plus" circle></el-button> | ||
| 211 | - <span class="s1">添加大题</span> | ||
| 212 | - </p> | ||
| 213 | - </div> | ||
| 214 | - <div class="btn-box"> | ||
| 215 | - <el-button type="danger" plain round @click="linkBack">取消</el-button> | ||
| 216 | - <el-button round @click="step = 0">上一步</el-button> | ||
| 217 | - <el-button :type="form.questionList.length == 0 ? 'info' : 'primary'" round @click="setStep2">下一步</el-button> | ||
| 218 | - </div> | ||
| 219 | - <el-dialog :close-on-click-modal="false" title="添加大题" :visible.sync="addQuestionVisible" width="600px"> | ||
| 220 | - <div class="dia-content"> | ||
| 221 | - <el-form ref="form" :model="questionForm" :rules="questionFormRules" label-width="100px"> | ||
| 222 | - <el-form-item label="标题:"> | ||
| 223 | - <el-col :span="20"> | ||
| 224 | - <el-input v-model.trim="questionForm.questionTitle" maxlength="30" placeholder="输入大题名称"></el-input> | ||
| 225 | - </el-col> | ||
| 226 | - </el-form-item> | ||
| 227 | - <el-form-item label="选择题型:"> | ||
| 228 | - <el-select v-model="questionForm.questionType" placeholder="" @change="setQuestionForm"> | ||
| 229 | - <el-option v-for="item in questionOptions" :key="item.value" :label="item.label" :value="item.value"> | ||
| 230 | - </el-option> | ||
| 231 | - <el-option label="混合题" :value="6"> </el-option> | ||
| 232 | - </el-select> | ||
| 233 | - </el-form-item> | ||
| 234 | - <el-form-item label="题数:"> | ||
| 235 | - <el-input-number v-model="questionForm.number" @change="changeQesNum" :min="1" :max="100" | ||
| 236 | - :step-strictly="true" :step="1" label="label"></el-input-number> | ||
| 237 | - </el-form-item> | ||
| 238 | - <el-form-item label="选项个数:" v-show="questionForm.questionType != 4 && | ||
| 239 | - questionForm.questionType != 5 | ||
| 240 | - "> | ||
| 241 | - <el-input-number v-model="questionForm.selectNum" :min="3" :max="10" :step-strictly="true" :step="1" | ||
| 242 | - label="label"></el-input-number> | ||
| 243 | - </el-form-item> | ||
| 244 | - <el-form-item label="单题分数:"> | ||
| 245 | - <el-input-number v-model="questionForm.score" :min="1" :max="200" :precision="2" :step="1" | ||
| 246 | - label="label"></el-input-number> | ||
| 247 | - </el-form-item> | ||
| 248 | - <el-form-item label="漏选得分:" v-if="questionForm.questionType == 3"> | ||
| 249 | - <el-input-number v-model="questionForm.partScore" :min="0" :max="questionForm.score" :precision="2" | ||
| 250 | - :step="0.5" label="label"></el-input-number> | ||
| 251 | - </el-form-item> | ||
| 252 | - <el-form-item label="设置答案:" v-show="questionForm.questionType != 5 && | ||
| 253 | - questionForm.questionType != 6 | ||
| 254 | - "> | ||
| 255 | - <div class="qs-options"> | ||
| 256 | - <p class="ipt"> | ||
| 257 | - <el-input v-if="questionForm.questionType == 2 || | ||
| 258 | - questionForm.questionType == 3 || | ||
| 259 | - questionForm.questionType == 6 | ||
| 260 | - " ref="formAnsIpt2" v-model="questionForm.answerList" @keydown.native=" | ||
| 261 | - keydownAnswer($event, questionForm.questionType, 1) | ||
| 262 | - " @input=" | ||
| 263 | - setAllAnswer($event, questionForm.questionType, 1) | ||
| 264 | - "></el-input> | ||
| 265 | - <el-input v-if="questionForm.questionType == 4" v-model="questionForm.answerList" | ||
| 266 | - readonly=""></el-input> | ||
| 267 | - </p> | ||
| 268 | - <p class="answer-box"> | ||
| 269 | - <template v-if="questionForm.questionType == 4"> | ||
| 270 | - <span class="answer-s active" @click=" | ||
| 271 | - questionForm.answerList.length < questionForm.number | ||
| 272 | - ? (questionForm.answerList += '✓') | ||
| 273 | - : '' | ||
| 274 | - ">✓</span> | ||
| 275 | - <span class="answer-s active" @click=" | ||
| 276 | - questionForm.answerList.length < questionForm.number | ||
| 277 | - ? (questionForm.answerList += '✗') | ||
| 278 | - : '' | ||
| 279 | - ">✗</span> | ||
| 280 | - </template> | ||
| 281 | - <template v-if="questionForm.questionType == 3"> | ||
| 282 | - <template v-for="(option, opIdx) in rightOptions"> | ||
| 283 | - <span v-if="opIdx < questionForm.selectNum" class="answer-s active" :key="option" | ||
| 284 | - @click="setMultiple(questionForm, option, 1)">{{ option }}</span> | ||
| 285 | - </template> | ||
| 286 | - <span class="answer-s active" @click="setMultiple(questionForm, ',', 1)">,</span> | ||
| 287 | - </template> | ||
| 288 | - <template v-if="questionForm.questionType == 2 || | ||
| 289 | - questionForm.questionType == 6 | ||
| 290 | - "> | ||
| 291 | - <template v-for="(option, opIdx) in rightOptions"> | ||
| 292 | - <span v-if="opIdx < questionForm.selectNum" class="answer-s active" :key="option" @click=" | ||
| 293 | - questionForm.answerList.length < questionForm.number | ||
| 294 | - ? (questionForm.answerList += option) | ||
| 295 | - : '' | ||
| 296 | - ">{{ option }}</span> | ||
| 297 | - </template> | ||
| 298 | - </template> | ||
| 299 | - <span class="answer-s delButton" @click=" | ||
| 300 | - questionForm.answerList = questionForm.answerList.slice( | ||
| 301 | - 0, | ||
| 302 | - -1 | ||
| 303 | - ) | ||
| 304 | - ">x</span> | ||
| 305 | - <span class="answer-s ac" @click="questionForm.answerList = ''">ac</span> | ||
| 306 | - </p> | ||
| 307 | - </div> | ||
| 308 | - </el-form-item> | ||
| 309 | - </el-form> | ||
| 310 | - </div> | ||
| 311 | - <div class="dialog-footer" slot="footer"> | ||
| 312 | - <el-button type="primary" @click="addQuestion">确 定</el-button> | ||
| 313 | - <el-button @click="addQuestionVisible = false">取 消</el-button> | ||
| 314 | - </div> | ||
| 315 | - </el-dialog> | ||
| 316 | - </div> | ||
| 317 | - <div v-show="step == 2"> | ||
| 318 | <div class="answer-title"> | 47 | <div class="answer-title"> |
| 319 | <p class="name">{{ form.title }}</p> | 48 | <p class="name">{{ form.title }}</p> |
| 320 | - <p class="totals">卷面总分:{{ allScore }}分</p> | ||
| 321 | </div> | 49 | </div> |
| 322 | - <div class="question-box" v-for="(question, index) in form.questionList" :key="index"> | ||
| 323 | - <p class="question-title"> | ||
| 324 | - <span>{{ setBigNum(index) }}、</span> | ||
| 325 | - <span class="title-txt">{{ question.questionTitle }}</span> | ||
| 326 | - <span class="m20">共:{{ setNums(question.subQuestions) }}题</span> | ||
| 327 | - <span>共:{{ setScore(question) }} 分</span> | ||
| 328 | - </p> | 50 | + <div class="question-box"> |
| 329 | <ul class="questions-ul"> | 51 | <ul class="questions-ul"> |
| 330 | <li class="sub-questions"> | 52 | <li class="sub-questions"> |
| 331 | <div class="qs-num">题号</div> | 53 | <div class="qs-num">题号</div> |
| @@ -333,20 +55,28 @@ | @@ -333,20 +55,28 @@ | ||
| 333 | <div class="qs-score">分数</div> | 55 | <div class="qs-score">分数</div> |
| 334 | <div class="qs-partScore">漏选得分</div> | 56 | <div class="qs-partScore">漏选得分</div> |
| 335 | <div class="qs-options qs-options2">选项设置</div> | 57 | <div class="qs-options qs-options2">选项设置</div> |
| 58 | + <div class="qs-upload">提干</div> | ||
| 59 | + <div class="qs-set"></div> | ||
| 336 | </li> | 60 | </li> |
| 337 | - <li v-for="(subQuestions, indexs) in question.subQuestions" :key="indexs"> | 61 | + <li v-for="(subQuestions, index) in form.questionList" :key="index"> |
| 338 | <p class="set-ans-btn" v-if="subQuestions.qusType && | 62 | <p class="set-ans-btn" v-if="subQuestions.qusType && |
| 339 | subQuestions.subNum && | 63 | subQuestions.subNum && |
| 340 | subQuestions.subNum > 4 | 64 | subQuestions.subNum > 4 |
| 341 | "> | 65 | "> |
| 342 | - <el-button type="primary" @click="setFormAns(indexs, index)">批量设置答案</el-button> | 66 | + <el-button type="primary" @click="setFormAns(index)">批量设置答案</el-button> |
| 343 | </p> | 67 | </p> |
| 344 | <div v-else class="sub-questions"> | 68 | <div v-else class="sub-questions"> |
| 345 | <div class="qs-num"> | 69 | <div class="qs-num"> |
| 346 | - {{ setNum(index, indexs, subQuestions) }} | 70 | + {{ index + 1 }} |
| 347 | </div> | 71 | </div> |
| 348 | <div class="qs-type"> | 72 | <div class="qs-type"> |
| 349 | - {{ setSubPro(subQuestions.questionType) }} | 73 | + <el-select v-model="subQuestions.questionType" placeholder="选择题目类型" |
| 74 | + @change="changeSubQuestions($event, subQuestions)"> | ||
| 75 | + <el-option label="单选题" :value="2"></el-option> | ||
| 76 | + <el-option label="多选题" :value="3"></el-option> | ||
| 77 | + <el-option label="判断题" :value="4"></el-option> | ||
| 78 | + <el-option label="主观题" :value="5"></el-option> | ||
| 79 | + </el-select> | ||
| 350 | </div> | 80 | </div> |
| 351 | <div class="qs-score"> | 81 | <div class="qs-score"> |
| 352 | <el-input-number class="number-ipt" size="medium" :min="1" :max="200" :precision="2" | 82 | <el-input-number class="number-ipt" size="medium" :min="1" :max="200" :precision="2" |
| @@ -376,6 +106,28 @@ | @@ -376,6 +106,28 @@ | ||
| 376 | " :key="option" @click="subQuestions.correctAnswer = option">{{ option }}</span> | 106 | " :key="option" @click="subQuestions.correctAnswer = option">{{ option }}</span> |
| 377 | </p> | 107 | </p> |
| 378 | </div> | 108 | </div> |
| 109 | + <div class="qs-upload"> | ||
| 110 | + <el-popover placement="right" width="400" trigger="click"> | ||
| 111 | + <div class="screenshot-box"> | ||
| 112 | + <iframe class="screenshot" | ||
| 113 | + v-if="subQuestions.screenshot && subQuestions.screenshot.includes('html')" | ||
| 114 | + :src="subQuestions.screenshot"></iframe> | ||
| 115 | + <img class="screenshot screenshot-img" | ||
| 116 | + v-if="subQuestions.screenshot && !subQuestions.screenshot.includes('html')" | ||
| 117 | + :src="subQuestions.screenshot" alt=""> | ||
| 118 | + <p style="textAlign:center"><el-button type="primary" round size="mini" icon="el-icon-upload" | ||
| 119 | + @click="openStem(subQuestions, index)">重新选择图片</el-button></p> | ||
| 120 | + </div> | ||
| 121 | + <el-button slot="reference" class="icon-tickets" type="primary" circle size="mini" | ||
| 122 | + icon="el-icon-tickets"></el-button> | ||
| 123 | + </el-popover> | ||
| 124 | + </div> | ||
| 125 | + <div class="qs-set"> | ||
| 126 | + <el-popconfirm title="确定删除这道题吗?" @confirm="delTabData(index)"> | ||
| 127 | + <el-button slot="reference" class="delete" type="danger" size="mini" circle | ||
| 128 | + icon="el-icon-delete"></el-button> | ||
| 129 | + </el-popconfirm> | ||
| 130 | + </div> | ||
| 379 | </div> | 131 | </div> |
| 380 | </li> | 132 | </li> |
| 381 | </ul> | 133 | </ul> |
| @@ -429,40 +181,49 @@ | @@ -429,40 +181,49 @@ | ||
| 429 | </el-dialog> | 181 | </el-dialog> |
| 430 | <div class="btn-box"> | 182 | <div class="btn-box"> |
| 431 | <el-button type="danger" plain round @click="linkBack">取消</el-button> | 183 | <el-button type="danger" plain round @click="linkBack">取消</el-button> |
| 432 | - <el-button round @click="backStep1">上一步</el-button> | ||
| 433 | - <el-button type="primary" round @click="save">保存</el-button> | 184 | + <el-button round @click="step = 0">上一步</el-button> |
| 185 | + <el-button type="primary" round @click="toStep(2)">下一步</el-button> | ||
| 434 | </div> | 186 | </div> |
| 187 | + <el-dialog :close-on-click-modal="false" title="上传题干" :visible.sync="dialogStem" v-if="dialogStem" width="500"> | ||
| 188 | + <div class="upload-box"> | ||
| 189 | + <img v-if="stem.screenshot && !stem.screenshot.includes('html')" :src="stem.screenshot" class="stem-pic" /> | ||
| 190 | + <el-upload class="upload-demo" action="http://121.40.127.171/file/uploadImg" :limit="1" | ||
| 191 | + :on-success="upSuccess" :on-error="upError" accept="image/*"> | ||
| 192 | + <el-button size="small" type="primary">{{ | ||
| 193 | + stem.screenshot && !stem.screenshot.includes('html') ? "重新上传" : "选择照片" | ||
| 194 | + }}</el-button> | ||
| 195 | + </el-upload> | ||
| 196 | + </div> | ||
| 197 | + <div slot="footer"> | ||
| 198 | + <el-button @click="dialogStem = false">确定</el-button> | ||
| 199 | + </div> | ||
| 200 | + </el-dialog> | ||
| 435 | </div> | 201 | </div> |
| 436 | - <el-dialog :close-on-click-modal="false" title="上传题干" :visible.sync="dialogStem" v-if="dialogStem" width="500"> | ||
| 437 | - <div class="upload-box"> | ||
| 438 | - <img v-if="stem.screenshot" :src="stem.screenshotSrc" class="stem-pic" /> | ||
| 439 | - <el-upload class="upload-demo" action="http://121.40.127.171/file/uploadImg" :limit="1" :on-success="upSuccess" | ||
| 440 | - :on-error="upError" accept="image/*"> | ||
| 441 | - <el-button size="small" type="primary">{{ | ||
| 442 | - stem.screenshot ? "重新上传" : "选择照片" | ||
| 443 | - }}</el-button> | ||
| 444 | - </el-upload> | 202 | + <div v-show="step == 2"> |
| 203 | + <div class="answer-title"> | ||
| 204 | + <p class="name">{{ form.title }}</p> | ||
| 445 | </div> | 205 | </div> |
| 446 | - <div slot="footer"> | ||
| 447 | - <el-button @click="dialogStem = false">关闭弹窗</el-button> | 206 | + <div class="question-box"> |
| 207 | + <div class="screenshot-box" v-for="(subQuestions, index) in form.questionList" :key="index"> | ||
| 208 | + <iframe class="screenshot" v-if="subQuestions.screenshot && subQuestions.screenshot.includes('html')" | ||
| 209 | + :src="subQuestions.screenshot"></iframe> | ||
| 210 | + <img class="screenshot screenshot-img" | ||
| 211 | + v-if="subQuestions.screenshot && !subQuestions.screenshot.includes('html')" :src="subQuestions.screenshot" | ||
| 212 | + alt=""> | ||
| 213 | + </div> | ||
| 448 | </div> | 214 | </div> |
| 449 | - </el-dialog> | ||
| 450 | - | 215 | + <div class="btn-box"> |
| 216 | + <el-button type="danger" plain round @click="linkBack">取消</el-button> | ||
| 217 | + <el-button round @click="toStep(1)">上一步</el-button> | ||
| 218 | + <el-button type="primary" round @click="save">保存</el-button> | ||
| 219 | + </div> | ||
| 220 | + </div> | ||
| 451 | </div> | 221 | </div> |
| 452 | </div> | 222 | </div> |
| 453 | </template> | 223 | </template> |
| 454 | 224 | ||
| 455 | <script> | 225 | <script> |
| 456 | import { deepClone, checkAnswer } from "utils"; | 226 | import { deepClone, checkAnswer } from "utils"; |
| 457 | -const questionForm = { | ||
| 458 | - questionTitle: "", | ||
| 459 | - questionType: 2, | ||
| 460 | - number: 10, | ||
| 461 | - selectNum: 4, | ||
| 462 | - score: 1, | ||
| 463 | - partScore: 0, | ||
| 464 | - answerList: "", | ||
| 465 | -}; | ||
| 466 | const subQuesOptions = { | 227 | const subQuesOptions = { |
| 467 | questionType: 2, | 228 | questionType: 2, |
| 468 | score: 1, | 229 | score: 1, |
| @@ -472,17 +233,6 @@ const subQuesOptions = { | @@ -472,17 +233,6 @@ const subQuesOptions = { | ||
| 472 | correctAnswer: "", | 233 | correctAnswer: "", |
| 473 | }; | 234 | }; |
| 474 | export default { | 235 | export default { |
| 475 | - computed: { | ||
| 476 | - allScore: function () { | ||
| 477 | - let score = 0; | ||
| 478 | - this.form.questionList.map((item) => { | ||
| 479 | - score += item.subQuestions.reduce((a, b) => { | ||
| 480 | - return a + Number(b.score ? b.score : 0); | ||
| 481 | - }, 0); | ||
| 482 | - }, 0); | ||
| 483 | - return Number(score).toFixed(2); | ||
| 484 | - }, | ||
| 485 | - }, | ||
| 486 | watch: { | 236 | watch: { |
| 487 | step: function () { | 237 | step: function () { |
| 488 | this.$nextTick(function () { | 238 | this.$nextTick(function () { |
| @@ -496,17 +246,13 @@ export default { | @@ -496,17 +246,13 @@ export default { | ||
| 496 | step: 0, //步骤 | 246 | step: 0, //步骤 |
| 497 | gradeList: [], //年级 | 247 | gradeList: [], //年级 |
| 498 | subjectList: [], //科目 | 248 | subjectList: [], //科目 |
| 499 | - answerTypeList: [], //测验类型 | ||
| 500 | - answerTypeName: "", //测验类型名称 | ||
| 501 | form: { | 249 | form: { |
| 502 | //答题卡详情 | 250 | //答题卡详情 |
| 503 | title: "", | 251 | title: "", |
| 504 | - tagId: "", | ||
| 505 | - subjectName: "", | ||
| 506 | - examsDuration: 90, | ||
| 507 | - questionList: [], | ||
| 508 | gradeName: "", | 252 | gradeName: "", |
| 253 | + subjectName: "", | ||
| 509 | sharingType: 0, | 254 | sharingType: 0, |
| 255 | + questionList: [], | ||
| 510 | }, | 256 | }, |
| 511 | formRules: { | 257 | formRules: { |
| 512 | //答题卡验证 | 258 | //答题卡验证 |
| @@ -519,19 +265,17 @@ export default { | @@ -519,19 +265,17 @@ export default { | ||
| 519 | trigger: "blur", | 265 | trigger: "blur", |
| 520 | }, | 266 | }, |
| 521 | ], | 267 | ], |
| 268 | + gradeName: [ | ||
| 269 | + { required: true, message: "请选择年级", trigger: "blur" }, | ||
| 270 | + ], | ||
| 522 | subjectName: [ | 271 | subjectName: [ |
| 523 | { required: true, message: "请选择科目", trigger: "blur" }, | 272 | { required: true, message: "请选择科目", trigger: "blur" }, |
| 524 | ], | 273 | ], |
| 525 | - examsDuration: [ | ||
| 526 | - { required: true, message: "请设置考试时长", trigger: "blur" }, | ||
| 527 | - ], | ||
| 528 | }, | 274 | }, |
| 529 | tagList: [], | 275 | tagList: [], |
| 530 | diaSetAns: false, //答案开关 | 276 | diaSetAns: false, //答案开关 |
| 531 | dialogStem: false, //截图开关 | 277 | dialogStem: false, //截图开关 |
| 532 | formAns: { | 278 | formAns: { |
| 533 | - listIndex: 0, //大题位置 | ||
| 534 | - endIndex: 0, //相同题目最后一位题目的questionIndex | ||
| 535 | index: 0, //相同题目最后一位题目的位置 | 279 | index: 0, //相同题目最后一位题目的位置 |
| 536 | qusType: "", //题目类型 | 280 | qusType: "", //题目类型 |
| 537 | subNum: 0, //数量 | 281 | subNum: 0, //数量 |
| @@ -540,25 +284,9 @@ export default { | @@ -540,25 +284,9 @@ export default { | ||
| 540 | }, | 284 | }, |
| 541 | stem: { | 285 | stem: { |
| 542 | index: 0, //大题位置 | 286 | index: 0, //大题位置 |
| 543 | - indexs: 0, //小题位置 | ||
| 544 | - screenshot: "", //题干图片id | ||
| 545 | - screenshotSrc: "", //题干图片地址显示用保存时删除 | 287 | + screenshot: "", //题干图片地址 |
| 546 | }, | 288 | }, |
| 547 | type: 1, //1-创建,2-复制答题卡 | 289 | type: 1, //1-创建,2-复制答题卡 |
| 548 | - dialogVisible: false, //测验类型设置弹窗 | ||
| 549 | - addQuestionVisible: false, //添加大题弹窗 | ||
| 550 | - questionForm: { ...questionForm }, | ||
| 551 | - questionFormRules: { | ||
| 552 | - questionTitle: [ | ||
| 553 | - { required: true, message: "请输入大题名称", trigger: "blur" }, | ||
| 554 | - { | ||
| 555 | - min: 1, | ||
| 556 | - max: 30, | ||
| 557 | - message: "长度在 1 到 30 个字符", | ||
| 558 | - trigger: "blur", | ||
| 559 | - }, | ||
| 560 | - ], | ||
| 561 | - }, | ||
| 562 | questionOptions: [ | 290 | questionOptions: [ |
| 563 | { label: "单选题", value: 2 }, | 291 | { label: "单选题", value: 2 }, |
| 564 | { label: "多选题", value: 3 }, | 292 | { label: "多选题", value: 3 }, |
| @@ -566,7 +294,6 @@ export default { | @@ -566,7 +294,6 @@ export default { | ||
| 566 | { label: "主观题", value: 5 }, | 294 | { label: "主观题", value: 5 }, |
| 567 | ], | 295 | ], |
| 568 | rightOptions: ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"], | 296 | rightOptions: ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"], |
| 569 | - addSubQuestionsType: "", | ||
| 570 | }; | 297 | }; |
| 571 | }, | 298 | }, |
| 572 | async created() { | 299 | async created() { |
| @@ -574,6 +301,12 @@ export default { | @@ -574,6 +301,12 @@ export default { | ||
| 574 | this.role = | 301 | this.role = |
| 575 | this.$store.getters.info.showRole || | 302 | this.$store.getters.info.showRole || |
| 576 | this.$store.getters.info.permissions[0].role; | 303 | this.$store.getters.info.permissions[0].role; |
| 304 | + let params = this.$route.query.params && JSON.parse(this.$route.query.params) || null | ||
| 305 | + this.form.title = params?.name | ||
| 306 | + this.form.id = params?.id | ||
| 307 | + this.form.sharingType = params?.sharingType || 0 | ||
| 308 | + this.formatData(params) | ||
| 309 | + console.log(this.form) | ||
| 577 | if (this.role != "ROLE_PERSONAL") { | 310 | if (this.role != "ROLE_PERSONAL") { |
| 578 | this.formRules.gradeName = [ | 311 | this.formRules.gradeName = [ |
| 579 | { required: true, message: "请选择年级", trigger: "blur" }, | 312 | { required: true, message: "请选择年级", trigger: "blur" }, |
| @@ -581,36 +314,23 @@ export default { | @@ -581,36 +314,23 @@ export default { | ||
| 581 | await this._GradeList(); | 314 | await this._GradeList(); |
| 582 | } | 315 | } |
| 583 | await this._QuerySubjectList(this.gradeList[0]); | 316 | await this._QuerySubjectList(this.gradeList[0]); |
| 584 | - await this._TypeList(); | ||
| 585 | if (this.type == 2) { | 317 | if (this.type == 2) { |
| 586 | this._QueryDetail(); | 318 | this._QueryDetail(); |
| 587 | } | 319 | } |
| 588 | }, | 320 | }, |
| 589 | methods: { | 321 | methods: { |
| 322 | + // v1.5 | ||
| 590 | //上传截图 | 323 | //上传截图 |
| 591 | - openStem(obj, index, indexs) { | 324 | + openStem(obj, index) { |
| 592 | this.stem.index = index; | 325 | this.stem.index = index; |
| 593 | - this.stem.indexs = indexs; | ||
| 594 | - if (type == 1) { | ||
| 595 | - this.stem.screenshot = obj.screenshot || ""; | ||
| 596 | - this.stem.screenshotSrc = obj.screenshotSrc || ""; | ||
| 597 | - } else { | ||
| 598 | - this.stem.screenshot = ""; | ||
| 599 | - this.stem.screenshotSrc = ""; | ||
| 600 | - } | 326 | + this.stem.screenshot = obj.screenshot || ""; |
| 601 | this.dialogStem = true; | 327 | this.dialogStem = true; |
| 602 | }, | 328 | }, |
| 603 | //图片上传成功 | 329 | //图片上传成功 |
| 604 | upSuccess(res, file) { | 330 | upSuccess(res, file) { |
| 605 | if (res && res.status == 0) { | 331 | if (res && res.status == 0) { |
| 606 | - this.stem.screenshotSrc = res.data.url; | ||
| 607 | - this.stem.screenshot = res.data.resId; | ||
| 608 | - this.form.questionList[this.stem.index].subQuestions[this.stem.indexs][ | ||
| 609 | - keys | ||
| 610 | - ] = this.stem.screenshot; | ||
| 611 | - this.form.questionList[this.stem.index].subQuestions[this.stem.indexs][ | ||
| 612 | - keys + "Src" | ||
| 613 | - ] = this.stem.screenshotSrc; | 332 | + this.stem.screenshot = res.data.url; |
| 333 | + this.form.questionList[this.stem.index].screenshot = this.stem.screenshot; | ||
| 614 | this.$message.success("上传成功"); | 334 | this.$message.success("上传成功"); |
| 615 | } else { | 335 | } else { |
| 616 | this.$message.error(res.info); | 336 | this.$message.error(res.info); |
| @@ -620,10 +340,11 @@ export default { | @@ -620,10 +340,11 @@ export default { | ||
| 620 | upError(res) { | 340 | upError(res) { |
| 621 | this.$message.error("上传失败"); | 341 | this.$message.error("上传失败"); |
| 622 | }, | 342 | }, |
| 343 | + //end | ||
| 623 | linkBack() { | 344 | linkBack() { |
| 624 | this.$confirm( | 345 | this.$confirm( |
| 625 | - (this.type == 2 ? "修改复制的" : "组建的") + | ||
| 626 | - "答题卡未保存,确认退出吗?", | 346 | + (this.type == 2 ? "修改复制的" : "导入的") + |
| 347 | + "课件未保存,确认退出吗?", | ||
| 627 | "提示", | 348 | "提示", |
| 628 | { | 349 | { |
| 629 | confirmButtonText: "取消", | 350 | confirmButtonText: "取消", |
| @@ -661,103 +382,70 @@ export default { | @@ -661,103 +382,70 @@ export default { | ||
| 661 | } | 382 | } |
| 662 | return tit; | 383 | return tit; |
| 663 | }, | 384 | }, |
| 664 | - setNum(index, indexs, sub) { | ||
| 665 | - let lengths = 0; | ||
| 666 | - let subIndex = 0; | ||
| 667 | - for (let i = 0; i < index; i++) { | ||
| 668 | - let subArr = this.form.questionList[i].subQuestions.filter((item) => { | ||
| 669 | - return !!item.questionType; | ||
| 670 | - }); | ||
| 671 | - lengths += subArr.length; | ||
| 672 | - } | ||
| 673 | - | ||
| 674 | - for (let i = 0; i < indexs; i++) { | ||
| 675 | - if (!!this.form.questionList[index].subQuestions[i].questionType) { | ||
| 676 | - subIndex += 1; | 385 | + //整理问题 |
| 386 | + formateQuestion() { | ||
| 387 | + let types = [{}]; | ||
| 388 | + let addndex = 0; | ||
| 389 | + this.formatQuestionList() | ||
| 390 | + this.form.questionList.map((sub, index) => { | ||
| 391 | + sub.questionIndex = index | ||
| 392 | + if (!!sub.questionType) { | ||
| 393 | + if ( | ||
| 394 | + sub.questionType == types[addndex].qusType && | ||
| 395 | + sub.questionType != 5 | ||
| 396 | + ) { | ||
| 397 | + //同类型批量答案+1 | ||
| 398 | + types[addndex].subNum += 1; | ||
| 399 | + if ( | ||
| 400 | + types[addndex].answerOptions.length < sub.answerOptions.length | ||
| 401 | + ) { | ||
| 402 | + types[addndex].answerOptions = sub.answerOptions; | ||
| 403 | + } | ||
| 404 | + types[addndex].answerList = ""; | ||
| 405 | + //循环最后类型数量大于等于5,保存批量答案 | ||
| 406 | + if (types[addndex].subNum >= 5) { | ||
| 407 | + types[addndex].index = index; | ||
| 408 | + } | ||
| 409 | + } else { | ||
| 410 | + if (types[addndex].subNum >= 5) { | ||
| 411 | + //不同类型时如果原有类型数量大于等于5,保存批量答案 | ||
| 412 | + types[addndex].index = index - 1; | ||
| 413 | + addndex += 1; | ||
| 414 | + types[addndex] = {}; | ||
| 415 | + } | ||
| 416 | + //不同类型初始化批量答案 | ||
| 417 | + types[addndex].qusType = sub.questionType; | ||
| 418 | + types[addndex].subNum = 1; | ||
| 419 | + types[addndex].answerOptions = sub.answerOptions; | ||
| 420 | + types[addndex].answerList = ""; | ||
| 421 | + } | ||
| 677 | } | 422 | } |
| 678 | - } | ||
| 679 | - return lengths + subIndex + 1; | ||
| 680 | - }, | ||
| 681 | - setNums(ques) { | ||
| 682 | - let lengths = 0; | ||
| 683 | - let subArr = ques.filter((item) => { | ||
| 684 | - return !!item.questionType; | ||
| 685 | }); | 423 | }); |
| 686 | - lengths = subArr.length; | ||
| 687 | - return lengths; | ||
| 688 | - }, | ||
| 689 | - setBigNum(num) { | ||
| 690 | - let txt = ""; | ||
| 691 | - let bigNum = [ | ||
| 692 | - "一", | ||
| 693 | - "二", | ||
| 694 | - "三", | ||
| 695 | - "四", | ||
| 696 | - "五", | ||
| 697 | - "六", | ||
| 698 | - "七", | ||
| 699 | - "八", | ||
| 700 | - "九", | ||
| 701 | - "十", | ||
| 702 | - "十一", | ||
| 703 | - "十二", | ||
| 704 | - "十三", | ||
| 705 | - "十四", | ||
| 706 | - "十五", | ||
| 707 | - "十六", | ||
| 708 | - "十七", | ||
| 709 | - "十八", | ||
| 710 | - "十九", | ||
| 711 | - "二十", | ||
| 712 | - ]; | ||
| 713 | - txt = bigNum[num]; | ||
| 714 | - | ||
| 715 | - return txt; | ||
| 716 | - }, | ||
| 717 | - //切换题型清空答案 | ||
| 718 | - setQuestionForm(val) { | ||
| 719 | - this.questionForm.answerList = ""; | ||
| 720 | - }, | ||
| 721 | - //减少题数设置答案 | ||
| 722 | - changeQesNum(val) { | ||
| 723 | - if ( | ||
| 724 | - this.questionForm.questionType == 2 || | ||
| 725 | - this.questionForm.questionType == 4 | ||
| 726 | - ) { | ||
| 727 | - this.questionForm.answerList = this.questionForm.answerList.substring( | ||
| 728 | - 0, | ||
| 729 | - val | ||
| 730 | - ); | ||
| 731 | - } else { | ||
| 732 | - this.questionForm.answerList = this.questionForm.answerList | ||
| 733 | - .split(",") | ||
| 734 | - .splice(0, val) | ||
| 735 | - .join(","); | 424 | + for (let i = 0; i < types.length; i++) { |
| 425 | + if (types[i].subNum >= 5) { | ||
| 426 | + this.form.questionList.splice( | ||
| 427 | + types[i].index + i + 1, | ||
| 428 | + 0, | ||
| 429 | + deepClone(types[i]) | ||
| 430 | + ); | ||
| 431 | + } | ||
| 736 | } | 432 | } |
| 737 | }, | 433 | }, |
| 738 | //初始化要修改的答案 | 434 | //初始化要修改的答案 |
| 739 | - setFormAns(indexs, index) { | ||
| 740 | - this.formAns = { ...this.form.questionList[index].subQuestions[indexs] }; | ||
| 741 | - this.formAns.listIndex = index; | ||
| 742 | - let startIndex = this.formAns.index + 1 - this.formAns.subNum; //批量设置大难开始位置 | 435 | + setFormAns(index) { |
| 436 | + this.formAns = { ...this.form.questionList[index] }; | ||
| 437 | + let startIndex = index - this.formAns.subNum; //批量设置开始位置 | ||
| 743 | this.formAns.answerList = []; | 438 | this.formAns.answerList = []; |
| 744 | let answerList = ""; | 439 | let answerList = ""; |
| 745 | - this.form.questionList[index].subQuestions.map((item, subIdx) => { | ||
| 746 | - if (subIdx >= startIndex) { | 440 | + this.form.questionList.map((item, subIdx) => { |
| 441 | + if (subIdx >= startIndex && subIdx < index) { | ||
| 747 | answerList += this.setAnswer(item.questionType, item.correctAnswer); | 442 | answerList += this.setAnswer(item.questionType, item.correctAnswer); |
| 748 | - if (subIdx != indexs) { | ||
| 749 | - if (!!item.qusType) { | ||
| 750 | - answerList = ""; | ||
| 751 | - } | ||
| 752 | - } else { | ||
| 753 | - if (item.qusType == 3) { | ||
| 754 | - answerList = answerList.slice(0, -1); | ||
| 755 | - } | ||
| 756 | - this.formAns.answerList = answerList; | 443 | + if (item.qusType == 3) { |
| 444 | + answerList = answerList.slice(0, -1); | ||
| 757 | } | 445 | } |
| 446 | + this.formAns.answerList = answerList; | ||
| 758 | } | 447 | } |
| 759 | }); | 448 | }); |
| 760 | - | ||
| 761 | this.diaSetAns = true; | 449 | this.diaSetAns = true; |
| 762 | }, | 450 | }, |
| 763 | insertTxtAndSetcursor(element, answerList, str) { | 451 | insertTxtAndSetcursor(element, answerList, str) { |
| @@ -807,12 +495,12 @@ export default { | @@ -807,12 +495,12 @@ export default { | ||
| 807 | saveFormAns() { | 495 | saveFormAns() { |
| 808 | let EndIndex; | 496 | let EndIndex; |
| 809 | let subNum = this.formAns.subNum - 1; | 497 | let subNum = this.formAns.subNum - 1; |
| 810 | - this.form.questionList[this.formAns.listIndex].subQuestions.some( | 498 | + this.form.questionList.some( |
| 811 | (item, index) => { | 499 | (item, index) => { |
| 812 | - if (this.formAns.endIndex == item.questionIndex) { | 500 | + if (this.formAns.index == item.questionIndex) { |
| 813 | EndIndex = index; | 501 | EndIndex = index; |
| 814 | - return; | ||
| 815 | } | 502 | } |
| 503 | + return this.formAns.index == item.questionIndex | ||
| 816 | } | 504 | } |
| 817 | ); | 505 | ); |
| 818 | 506 | ||
| @@ -830,22 +518,19 @@ export default { | @@ -830,22 +518,19 @@ export default { | ||
| 830 | ? 2 | 518 | ? 2 |
| 831 | : ""; | 519 | : ""; |
| 832 | } | 520 | } |
| 833 | - this.form.questionList[this.formAns.listIndex].subQuestions[ | 521 | + this.form.questionList[ |
| 834 | EndIndex - i | 522 | EndIndex - i |
| 835 | ].correctAnswer = correctAnswer; | 523 | ].correctAnswer = correctAnswer; |
| 836 | } | 524 | } |
| 837 | this.diaSetAns = false; | 525 | this.diaSetAns = false; |
| 838 | }, | 526 | }, |
| 839 | - keydownAnswer(event, type, isAddBig) { | 527 | + keydownAnswer(event, type) { |
| 840 | let answerA = "ABCDEFGHIJ"; | 528 | let answerA = "ABCDEFGHIJ"; |
| 841 | let answer_a = "abcdefghij"; | 529 | let answer_a = "abcdefghij"; |
| 842 | - if (isAddBig) { | ||
| 843 | - answerA = answerA.substring(0, this.questionForm.selectNum); | ||
| 844 | - answer_a = answer_a.substring(0, this.questionForm.selectNum); | ||
| 845 | - } else { | ||
| 846 | - answerA = answerA.substring(0, this.formAns.subNum); | ||
| 847 | - answer_a = answer_a.substring(0, this.formAns.subNum); | ||
| 848 | - } | 530 | + |
| 531 | + answerA = answerA.substring(0, this.formAns.subNum); | ||
| 532 | + answer_a = answer_a.substring(0, this.formAns.subNum); | ||
| 533 | + | ||
| 849 | answerA += answer_a; | 534 | answerA += answer_a; |
| 850 | answerA = type == 2 ? answerA : answerA + ","; | 535 | answerA = type == 2 ? answerA : answerA + ","; |
| 851 | if ( | 536 | if ( |
| @@ -868,26 +553,17 @@ export default { | @@ -868,26 +553,17 @@ export default { | ||
| 868 | event.returnValue = ""; | 553 | event.returnValue = ""; |
| 869 | } | 554 | } |
| 870 | }, | 555 | }, |
| 871 | - setAllAnswer(event, type, isAddBig) { | ||
| 872 | - if (isAddBig) { | ||
| 873 | - let str = this.questionForm.answerList; | ||
| 874 | - let str2 = checkAnswer( | ||
| 875 | - str, | ||
| 876 | - type, | ||
| 877 | - this.questionForm.selectNum, | ||
| 878 | - this.questionForm.number | ||
| 879 | - ); | ||
| 880 | - this.questionForm.answerList = str2; | ||
| 881 | - } else { | ||
| 882 | - let str = this.formAns.answerList; | ||
| 883 | - let str2 = checkAnswer( | ||
| 884 | - str, | ||
| 885 | - type, | ||
| 886 | - this.formAns.answerOptions.split(",").length, | ||
| 887 | - this.formAns.subNum | ||
| 888 | - ); | ||
| 889 | - this.formAns.answerList = str2; | ||
| 890 | - } | 556 | + setAllAnswer(event, type) { |
| 557 | + | ||
| 558 | + let str = this.formAns.answerList; | ||
| 559 | + let str2 = checkAnswer( | ||
| 560 | + str, | ||
| 561 | + type, | ||
| 562 | + this.formAns.answerOptions.split(",").length, | ||
| 563 | + this.formAns.subNum | ||
| 564 | + ); | ||
| 565 | + this.formAns.answerList = str2; | ||
| 566 | + | ||
| 891 | }, | 567 | }, |
| 892 | setAnswer(type, ans) { | 568 | setAnswer(type, ans) { |
| 893 | let txt = ""; | 569 | let txt = ""; |
| @@ -900,9 +576,12 @@ export default { | @@ -900,9 +576,12 @@ export default { | ||
| 900 | } | 576 | } |
| 901 | return txt; | 577 | return txt; |
| 902 | }, | 578 | }, |
| 903 | - backStep1() { | 579 | + toStep(step) { |
| 904 | this.formatQuestionList(); | 580 | this.formatQuestionList(); |
| 905 | - this.step = 1; | 581 | + this.step = step; |
| 582 | + if(step==1){ | ||
| 583 | + this.formateQuestion() | ||
| 584 | + } | ||
| 906 | }, | 585 | }, |
| 907 | setStep1() { | 586 | setStep1() { |
| 908 | if (this.subjectList.length == 0) { | 587 | if (this.subjectList.length == 0) { |
| @@ -912,6 +591,7 @@ export default { | @@ -912,6 +591,7 @@ export default { | ||
| 912 | this.$refs["forms"].validate((valid) => { | 591 | this.$refs["forms"].validate((valid) => { |
| 913 | // 验证通过:保存 | 592 | // 验证通过:保存 |
| 914 | if (valid) { | 593 | if (valid) { |
| 594 | + this.formateQuestion() | ||
| 915 | this.step = 1; | 595 | this.step = 1; |
| 916 | } else { | 596 | } else { |
| 917 | this.$message.error("数据有误,请检查!"); | 597 | this.$message.error("数据有误,请检查!"); |
| @@ -919,194 +599,19 @@ export default { | @@ -919,194 +599,19 @@ export default { | ||
| 919 | } | 599 | } |
| 920 | }); | 600 | }); |
| 921 | }, | 601 | }, |
| 922 | - setStep2() { | ||
| 923 | - if (!this.form.questionList.length) { | ||
| 924 | - this.$message.warning("请添加题目!"); | ||
| 925 | - return; | ||
| 926 | - } | ||
| 927 | - //添加题目ID、序号 | ||
| 928 | - this.form.questionList.map((item, index) => { | ||
| 929 | - item.questionType = 0; | ||
| 930 | - item.subQuestions.map((items, indexs) => { | ||
| 931 | - items.questionId = this.setNum(index, indexs); | ||
| 932 | - items.questionIndex = this.setNum(index, indexs); | ||
| 933 | - }); | ||
| 934 | - }); | ||
| 935 | - //整理问题 | ||
| 936 | - this.form.questionList?.map((item) => { | ||
| 937 | - let types = [{}]; | ||
| 938 | - let addndex = 0; | ||
| 939 | - item.subQuestions.map((sub, index) => { | ||
| 940 | - if (!!sub.questionType) { | ||
| 941 | - if ( | ||
| 942 | - sub.questionType == types[addndex].qusType && | ||
| 943 | - sub.questionType != 5 | ||
| 944 | - ) { | ||
| 945 | - //同类型批量答案+1 | ||
| 946 | - types[addndex].subNum += 1; | ||
| 947 | - if ( | ||
| 948 | - types[addndex].answerOptions.length < sub.answerOptions.length | ||
| 949 | - ) { | ||
| 950 | - types[addndex].answerOptions = sub.answerOptions; | ||
| 951 | - } | ||
| 952 | - | ||
| 953 | - // types[addndex].answerList += this.setAnswer( | ||
| 954 | - // sub.questionType, | ||
| 955 | - // sub.correctAnswer | ||
| 956 | - // ); | ||
| 957 | - types[addndex].answerList = ""; | ||
| 958 | - if (index == item.subQuestions.length - 1) { | ||
| 959 | - //循环最后类型数量大于等于5,保存批量答案 | ||
| 960 | - if (types[addndex].subNum && types[addndex].subNum >= 5) { | ||
| 961 | - types[addndex].endIndex = sub.questionIndex; | ||
| 962 | - types[addndex].index = index; | ||
| 963 | - } | ||
| 964 | - } | ||
| 965 | - } else { | ||
| 966 | - if (types[addndex].subNum && types[addndex].subNum >= 5) { | ||
| 967 | - //不同类型时如果原有类型数量大于等于5,保存批量答案 | ||
| 968 | - types[addndex].endIndex = | ||
| 969 | - item.subQuestions[index - 1].questionIndex; | ||
| 970 | - types[addndex].index = index - 1; | ||
| 971 | - addndex += 1; | ||
| 972 | - types[addndex] = {}; | ||
| 973 | - } | ||
| 974 | - //不同类型初始化批量答案 | ||
| 975 | - types[addndex].qusType = sub.questionType; | ||
| 976 | - types[addndex].subNum = 1; | ||
| 977 | - types[addndex].answerOptions = sub.answerOptions; | ||
| 978 | - types[addndex].answerList = ""; | ||
| 979 | - } | ||
| 980 | - } | ||
| 981 | - }); | ||
| 982 | - for (let i = 0; i < types.length; i++) { | ||
| 983 | - if (types[i].subNum >= 5) { | ||
| 984 | - item.subQuestions.splice( | ||
| 985 | - types[i].index + i + 1, | ||
| 986 | - 0, | ||
| 987 | - deepClone(types[i]) | ||
| 988 | - ); | ||
| 989 | - } | ||
| 990 | - } | ||
| 991 | - }); | ||
| 992 | - this.step = 2; | ||
| 993 | - return; | ||
| 994 | - }, | 602 | + |
| 995 | //删除批量操作数据 | 603 | //删除批量操作数据 |
| 996 | formatQuestionList() { | 604 | formatQuestionList() { |
| 997 | for (let i = 0; i < this.form.questionList.length; i++) { | 605 | for (let i = 0; i < this.form.questionList.length; i++) { |
| 998 | - for ( | ||
| 999 | - let j = 0; | ||
| 1000 | - j < this.form.questionList[i].subQuestions.length; | ||
| 1001 | - j++ | ||
| 1002 | - ) { | ||
| 1003 | - if (this.form.questionList[i].subQuestions[j].qusType) { | ||
| 1004 | - this.form.questionList[i].subQuestions.splice(j, 1); | ||
| 1005 | - } | ||
| 1006 | - } | ||
| 1007 | - } | ||
| 1008 | - }, | ||
| 1009 | - openQuestion() { | ||
| 1010 | - this.questionForm = { ...questionForm }; | ||
| 1011 | - this.addQuestionVisible = true; | ||
| 1012 | - }, | ||
| 1013 | - //添加大题 | ||
| 1014 | - addQuestion() { | ||
| 1015 | - let subQuestions = []; | ||
| 1016 | - let questionsOptions = { | ||
| 1017 | - ...subQuesOptions, | ||
| 1018 | - selectNum: this.questionForm.selectNum, | ||
| 1019 | - score: this.questionForm.score, | ||
| 1020 | - partScore: this.questionForm.partScore, | ||
| 1021 | - questionType: | ||
| 1022 | - this.questionForm.questionType == 6 | ||
| 1023 | - ? 2 | ||
| 1024 | - : this.questionForm.questionType, | ||
| 1025 | - }; | ||
| 1026 | - switch (questionsOptions.questionType) { | ||
| 1027 | - case 2: | ||
| 1028 | - questionsOptions.answerOptions = this.rightOptions | ||
| 1029 | - .slice(0, questionsOptions.selectNum) | ||
| 1030 | - .join(","); | ||
| 1031 | - break; | ||
| 1032 | - case 3: | ||
| 1033 | - questionsOptions.answerOptions = this.rightOptions | ||
| 1034 | - .slice(0, questionsOptions.selectNum) | ||
| 1035 | - .join(","); | ||
| 1036 | - break; | ||
| 1037 | - case 4: | ||
| 1038 | - questionsOptions.selectNum = 0; | ||
| 1039 | - questionsOptions.answerOptions = "1,2"; | ||
| 1040 | - break; | ||
| 1041 | - case 5: | ||
| 1042 | - questionsOptions.selectNum = 0; | ||
| 1043 | - break; | ||
| 1044 | - } | ||
| 1045 | - for (let i = 0; i < this.questionForm.number; i++) { | ||
| 1046 | - let answer = ""; | ||
| 1047 | - if (questionsOptions.questionType == 4) { | ||
| 1048 | - answer = | ||
| 1049 | - this.questionForm.answerList[i] == "✓" | ||
| 1050 | - ? 1 | ||
| 1051 | - : this.questionForm.answerList[i] == "✗" | ||
| 1052 | - ? 2 | ||
| 1053 | - : ""; | ||
| 1054 | - } else if (questionsOptions.questionType == 3) { | ||
| 1055 | - answer = this.questionForm.answerList.split(",")[i] || ""; | ||
| 1056 | - } else if (questionsOptions.questionType == 2) { | ||
| 1057 | - answer = this.questionForm.answerList[i] || ""; | 606 | + if (this.form.questionList[i].qusType) { |
| 607 | + this.form.questionList.splice(i, 1); | ||
| 1058 | } | 608 | } |
| 1059 | - questionsOptions.correctAnswer = answer; | ||
| 1060 | - subQuestions.push({ ...questionsOptions }); | ||
| 1061 | } | 609 | } |
| 1062 | - this.form.questionList.push({ | ||
| 1063 | - questionTitle: this.questionForm.questionTitle, | ||
| 1064 | - number: this.questionForm.number, | ||
| 1065 | - source: 10, | ||
| 1066 | - subQuestions: [...subQuestions], | ||
| 1067 | - show: false, | ||
| 1068 | - }); | ||
| 1069 | - this.addQuestionVisible = false; | ||
| 1070 | }, | 610 | }, |
| 1071 | - //删除小题 | ||
| 1072 | - delTabData(subIndex, index) { | ||
| 1073 | - this.form.questionList[index].subQuestions.splice(subIndex, 1); | ||
| 1074 | - }, | ||
| 1075 | - setScore(question) { | ||
| 1076 | - let score = question.subQuestions.reduce((a, b) => { | ||
| 1077 | - return a + (b.score ? b.score : 0); | ||
| 1078 | - }, 0); | ||
| 1079 | - return Number(score).toFixed(2); | ||
| 1080 | - }, | ||
| 1081 | - changeAddSubQuestions(val, question) { | ||
| 1082 | - if (val) { | ||
| 1083 | - let questionsOptions = { | ||
| 1084 | - ...subQuesOptions, | ||
| 1085 | - questionType: val, | ||
| 1086 | - }; | ||
| 1087 | - switch (questionsOptions.questionType) { | ||
| 1088 | - case 2: | ||
| 1089 | - questionsOptions.answerOptions = this.rightOptions | ||
| 1090 | - .slice(0, questionsOptions.selectNum) | ||
| 1091 | - .join(","); | ||
| 1092 | - break; | ||
| 1093 | - case 3: | ||
| 1094 | - questionsOptions.answerOptions = this.rightOptions | ||
| 1095 | - .slice(0, questionsOptions.selectNum) | ||
| 1096 | - .join(","); | ||
| 1097 | - questionsOptions.partScore = 0; | ||
| 1098 | - break; | ||
| 1099 | - case 4: | ||
| 1100 | - questionsOptions.selectNum = 0; | ||
| 1101 | - questionsOptions.answerOptions = "1,2"; | ||
| 1102 | - break; | ||
| 1103 | - case 5: | ||
| 1104 | - questionsOptions.selectNum = 0; | ||
| 1105 | - break; | ||
| 1106 | - } | ||
| 1107 | - question.subQuestions.push(questionsOptions); | ||
| 1108 | - this.addSubQuestionsType = ""; | ||
| 1109 | - } | 611 | + //删除题 |
| 612 | + delTabData(index) { | ||
| 613 | + this.form.questionList.splice(index, 1); | ||
| 614 | + this.formateQuestion() | ||
| 1110 | }, | 615 | }, |
| 1111 | //切换多题型-小题题型 | 616 | //切换多题型-小题题型 |
| 1112 | changeSubQuestions(val, subQuestions) { | 617 | changeSubQuestions(val, subQuestions) { |
| @@ -1168,107 +673,21 @@ export default { | @@ -1168,107 +673,21 @@ export default { | ||
| 1168 | sub.correctAnswer = arrs.sort().join(""); | 673 | sub.correctAnswer = arrs.sort().join(""); |
| 1169 | } | 674 | } |
| 1170 | }, | 675 | }, |
| 1171 | - openTagDia() { | ||
| 1172 | - this.tagList = deepClone(this.answerTypeList); | ||
| 1173 | - this.dialogVisible = true; | ||
| 1174 | - }, | ||
| 1175 | - async editTypeName(obj) { | ||
| 1176 | - let isRepeat = false; | ||
| 1177 | - this.answerTypeList.map((item) => { | ||
| 1178 | - if (item.typeName == obj.typeName) { | ||
| 1179 | - isRepeat = true; | ||
| 1180 | - } | ||
| 1181 | - }); | ||
| 1182 | - if (isRepeat) { | ||
| 1183 | - this.$message.error("类型已存在请重新填写!"); | ||
| 1184 | - return; | ||
| 1185 | - } | ||
| 1186 | - //修改测验类型 | ||
| 1187 | - let editPaperType = | ||
| 1188 | - this.role == "ROLE_PERSONAL" | ||
| 1189 | - ? this.$request.pModifyPaperType | ||
| 1190 | - : this.$request.editPaperType; | ||
| 1191 | - const { data, status, info } = await editPaperType({ | ||
| 1192 | - tagId: obj.id, | ||
| 1193 | - tag: obj.typeName, | ||
| 1194 | - }); | ||
| 1195 | - if (status == 0) { | ||
| 1196 | - await this._TypeList(); | ||
| 1197 | - this.tagList = deepClone(this.answerTypeList); | ||
| 1198 | - this.$message.success("修改成功"); | ||
| 1199 | - } else { | ||
| 1200 | - this.$message.error(info); | ||
| 1201 | - } | ||
| 1202 | - }, | ||
| 1203 | - async removeTypeName(obj) { | ||
| 1204 | - //删除测验类型 | ||
| 1205 | - let delPaperType = | ||
| 1206 | - this.role == "ROLE_PERSONAL" | ||
| 1207 | - ? this.$request.pDelPaperType | ||
| 1208 | - : this.$request.delPaperType; | ||
| 1209 | - const { data, status, info } = await delPaperType({ | ||
| 1210 | - tagId: obj.id, | ||
| 1211 | - }); | ||
| 1212 | - if (status == 0) { | ||
| 1213 | - await this._TypeList(); | ||
| 1214 | - this.tagList = deepClone(this.answerTypeList); | ||
| 1215 | - this.$message.success("删除成功"); | ||
| 1216 | - } else { | ||
| 1217 | - this.$message.error(info); | ||
| 1218 | - } | ||
| 1219 | - }, | ||
| 1220 | - async addPaperType() { | ||
| 1221 | - //保存测验类型 | ||
| 1222 | - if (!this.answerTypeName) { | ||
| 1223 | - this.$message.error("请填写测验名称!"); | ||
| 1224 | - return; | ||
| 1225 | - } | ||
| 1226 | - let isRepeat = false; | ||
| 1227 | - this.answerTypeList.map((item) => { | ||
| 1228 | - if (item.typeName == this.answerTypeName) { | ||
| 1229 | - isRepeat = true; | ||
| 1230 | - } | ||
| 1231 | - }); | ||
| 1232 | - if (isRepeat) { | ||
| 1233 | - this.$message.error("类型已存在请重新填写!"); | ||
| 1234 | - return; | ||
| 1235 | - } | ||
| 1236 | - //添加测验类型 | ||
| 1237 | - let addPaperType = | ||
| 1238 | - this.role == "ROLE_PERSONAL" | ||
| 1239 | - ? this.$request.pAddPaperType | ||
| 1240 | - : this.$request.addPaperType; | ||
| 1241 | - const { data, status, info } = await addPaperType({ | ||
| 1242 | - tag: this.answerTypeName, | ||
| 1243 | - }); | ||
| 1244 | - if (status == 0) { | ||
| 1245 | - await this._TypeList(); | ||
| 1246 | - this.tagList = deepClone(this.answerTypeList); | ||
| 1247 | - this.form.tagId = data || ""; | ||
| 1248 | - this.answerTypeName = ""; | ||
| 1249 | - this.$message.success("添加成功"); | ||
| 1250 | - } else { | ||
| 1251 | - this.$message.error(info); | ||
| 1252 | - } | ||
| 1253 | - }, | 676 | + |
| 677 | + | ||
| 678 | + | ||
| 679 | + | ||
| 1254 | async save() { | 680 | async save() { |
| 1255 | if (this.saveLoading) return; | 681 | if (this.saveLoading) return; |
| 1256 | this.saveLoading = true; | 682 | this.saveLoading = true; |
| 1257 | this.formatQuestionList(); | 683 | this.formatQuestionList(); |
| 1258 | let formDatas = deepClone(this.form); | 684 | let formDatas = deepClone(this.form); |
| 1259 | - for (let i = 0; i < formDatas.questionList.length; i++) { | ||
| 1260 | - delete formDatas.questionList[i].show; | ||
| 1261 | - for (let j = 0; j < formDatas.questionList[i].subQuestions; j++) { | ||
| 1262 | - if (!!formDatas.questionList[i].subQuestions[j].screenshotSrc) { | ||
| 1263 | - delete formDatas.questionList[i].subQuestions[j].screenshotSrc; | ||
| 1264 | - } | ||
| 1265 | - } | ||
| 1266 | - } | ||
| 1267 | let addPaper = | 685 | let addPaper = |
| 1268 | this.role == "ROLE_PERSONAL" | 686 | this.role == "ROLE_PERSONAL" |
| 1269 | ? this.$request.pAddPaper | 687 | ? this.$request.pAddPaper |
| 1270 | : this.$request.addPaper; | 688 | : this.$request.addPaper; |
| 1271 | const { data, status, info } = await addPaper({ | 689 | const { data, status, info } = await addPaper({ |
| 690 | + type: 1, | ||
| 1272 | ...formDatas, | 691 | ...formDatas, |
| 1273 | }); | 692 | }); |
| 1274 | this.saveLoading = false; | 693 | this.saveLoading = false; |
| @@ -1284,30 +703,7 @@ export default { | @@ -1284,30 +703,7 @@ export default { | ||
| 1284 | //切换年级查询科目 | 703 | //切换年级查询科目 |
| 1285 | this._QuerySubjectList(this.form.gradeName); | 704 | this._QuerySubjectList(this.form.gradeName); |
| 1286 | }, | 705 | }, |
| 1287 | - async _TypeList() { | ||
| 1288 | - //测验类型查询 | ||
| 1289 | - let fetchTypeNames = | ||
| 1290 | - this.role == "ROLE_PERSONAL" | ||
| 1291 | - ? this.$request.pPaperTagList | ||
| 1292 | - : this.$request.fetchTypeNames; | ||
| 1293 | - const { data, status, info } = await fetchTypeNames({ | ||
| 1294 | - type: 1, | ||
| 1295 | - }); | ||
| 1296 | - if (status == 0) { | ||
| 1297 | - this.answerTypeList = | ||
| 1298 | - data.list?.map((item) => { | ||
| 1299 | - return { | ||
| 1300 | - typeName: item.tag, | ||
| 1301 | - id: item.tagId, | ||
| 1302 | - }; | ||
| 1303 | - }) || []; | ||
| 1304 | - if (this.type != 2) { | ||
| 1305 | - this.form.tagId = this.answerTypeList[0]?.id || ""; | ||
| 1306 | - } | ||
| 1307 | - } else { | ||
| 1308 | - this.$message.error(info); | ||
| 1309 | - } | ||
| 1310 | - }, | 706 | + |
| 1311 | async _GradeList() { | 707 | async _GradeList() { |
| 1312 | //查询年级列表 | 708 | //查询年级列表 |
| 1313 | const { data, status, info } = await this.$request.fetchGradeList(); | 709 | const { data, status, info } = await this.$request.fetchGradeList(); |
| @@ -1360,57 +756,72 @@ export default { | @@ -1360,57 +756,72 @@ export default { | ||
| 1360 | }); | 756 | }); |
| 1361 | if (status == 0) { | 757 | if (status == 0) { |
| 1362 | this.form.title = data.title + "_副本"; | 758 | this.form.title = data.title + "_副本"; |
| 1363 | - this.form.tagId = data.tagId === 0 ? "" : data.tagId; | ||
| 1364 | - if (this.subjectList.length) { | ||
| 1365 | - this.subjectList.map((item) => { | ||
| 1366 | - if (item.label == data.subjectName) { | ||
| 1367 | - this.form.subjectName = item.value; | ||
| 1368 | - } | ||
| 1369 | - }); | ||
| 1370 | - } else { | ||
| 1371 | - this.form.subjectName = ""; | ||
| 1372 | - } | ||
| 1373 | - this.form.examsDuration = data.examsDuration; | ||
| 1374 | if (this.role != "ROLE_PERSONAL") { | 759 | if (this.role != "ROLE_PERSONAL") { |
| 1375 | this.form.sharingType = data.sharingType; | 760 | this.form.sharingType = data.sharingType; |
| 1376 | - if (this.gradeList.length) { | ||
| 1377 | - this.gradeList.map((item) => { | ||
| 1378 | - if (item == data.gradeName) { | ||
| 1379 | - this.form.gradeName = data.gradeName; | ||
| 1380 | - } | ||
| 1381 | - }); | ||
| 1382 | - } else { | ||
| 1383 | - this.form.gradeName = ""; | ||
| 1384 | - } | ||
| 1385 | } | 761 | } |
| 1386 | - this.form.questionList = data.questionList?.map((item) => { | ||
| 1387 | - let subQuestions = | ||
| 1388 | - item.subQuestions?.map((items) => { | ||
| 1389 | - return { | ||
| 1390 | - questionType: items.questionType, | ||
| 1391 | - score: items.score, | ||
| 1392 | - partScore: items.partScore, | ||
| 1393 | - selectNum: items.answerOptions.split(",").length, | ||
| 1394 | - answerOptions: items.answerOptions || "A,B,C,D", | ||
| 1395 | - correctAnswer: items.correctAnswer, | ||
| 1396 | - screenshot: items.screenshot || "", | ||
| 1397 | - screenshotSrc: items.screenshot || "", | ||
| 1398 | - }; | ||
| 1399 | - }) || []; | ||
| 1400 | - return { | ||
| 1401 | - questionTitle: item.questionTitle, | ||
| 1402 | - subQuestions: subQuestions, | ||
| 1403 | - show: false, | ||
| 1404 | - }; | ||
| 1405 | - }); | 762 | + this.formatData(data) |
| 1406 | } else { | 763 | } else { |
| 1407 | this.$message.error(info); | 764 | this.$message.error(info); |
| 1408 | } | 765 | } |
| 1409 | }, | 766 | }, |
| 767 | + formatData(data) { | ||
| 768 | + if (this.subjectList.length) { | ||
| 769 | + this.subjectList.map((item) => { | ||
| 770 | + if (item.label == data.subjectName) { | ||
| 771 | + this.form.subjectName = item.value; | ||
| 772 | + } | ||
| 773 | + }); | ||
| 774 | + } else { | ||
| 775 | + this.form.subjectName = ""; | ||
| 776 | + } | ||
| 777 | + | ||
| 778 | + if (this.role != "ROLE_PERSONAL") { | ||
| 779 | + if (this.gradeList.length) { | ||
| 780 | + this.gradeList.map((item) => { | ||
| 781 | + if (item == data.gradeName) { | ||
| 782 | + this.form.gradeName = data.gradeName; | ||
| 783 | + } | ||
| 784 | + }); | ||
| 785 | + } else { | ||
| 786 | + this.form.gradeName = ""; | ||
| 787 | + } | ||
| 788 | + } | ||
| 789 | + this.form.questionList = data.questionList?.map((item) => { | ||
| 790 | + 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 || "", | ||
| 799 | + } | ||
| 800 | + }); | ||
| 801 | + } | ||
| 1410 | }, | 802 | }, |
| 1411 | }; | 803 | }; |
| 1412 | </script> | 804 | </script> |
| 805 | +<style> | ||
| 806 | +.screenshot-box { | ||
| 807 | + width: 400px; | ||
| 808 | +} | ||
| 1413 | 809 | ||
| 810 | +.screenshot { | ||
| 811 | + width: 100%; | ||
| 812 | + box-shadow: none; | ||
| 813 | + border: none; | ||
| 814 | + height: 300px; | ||
| 815 | +} | ||
| 816 | + | ||
| 817 | +.screenshot-img { | ||
| 818 | + display: block; | ||
| 819 | + width: auto; | ||
| 820 | + max-width: 100%; | ||
| 821 | + margin: 0 auto; | ||
| 822 | + margin-bottom: 10px; | ||
| 823 | +} | ||
| 824 | +</style> | ||
| 1414 | <style lang="scss" scoped> | 825 | <style lang="scss" scoped> |
| 1415 | .red { | 826 | .red { |
| 1416 | color: #f30; | 827 | color: #f30; |
| @@ -1561,6 +972,16 @@ export default { | @@ -1561,6 +972,16 @@ export default { | ||
| 1561 | 972 | ||
| 1562 | .question-box { | 973 | .question-box { |
| 1563 | margin-bottom: 20px; | 974 | margin-bottom: 20px; |
| 975 | + | ||
| 976 | + .screenshot-box { | ||
| 977 | + width: 100%; | ||
| 978 | + border: 1px solid #e2e2e2; | ||
| 979 | + margin-bottom: 20px; | ||
| 980 | + | ||
| 981 | + .screenshot-img { | ||
| 982 | + margin: 0; | ||
| 983 | + } | ||
| 984 | + } | ||
| 1564 | } | 985 | } |
| 1565 | 986 | ||
| 1566 | .question-title { | 987 | .question-title { |
| @@ -1704,7 +1125,9 @@ export default { | @@ -1704,7 +1125,9 @@ export default { | ||
| 1704 | .qs-options { | 1125 | .qs-options { |
| 1705 | flex: 1; | 1126 | flex: 1; |
| 1706 | } | 1127 | } |
| 1707 | - | 1128 | + .qs-upload{ |
| 1129 | + width: 60px; | ||
| 1130 | + } | ||
| 1708 | .qs-set { | 1131 | .qs-set { |
| 1709 | width: 60px; | 1132 | width: 60px; |
| 1710 | } | 1133 | } |