diff --git a/src/views/examinationPaper/add.vue b/src/views/examinationPaper/add.vue index 240cf5f..6feff93 100644 --- a/src/views/examinationPaper/add.vue +++ b/src/views/examinationPaper/add.vue @@ -1070,8 +1070,8 @@ export default { } }, methods: { + //上传截图 openStem(obj, type, index, indexs) { - //上传截图 this.stem.type = type; this.stem.index = index; this.stem.indexs = indexs; @@ -1088,18 +1088,18 @@ export default { } this.dialogStem = true; }, + //难度,知识点 openTag(obj, type, index, indexs) { - //难度,知识点 this.stem = { ...this.stem, obj }; this.stem.type = type; this.stem.index = index; this.stem.indexs = indexs; - this.stem.knowledge = obj.knowledge&&obj.knowledge.split(",") || []; + this.stem.knowledge = (obj.knowledge && obj.knowledge.split(",")) || []; this.stem.difficultyFactor = obj.difficultyFactor || ""; this.dialogTag = true; }, + //图片上传成功 upSuccess(res, file) { - //图片上传成功 if (res && res.status == 0) { let keys = this.stem.type == 1 ? "screenshot" : "answerScreenshot"; this.stem[keys + "Src"] = res.data.url; @@ -1115,8 +1115,8 @@ export default { this.$message.error(res.info); } }, + //保存难度、知识点 setKnowledge() { - //保存难度、知识点 this.form.questionList[this.stem.index].subQuestions[ this.stem.indexs ].knowledge = this.stem.knowledge.join(","); @@ -1222,12 +1222,12 @@ export default { return txt; }, + //切换题型清空答案 setQuestionForm(val) { - //切换题型清空答案 this.questionForm.answerList = ""; }, + //减少题数设置答案 changeQesNum(val) { - //减少题数设置答案 if ( this.questionForm.questionType == 2 || this.questionForm.questionType == 4 @@ -1243,8 +1243,8 @@ export default { .join(","); } }, + //初始化要修改的答案 setFormAns(indexs, index) { - //初始化要修改的答案 this.formAns = { ...this.form.questionList[index].subQuestions[indexs] }; this.formAns.listIndex = index; let startIndex = this.formAns.index + 1 - this.formAns.subNum; //批量设置大难开始位置 @@ -1283,8 +1283,8 @@ export default { }; } }, + //多选答案设置 setMultiple(obj, answer, type) { - //多选答案设置 let elements = type == 1 ? this.$refs["formAnsIpt2"].$el.children[0] @@ -1311,8 +1311,8 @@ export default { elements.focus(); elements.selectionStart = resault.startPos; }, + //批量修改答案 saveFormAns() { - //批量修改答案 let EndIndex; let subNum = this.formAns.subNum - 1; this.form.questionList[this.formAns.listIndex].subQuestions.some( @@ -1413,6 +1413,10 @@ export default { this.step = 1; }, setStep1() { + if (this.subjectList.length == 0) { + this.$message.warning("暂无绑定年级信息,请先联系管理员设置。"); + return; + } this.$refs["forms"].validate((valid) => { // 验证通过:保存 if (valid) { @@ -1496,8 +1500,8 @@ export default { this.step = 2; return; }, + //删除批量操作数据 formatQuestionList() { - //删除批量操作数据 for (let i = 0; i < this.form.questionList.length; i++) { for ( let j = 0; @@ -1514,8 +1518,8 @@ export default { this.questionForm = { ...questionForm }; this.addQuestionVisible = true; }, + //添加大题 addQuestion() { - //添加大题 let subQuestions = []; let questionsOptions = { ...subQuesOptions, @@ -1572,8 +1576,8 @@ export default { }); this.addQuestionVisible = false; }, + //删除小题 delTabData(subIndex, index) { - //删除小题 this.form.questionList[index].subQuestions.splice(subIndex, 1); }, setScore(question) { @@ -1612,8 +1616,8 @@ export default { this.addSubQuestionsType = ""; } }, + //切换多题型-小题题型 changeSubQuestions(val, subQuestions) { - //切换多题型-小题题型 const that = this; subQuestions.score = 1; subQuestions.partScore = 0; @@ -1639,8 +1643,8 @@ export default { break; } }, + //添加选项 addOptions(subQuestions) { - //添加选项 let length = subQuestions.answerOptions.split(",").length; if (length > 6) return; subQuestions.selectNum = length + 1; @@ -1648,8 +1652,8 @@ export default { .slice(0, subQuestions.selectNum) .join(","); }, + //删除选项 removeOptions(subQuestions) { - //删除选项 let length = subQuestions.answerOptions.split(",").length; if (length < 3) return; subQuestions.selectNum = length - 1; @@ -1661,8 +1665,8 @@ export default { subQuestions.selectNum ); }, + //设置多选答案 changAnswer(sub, option) { - //设置多选答案 let str = new RegExp(option, "g"); if (sub.correctAnswer?.includes(option)) { sub.correctAnswer = sub.correctAnswer.replace(str, ""); @@ -1830,6 +1834,9 @@ export default { }, async _QuerySubjectList(grade) { //查询科目列表 + if (!grade) { + return; + } let query = {}; let fetchSubjectList = this.role == "ROLE_PERSONAL" @@ -1866,11 +1873,20 @@ export default { if (status == 0) { this.form.title = data.title + "_副本"; this.form.tagId = data.tagId === 0 ? "" : data.tagId; - this.form.subjectName = data.subjectName; + + this.form.subjectName = this.subjectList.length + ? this.subjectList.filter((item) => { + return item.label == data.subjectName; + })?.value + : ""; this.form.examsDuration = data.examsDuration; if (this.role != "ROLE_PERSONAL") { this.form.sharingType = data.sharingType; - this.form.gradeName = data.gradeName; + this.form.gradeName = this.gradeList.length + ? this.gradeList.filter((item) => { + return item == data.gradeName; + }) + : ""; } this.form.questionList = data.questionList?.map((item) => { let subQuestions = diff --git a/src/views/examinationPaper/archiving.vue b/src/views/examinationPaper/archiving.vue index 1647931..5fc0cb4 100644 --- a/src/views/examinationPaper/archiving.vue +++ b/src/views/examinationPaper/archiving.vue @@ -91,7 +91,7 @@ type="info" size="mini" circle - icon="fa fa-archive-copy" + icon="el-icon-copy-document" @click="toAdd(item)" > @@ -183,7 +183,7 @@ export default { const { data, status, info } = await fetchTypeNames({ classId: this.query.classId, - status:1, + status: 1, type: 0, }); if (status === 0) {