Commit 3ca580224a1ba4fff97e95c34eea8fe929e6f592

Authored by 梁保满
1 parent 8af7657f

修改添加组卷题目解析,知识点梳理等

src/views/examinationPaper/add.vue
... ... @@ -326,6 +326,8 @@
326 326 <div class="qs-partScore">漏选得分</div>
327 327 <div class="qs-options qs-options2">选项设置</div>
328 328 <div class="qs-upload" v-if="isUpload">提干</div>
  329 + <div class="qs-upload" v-if="isUpload">题目解析</div>
  330 + <div class="qs-upload" v-if="isUpload">知识点</div>
329 331 <div class="qs-set">操作</div>
330 332 </li>
331 333 <li v-for="(subQuestions, indexs) in question.subQuestions" :key="indexs">
... ... @@ -381,22 +383,44 @@
381 383 " :key="option" @click="subQuestions.correctAnswer = option">{{ option }}</span>
382 384 </p>
383 385 </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>
  386 + <template v-if="isUpload">
  387 + <div class="qs-upload">
  388 + <el-popover placement="right" width="400" trigger="click">
  389 + <div class="screenshot-box">
  390 + <iframe class="screenshot"
  391 + v-if="subQuestions.screenshot && subQuestions.screenshot.includes('html')"
  392 + :src="subQuestions.screenshot"></iframe>
  393 + <img class="screenshot screenshot-img"
  394 + v-if="subQuestions.screenshot && !subQuestions.screenshot.includes('html')"
  395 + :src="subQuestions.screenshot" alt="">
  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>
  398 + </div>
  399 + <el-button slot="reference" class="icon-tickets" type="primary" circle size="mini"
  400 + icon="el-icon-tickets"></el-button>
  401 + </el-popover>
  402 + </div>
  403 + <div class="qs-upload">
  404 + <el-popover placement="right" width="400" trigger="click">
  405 + <div class="screenshot-box">
  406 + <iframe class="screenshot"
  407 + v-if="subQuestions.answerScreenshot && subQuestions.answerScreenshot.includes('html')"
  408 + :src="subQuestions.answerScreenshot"></iframe>
  409 + <img class="screenshot screenshot-img"
  410 + v-if="subQuestions.answerScreenshot && !subQuestions.answerScreenshot.includes('html')"
  411 + :src="subQuestions.answerScreenshot" alt="">
  412 + <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>
  414 + </div>
  415 + <el-button slot="reference" class="icon-tickets" type="primary" circle size="mini"
  416 + icon="el-icon-tickets"></el-button>
  417 + </el-popover>
  418 + </div>
  419 + <div class="qs-upload">
  420 + <el-button type="primary" circle size="mini" icon="el-icon-price-tag"
  421 + @click="openKnowledge(subQuestions, index, indexs)"></el-button>
  422 + </div>
  423 + </template>
400 424 <div class="qs-set">
401 425  
402 426 <el-popconfirm title="确定删除这道题吗?" @confirm="delTabData(indexs, index)">
... ... @@ -489,20 +513,44 @@
489 513 <el-button type="primary" round @click="save">保存</el-button>
490 514 </div>
491 515 </div>
492   - <el-dialog :close-on-click-modal="false" title="上传题干" :visible.sync="dialogStem" v-if="dialogStem" width="500">
  516 + <el-dialog :close-on-click-modal="false" :title="stem.type == 1 ? '上传题干' : '上传题目解析'" :visible.sync="dialogStem"
  517 + v-if="dialogStem" width="500">
493 518 <div class="upload-box">
494   - <img v-if="stem.screenshot && !stem.screenshot.includes('html')" :src="stem.screenshot" class="stem-pic" />
  519 + <template v-show="stem.type == 1">
  520 + <img v-if="stem.screenshot && !stem.screenshot.includes('html')" :src="stem.screenshot" class="stem-pic" />
  521 + </template>
  522 + <template v-show="stem.type == 2">
  523 + <img v-if="stem.answerScreenshot && !stem.answerScreenshot.includes('html')" :src="stem.answerScreenshot"
  524 + class="stem-pic" />
  525 + </template>
495 526 <el-upload class="upload-demo" action="http://121.40.127.171/file/uploadImg" :limit="1" :on-success="upSuccess"
496 527 :on-error="upError" accept="image/*">
497   - <el-button size="small" type="primary">{{
  528 + <el-button v-show="stem.type == 1" size="small" type="primary">{{
498 529 stem.screenshot && !stem.screenshot.includes('html') ? "重新上传" : "选择照片"
499 530 }}</el-button>
  531 + <el-button v-show="stem.type == 2" size="small" type="primary">{{
  532 + stem.answerScreenshot && !stem.answerScreenshot.includes('html') ? "重新上传" : "选择照片"
  533 + }}</el-button>
500 534 </el-upload>
501 535 </div>
502 536 <div slot="footer">
503 537 <el-button @click="dialogStem = false">确定</el-button>
504 538 </div>
505 539 </el-dialog>
  540 + <el-dialog :close-on-click-modal="false" title="知识点" :visible.sync="dialogKnowledge" width="500">
  541 + <div>
  542 + <el-form ref="form" :model="stem" label-width="160px">
  543 + <el-form-item label="知识点:">
  544 + <el-cascader size="small" filterable :show-all-levels="false" collapse clearable placeholder="选择知识点"
  545 + v-model="stem.knowledge" :options="knowledgeData" :props="{ expandTrigger: 'hover' }"></el-cascader>
  546 + </el-form-item>
  547 + </el-form>
  548 + </div>
  549 + <div slot="footer">
  550 + <el-button @click="dialogKnowledge = false">取 消</el-button>
  551 + <el-button type="primary" @click="setKnowledge">确 定</el-button>
  552 + </div>
  553 + </el-dialog>
506 554 </div>
507 555 </div>
508 556 </template>
... ... @@ -526,6 +574,7 @@ const subQuesOptions = {
526 574 answerOptions: "A,B,C,D",
527 575 correctAnswer: "",
528 576 };
  577 +import knowledgeList from "assets/js/knowledgeList.js";
529 578 export default {
530 579 computed: {
531 580 allScore: function () {
... ... @@ -537,6 +586,24 @@ export default {
537 586 }, 0);
538 587 return Number(score).toFixed(2);
539 588 },
  589 + // 知识点列表 根据学段-科目筛选
  590 + knowledgeData: function () {
  591 + let jsons = []
  592 + if (this.form.gradeName && this.form.subjectName) {
  593 + let sectionName = ""
  594 + this.gradeClassList.map(item => {
  595 + if (this.form.gradeName == item.gradeName) {
  596 + sectionName = item.sectionName
  597 + }
  598 + })
  599 + if (sectionName && Object.keys(this.knowledgeList).includes(sectionName)) {
  600 + if (Object.keys(this.knowledgeList[sectionName]).includes(this.form.subjectName)) {
  601 + jsons = this.knowledgeList[sectionName][this.form.subjectName]
  602 + }
  603 + }
  604 + }
  605 + return jsons
  606 + },
540 607 },
541 608 watch: {
542 609 step: function () {
... ... @@ -549,6 +616,7 @@ export default {
549 616 return {
550 617 role: "",
551 618 step: 0, //步骤
  619 + gradeClassList: [], //年级-班级数据
552 620 gradeList: [], //年级
553 621 subjectList: [], //科目
554 622 answerTypeList: [], //测验类型
... ... @@ -617,12 +685,17 @@ export default {
617 685 addSubQuestionsType: "",
618 686  
619 687 //v1.5
  688 + knowledgeList: { ...knowledgeList },
620 689 isUpload: false,
621 690 dialogStem: false, //截图开关
  691 + dialogKnowledge: false, //知识点开关
622 692 stem: {
  693 + type: 1,
623 694 index: 0, //大题位置
624 695 indexs: 0, //小题位置
625 696 screenshot: "", //题干图片地址
  697 + answerScreenshot: "", //题目解析图片地址
  698 + knowledge: [], //知识点
626 699 },
627 700 };
628 701 },
... ... @@ -655,26 +728,52 @@ export default {
655 728 methods: {
656 729 // v1.5
657 730 //上传截图
658   - openStem(obj, index, indexs) {
  731 + openStem(obj, index, indexs, type) {
659 732 this.stem.index = index;
660 733 this.stem.indexs = indexs;
661   - this.stem.screenshot = obj.screenshot || "";
  734 + this.stem.type = type;
  735 + if (type == 1) {
  736 + this.stem.screenshot = obj.screenshot || "";
  737 + this.stem.answerScreenshot = "";
  738 + } else {
  739 + this.stem.answerScreenshot = obj.answerScreenshot || "";
  740 + this.stem.screenshot = "";
  741 + }
  742 +
662 743 this.dialogStem = true;
663 744 },
664   - //图片上传成功
665   - upSuccess(res, file) {
  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 + },
  752 + // 图片上传成功
  753 + upSuccess(res) {
666 754 if (res && res.status == 0) {
667   - this.stem.screenshot = res.data.url;
668   - this.form.questionList[this.stem.index].subQuestions[this.stem.indexs].screenshot = this.stem.screenshot;
  755 + if (this.stem.type == 1) {
  756 + this.stem.screenshot = res.data.url;
  757 + this.form.questionList[this.stem.index].subQuestions[this.stem.indexs].screenshot = this.stem.screenshot;
  758 + } else {
  759 + this.stem.answerScreenshot = res.data.url;
  760 + this.form.questionList[this.stem.index].subQuestions[this.stem.indexs].answerScreenshot = this.stem.answerScreenshot;
  761 + }
669 762 this.$message.success("上传成功");
670 763 } else {
671 764 this.$message.error(res.info);
672 765 }
673 766 },
674   -
675 767 upError(res) {
676 768 this.$message.error("上传失败");
677 769 },
  770 + // 知识点
  771 + setKnowledge() {
  772 + this.form.questionList[this.stem.index].subQuestions[
  773 + this.stem.indexs
  774 + ].knowledge = this.stem.knowledge.join(",");
  775 + this.dialogKnowledge = false;
  776 + },
678 777 //end
679 778  
680 779 //取消创建
... ... @@ -849,7 +948,7 @@ export default {
849 948 return this.formAns.endIndex == item.questionIndex
850 949 }
851 950 );
852   - console.log(EndIndex)
  951 + console.log(EndIndex)
853 952 for (let i = 0; i <= subNum; i++) {
854 953 let correctAnswer = "";
855 954 if (this.formAns.qusType == 2) {
... ... @@ -1349,9 +1448,24 @@ export default {
1349 1448 },
1350 1449 async _GradeList() {
1351 1450 //查询年级列表
1352   - const { data, status, info } = await this.$request.fetchGradeList();
  1451 + // const { data, status, info } = await this.$request.fetchGradeList();
  1452 + // 查找班级
  1453 +
  1454 + let fetchClassList =
  1455 + this.role == "ROLE_PERSONAL"
  1456 + ? this.$request.pClassList
  1457 + : this.$request.fetchClassList;
  1458 +
  1459 + const { data, status, info } = await fetchClassList();
1353 1460 if (status == 0) {
1354   - this.gradeList = (data.gradeNames && [...data.gradeNames]) || [];
  1461 + this.gradeClassList = data.list?.map((item) => {
  1462 + console.log(!this.gradeList.includes(item.gradeName))
  1463 + if (!this.gradeList.includes(item.gradeName)) {
  1464 + this.gradeList.push(item.gradeName)
  1465 + }
  1466 + return item
  1467 + })
  1468 + // this.gradeList = (data.gradeNames && [...data.gradeNames]) || [];
1355 1469 if (this.type != 2) {
1356 1470 this.form.gradeName = this.gradeList[0];
1357 1471 }
... ...
src/views/examinationPaper/index.vue
... ... @@ -12,18 +12,15 @@
12 12 </back-box>
13 13 <div class="examinationPaper-type">
14 14 <el-button-group>
15   - <el-button size="large" :type="examinationPaperType == 1 ? 'primary' : 'default'"
16   - @click="examinationPaperType = 1">备题</el-button>
17   - <el-button size="large" :type="examinationPaperType == 2 ? 'primary' : 'default'"
18   - @click="examinationPaperType = 2">组卷</el-button>
  15 + <el-button size="large" :type="query.type == 1 ? 'primary' : 'default'" @click="changPaperType(1)">备题</el-button>
  16 + <el-button size="large" :type="query.type == 2 ? 'primary' : 'default'" @click="changPaperType(2)">组卷</el-button>
19 17 </el-button-group>
20 18  
21 19 <p>
22   - <el-button v-if="examinationPaperType == 1" type="primary" size="mini" icon="el-icon-plus" round
23   - @click="diaUp = true">
  20 + <el-button v-if="query.type == 1" type="primary" size="mini" icon="el-icon-plus" round @click="diaUp = true">
24 21 导入课件</el-button>
25 22  
26   - <el-dropdown v-if="examinationPaperType == 2" trigger="click" @command="handleAdd">
  23 + <el-dropdown v-if="query.type == 2" trigger="click" @command="handleAdd">
27 24 <el-button type="primary" size="mini" icon="el-icon-plus" round>添加试卷</el-button>
28 25 <el-dropdown-menu slot="dropdown">
29 26 <el-dropdown-item :command="1">导入试卷</el-dropdown-item>
... ... @@ -54,9 +51,9 @@
54 51 </p>
55 52 <div class="content">
56 53 <p class="tab-box">
57   - <span :class="['tab-s', query.type == 1 ? 'active' : '']" @click="changType(1)">我自编的 ({{ totalCount.my
  54 + <span :class="['tab-s', query.share == 0 ? 'active' : '']" @click="changShare(0)">我自编的 ({{ totalCount.my
58 55 }})</span>
59   - <span :class="['tab-s', query.type == 2 ? 'active' : '']" @click="changType(2)">年级共享的 ({{ totalCount.share
  56 + <span :class="['tab-s', query.share == 1 ? 'active' : '']" @click="changShare(1)">年级共享的 ({{ totalCount.share
60 57 }})</span>
61 58 </p>
62 59 <ul v-if="tableData && tableData.length" v-loading="loading">
... ... @@ -102,7 +99,7 @@
102 99 <el-dropdown-menu slot="dropdown">
103 100 <el-dropdown-item :command="1"
104 101 v-if="userName == item.realName && role != 'ROLE_PERSONAL'">修改分享范围</el-dropdown-item>
105   - <el-dropdown-item :command="2">复制</el-dropdown-item>
  102 + <el-dropdown-item v-show="query.type == 2" :command="2">复制</el-dropdown-item>
106 103 <el-dropdown-item :command="3">放入回收站</el-dropdown-item>
107 104 </el-dropdown-menu>
108 105 </el-dropdown>
... ... @@ -133,7 +130,7 @@
133 130 </div>
134 131 </el-dialog>
135 132 <el-dialog :close-on-click-modal="false" title="上传word文档" :visible.sync="diaUp" width="600">
136   - <upload :url="url" :params="{ type: examinationPaperType }" @upSuccess="upSuccess" fileName="下载">
  133 + <upload :url="url" :params="{ type: query.type }" @upSuccess="upSuccess" fileName="下载">
137 134 <div class="down-box" slot="down">
138 135 <p>第一步:导出菁优网试卷或
139 136 <el-link type="danger" @click="downExcel">模板下载</el-link> 。
... ... @@ -163,6 +160,7 @@ export default {
163 160 subjectName: "",
164 161 title: "",
165 162 type: 1, //试卷类型
  163 + share: 0, //分享类型
166 164 },
167 165 classList: [],
168 166 subjectList: [],
... ... @@ -187,7 +185,6 @@ export default {
187 185 share: 0,
188 186 },
189 187 diaUp: false,//上传word弹窗开关
190   - examinationPaperType: 1,//题型类型
191 188 url: "/api_html/common/paper/upload",//上传文档地址
192 189 };
193 190 },
... ... @@ -217,6 +214,7 @@ export default {
217 214 path: "/examinationPaperArchiving",
218 215 });
219 216 },
  217 + //去备题
220 218 toAdd(query) {
221 219 if (!this.query.classId) {
222 220 this.$message.warning("没有任课班级,请先设置。");
... ... @@ -228,6 +226,18 @@ export default {
228 226 query ? (routerItem["query"] = { ...query }) : "";
229 227 this.$router.push(routerItem);
230 228 },
  229 + //去组卷
  230 + toAddAsk(query) {
  231 + if (!this.query.classId) {
  232 + this.$message.warning("没有任课班级,请先设置。");
  233 + return;
  234 + }
  235 + let routerItem = {
  236 + path: "/examinationPaperAddAsk",
  237 + };
  238 + query ? (routerItem["query"] = { ...query }) : "";
  239 + this.$router.push(routerItem);
  240 + },
231 241 toEdit(item) {
232 242 this.$router.push({
233 243 path: "/examinationPaperEdit",
... ... @@ -255,6 +265,10 @@ export default {
255 265 break;
256 266 }
257 267 },
  268 + changPaperType(type) {
  269 + this.query.type = type
  270 + this.changShare(1)
  271 + },
258 272 changePage(page) {
259 273 this.page = page;
260 274 this._QueryData(this.query.title);
... ... @@ -295,18 +309,20 @@ export default {
295 309 },
296 310 //根据试卷名称查找
297 311 async getData(bool) {
  312 + this.page = 1;
298 313 this._QueryData(bool);
299 314 this._QueryTotal();
300 315 },
301 316 //切换班级
302 317 async changClazz() {
  318 + this.page = 1;
303 319 await this._QuerySubjectList();
304 320 this._QueryData(false);
305 321 this._QueryTotal();
306 322 },
307 323 //切换类型
308   - async changType(type) {
309   - this.query.type = type
  324 + async changShare(share) {
  325 + this.query.share = share
310 326 this.page = 1;
311 327 this._QueryData(false);
312 328 },
... ... @@ -380,14 +396,10 @@ export default {
380 396 let query = {};
381 397 if (!type) {
382 398 this.query.title = "";
383   - query = { ...this.query };
384   - } else {
385   - query = { title: this.query.title };
386 399 }
387   - query.classId = this.query.classId;
388   - query.subjectName = this.query.subjectName;
  400 + query = { ...this.query };
389 401 for (let key in query) {
390   - if (!query[key]) {
  402 + if (!query[key] && query[key] !== 0) {
391 403 delete query[key]
392 404 }
393 405 }
... ... @@ -451,7 +463,11 @@ export default {
451 463 });
452 464 this.diaUp = false;
453 465 let params = JSON.stringify(res.data)
454   - this.toAdd({ params, isUpload: 1 })
  466 + if (this.query.type == 2) {
  467 + this.toAdd({ params, isUpload: 1 })
  468 + } else {
  469 + this.toAddAsk({ params })
  470 + }
455 471 }
456 472 },
457 473 handleAdd(value) {
... ...