Commit cb6ceaa8ef0af648a0a72fa3a7cde6d89b1e68b4

Authored by 梁保满
1 parent 3ca58022

添加备题,组卷参数调整

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