From 9309dc5d890aab5ff73ff7df9be2945454fdec58 Mon Sep 17 00:00:00 2001 From: 梁保满 Date: Tue, 3 Jan 2023 19:33:22 +0800 Subject: [PATCH] 任课老师接口完成 --- src/api/apis/apis.js | 227 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/api/urls/apis.js | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- src/assets/css/index.scss | 2 +- src/components/setAnswer.vue | 459 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ src/components/upload.vue | 19 ++++++++++++++++++- src/views/ask/analysis.vue | 467 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------ src/views/ask/index.vue | 558 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- src/views/examinationPaper/add.vue | 8 ++++---- src/views/index/mainIndex.vue | 12 +++++++++++- src/views/login/index.vue | 16 ++++++++++------ src/views/setUp/account.vue | 28 ++++++++++++++++------------ src/views/setUp/student.vue | 2 +- src/views/setUp/teacher.vue | 4 ++-- src/views/test/analysis.vue | 498 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------- src/views/test/editAnswer.vue | 814 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/views/test/index.vue | 1057 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 16 files changed, 2640 insertions(+), 1599 deletions(-) create mode 100644 src/views/test/editAnswer.vue diff --git a/src/api/apis/apis.js b/src/api/apis/apis.js index 8943bb9..1bee16d 100644 --- a/src/api/apis/apis.js +++ b/src/api/apis/apis.js @@ -26,6 +26,233 @@ export default { data, }); }, + // 班主任首页数据 + classIndex(data) { + return service({ + url: setUpUrls.classIndex, + method: "POST", + data, + }); + }, + //班主任-查询管理的班级 + cTClassList(data) { + return service({ + url: setUpUrls.cTClassList, + method: "POST", + data, + }); + }, + //班主任-查询管理班级授课科目 + cTSubjectList(data) { + return service({ + url: setUpUrls.cTSubjectList, + method: "POST", + data, + }); + }, + //班主任-查询阶段问答报表 + cTPhaseAnswerReport(data) { + return service({ + url: setUpUrls.cTPhaseAnswerReport, + method: "POST", + data, + }); + }, + //班主任-查询阶段互动报表 + cTPhaseInteractiveReport(data) { + return service({ + url: setUpUrls.cTPhaseInteractiveReport, + method: "POST", + data, + }); + }, + //班主任-查询阶段测练报表 + cTPhaseExamReport(data) { + return service({ + url: setUpUrls.cTPhaseExamReport, + method: "POST", + data, + }); + }, + + //任课老师-查询管理的班级 + tClassList(data) { + return service({ + url: setUpUrls.tClassList, + method: "POST", + data, + }); + }, + //任课老师-查询管理班级授课科目 + tSubjectList(data) { + return service({ + url: setUpUrls.tSubjectList, + method: "POST", + data, + }); + }, + //任课老师-分页查询课时报表列表 + periodReportList(data) { + return service({ + url: setUpUrls.periodReportList, + method: "POST", + data, + }); + }, + //任课老师-查询阶段问答报表 + phaseAnswerReport(data) { + return service({ + url: setUpUrls.phaseAnswerReport, + method: "POST", + data, + }); + }, + //任课老师-查询阶段互动报表 + phaseInteractiveReport(data) { + return service({ + url: setUpUrls.phaseInteractiveReport, + method: "POST", + data, + }); + }, + //任课老师-查询课时题目列表 + periodQuestionList(data) { + return service({ + url: setUpUrls.periodQuestionList, + method: "POST", + data, + }); + }, + //任课老师-设置课时报表答案 + setPeriodAnswer(data) { + return service({ + url: setUpUrls.setPeriodAnswer, + method: "POST", + data, + }); + }, + //任课老师-查询课时报表详情 + periodDetail(data) { + return service({ + url: setUpUrls.periodDetail, + method: "POST", + data, + }); + }, + //任课老师-分页查询课时题目统计列表 + periodQuestionReport(data) { + return service({ + url: setUpUrls.periodQuestionReport, + method: "POST", + data, + }); + }, + //任课老师-查询课时学生答题明细 + periodStudentReport(data) { + return service({ + url: setUpUrls.periodStudentReport, + method: "POST", + data, + }); + }, + //任课老师-分页查询即时测报表 + examReportList(data) { + return service({ + url: setUpUrls.examReportList, + method: "POST", + data, + }); + }, + //任课老师-查询阶段测练报表 + phaseExamReport(data) { + return service({ + url: setUpUrls.phaseExamReport, + method: "POST", + data, + }); + }, + //任课老师-查询即时测报表题目列表 + examQuestionList(data) { + return service({ + url: setUpUrls.examQuestionList, + method: "POST", + data, + }); + }, + //任课老师-设置即时测报表答案 + setExamAnswer(data) { + return service({ + url: setUpUrls.setExamAnswer, + method: "POST", + data, + }); + }, + //任课老师-查询即时测报表详情 + examDetail(data) { + return service({ + url: setUpUrls.examDetail, + method: "POST", + data, + }); + }, + //任课老师-下载导入主观题分模板 + subjectiveScoreTemplate(data) { + return service({ + url: setUpUrls.subjectiveScoreTemplate, + method: "POST", + data, + }); + }, + //任课老师-导入主观题得分 + importSubjectiveScore(data) { + return service({ + url: setUpUrls.importSubjectiveScore, + method: "POST", + data, + }); + }, + //任课老师-分页查询即时测题目统计 + examQuestionReport(data) { + return service({ + url: setUpUrls.examQuestionReport, + method: "POST", + data, + }); + }, + //任课老师-查询即时测学生统计 + examStudentReport(data) { + return service({ + url: setUpUrls.examStudentReport, + method: "POST", + data, + }); + }, + //任课老师-重新判分 + reScore(data) { + return service({ + url: setUpUrls.reScore, + method: "POST", + data, + }); + }, + //任课老师-数据导出 + exportData(data) { + return service({ + url: setUpUrls.exportData, + method: "POST", + data, + }); + }, + //任课老师-数据导入 + importData(data) { + return service({ + url: setUpUrls.importData, + method: "POST", + data, + }); + }, + + // 查询角色列表 roleList(data) { return service({ diff --git a/src/api/urls/apis.js b/src/api/urls/apis.js index 7ca92d8..bbdc872 100644 --- a/src/api/urls/apis.js +++ b/src/api/urls/apis.js @@ -6,6 +6,68 @@ export default { schoolIndex: "/api_html/school/manager/index", // 学校管理员首页数据 tenantIndex: "/api_html/tenant/index", + // 班主任首页数据 + classIndex: "/api_html/class/manager/index", + //班主任-查询管理的班级 + cTClassList: "/api_html/class/manager/classList", + //班主任-查询管理班级授课科目 + cTSubjectList: "/api_html/class/manager/subjectList", + //班主任-查询阶段问答报表 + cTPhaseAnswerReport: "/api_html/class/manager/phaseAnswerReport", + //班主任-查询阶段互动报表 + cTPhaseInteractiveReport: "/api_html/class/manager/phaseInteractiveReport", + //班主任-查询阶段测练报表 + cTPhaseExamReport: "/api_html/class/manager/phaseExamReport", + + //任课老师-查询管理班级 + tClassList: "/api_html/teaching/classList", + //任课老师-查询管理班级授课科目 + tSubjectList: "/api_html/teaching/subjectList", + //任课老师-分页查询课时报表列表 + periodReportList: "/api_html/teaching/periodReportList", + //任课老师-查询阶段问答报表 + phaseAnswerReport: "/api_html/teaching/phaseAnswerReport", + //任课老师-查询阶段互动报表 + phaseInteractiveReport: "/api_html/teaching/phaseInteractiveReport", + //任课老师-查询课时题目列表 + periodQuestionList: "/api_html/teaching/periodQuestionList", + //任课老师-设置课时报表答案 + setPeriodAnswer: "/api_html/teaching/setPeriodAnswer", + //任课老师-查询课时报表详情 + periodDetail: "/api_html/teaching/periodDetail", + //任课老师-分页查询课时题目统计列表 + periodQuestionReport: "/api_html/teaching/periodQuestionReport", + //任课老师-查询课时学生答题明细 + periodStudentReport: "/api_html/teaching/periodStudentReport", + //任课老师-分页查询即时测报表 + examReportList: "/api_html/teaching/examReportList", + //任课老师-查询阶段测练报表 + phaseExamReport: "/api_html/teaching/phaseExamReport", + //任课老师-查询即时测报表题目列表 + examQuestionList: "/api_html/teaching/examQuestionList", + //任课老师-设置即时测报表答案 + setExamAnswer: "/api_html/teaching/setExamAnswer", + //任课老师-查询即时测报表详情 + examDetail: "/api_html/teaching/examDetail", + //任课老师-下载导入主观题分模板 + subjectiveScoreTemplate: "/api_html/teaching/subjectiveScoreTemplate", + //任课老师-导入主观题得分 + importSubjectiveScore: "/api_html/teaching/importSubjectiveScore", + //任课老师-分页查询即时测题目统计 + examQuestionReport: "/api_html/teaching/examQuestionReport", + //任课老师-查询即时测学生统计 + examStudentReport: "/api_html/teaching/examStudentReport", + //任课老师-重新判分 + reScore: "/api_html/teaching/reScore", + //任课老师-数据导出 + exportData: "/api_html/teaching/exportData", + //任课老师-数据导入 + importData: "/api_html/teaching/importData", + + + + + // 查询角色列表 roleList: "/api_html/school/manager/roleList", // 分页查询账号 @@ -68,8 +130,8 @@ export default { usageAnalysis: "/api_html/school/manager/usageAnalysis", // 发卡记录 cardList: "/api_html/school/manager/cardList", - - + + // 查询区域列表 regionList: "/api_html/tenant/regionList", // 查询学校列表 @@ -100,7 +162,7 @@ export default { tenantGradeList: "/api_html/tenant/gradeList", // 查询学校班级 tenantClassList: "/api_html/tenant/classList", - + // 学校使用对比 schoolContrast: "/api_html/tenant/schoolContrast", // 年级使用对比 diff --git a/src/assets/css/index.scss b/src/assets/css/index.scss index fee026d..ddac408 100644 --- a/src/assets/css/index.scss +++ b/src/assets/css/index.scss @@ -120,7 +120,7 @@ .down-txt{ display: flex; align-items: center; - justify-content: center; + padding-left: 160px; } .h-title{ padding-left:12px; diff --git a/src/components/setAnswer.vue b/src/components/setAnswer.vue index aed1879..d069f1b 100644 --- a/src/components/setAnswer.vue +++ b/src/components/setAnswer.vue @@ -8,145 +8,64 @@ >

- 设置答案 + 设置答案

-
-
- -
-
-
-

- 请点击选项按钮设置答案,多选题题目之间用“,”隔开,若添加5道题:“AC,AD,BD,AC,CD” -

-
-
-
-
-

{{ item.name }}

-

共{{ item.list.length }}题

-
-
-

- -

-

- - - - x -

-
+

+
+
题{{ subQuestions.questionIndex }}
+
+

+ + +

+

+ {{ option }} +

+

+ {{ option }} +

@@ -160,6 +79,84 @@ >
+ +
+

{{ setSubPro(formAns.qusType) }}:

+

+ +

+

+ + + + x +

+
+ +
@@ -174,62 +171,116 @@ export default { }, data() { return { + diaSetAns: false, editType: true, //修改答案模式 FormQuestionList: [], - FormQuestionList2: [], + FormQuestionList: [], + formAns: { + endIndex: 0, //相同题目最后一位题目的questionIndex + qusType: "", //题目类型 + subNum: 0, //数量 + answerOptions: [], //答案选项 + answerList: "", //答案列表-字符串 + }, }; }, watch: { questionList: { - handler: function () { - this.FormQuestionList = deepClone(this.questionList); - this.FormQuestionList2 = []; - console.log(this.questionList); - // 组合每道大题中的相同题目 - let questionList = deepClone(this.questionList); - let jsons = {}; - let answerOptions = []; - for (let i = 0; i < questionList.length; i++) { - questionList[i].subQuestions.map((items) => { - let txt = this.setSubPro(items.questionType); - if (jsons[txt]) { - jsons[txt].push(items); + handler: function (val) { + const questions = deepClone(val).sort((a, b) => { + return a.questionIndex - b.questionIndex; + }); + this.FormQuestionList = deepClone(questions); + let types = [{}]; + let addndex = 0; + this.FormQuestionList?.map((sub, index) => { + if (!!sub.questionType) { + if (sub.questionType == types[addndex].qusType) { + //同类型批量答案+1 + types[addndex].subNum += 1; + if ( + types[addndex].answerOptions.length < sub.answerOptions.length + ) { + types[addndex].answerOptions = sub.answerOptions; + } + types[addndex].answerList += this.setAnswer( + sub.questionType, + sub.correctAnswer + ); + if (index == this.questionList.length - 1) { + //循环最后类型数量大于等于5,保存批量答案 + if (types[addndex].subNum && types[addndex].subNum >= 5) { + types[addndex].endIndex = sub.questionIndex; + types[addndex].index = index; + } + } } else { - jsons[txt] = [items]; - } - if (items.questionType == 2 || items.questionType == 3) { - if (items.answerOptions.length > answerOptions.length) { - answerOptions = items.answerOptions; + if (types[addndex].subNum && types[addndex].subNum >= 5) { + //不同类型时如果原有类型数量大于等于5,保存批量答案 + types[addndex].endIndex = + this.questionList[index - 1].questionIndex; + types[addndex].index = index; + addndex += 1; + types[addndex] = {}; } - jsons[txt][0].answerOptions = answerOptions; - } - }); - console.log(jsons); - } - this.FormQuestionList2 = Object.keys(jsons).map((item) => { - let answerList = ""; - jsons[item].map((items, index) => { - if (items.questionType == 2) { - answerList += items.correctAnswer; - } else if (items.questionType == 3) { - answerList += - items.correctAnswer + - (jsons[item].length - 1 != index ? "," : ""); - } else if (items.questionType == 4) { - answerList += items.correctAnswer == 1 ? "✓" : "✗"; + //不同类型初始化批量答案 + types[addndex].qusType = sub.questionType; + types[addndex].subNum = 1; + types[addndex].answerOptions = sub.answerOptions; + types[addndex].answerList = this.setAnswer( + sub.questionType, + sub.correctAnswer + ); } - }); - return { - name: item, - list: jsons[item], - answerList: answerList, - }; + } }); + for (let i = 0; i < types.length; i++) { + if (types[i].qusType == 3) { + types[i].answerList = types[i].answerList.slice(0, -1); + } + if (types[i].subNum >= 5) { + item.subQuestions.splice( + types[i].index + i + 1, + 0, + deepClone(types[i]) + ); + } + } }, deep: true, }, }, methods: { + setFormAns(indexs) { + //初始化要修改的答案 + this.formAns = { ...this.FormQuestionList[indexs] }; + this.diaSetAns = true; + }, + saveFormAns() { + //批量修改答案 + let EndIndex; + let subNum = this.formAns.subNum - 1; + this.FormQuestionList.some((item, index) => { + if (this.formAns.endIndex == item.questionIndex) { + EndIndex = index; + return; + } + }); + for (let i = 0; i <= subNum; i++) { + let correctAnswer = ""; + if (this.formAns.qusType == 2) { + correctAnswer = this.formAns.answerList[subNum - i]; + } else if (this.formAns.qusType == 3) { + correctAnswer = this.formAns.answerList.split(",")[subNum - i]; + + console.log(this.formAns.answerList.split(",")[subNum - i]); + } else if (this.formAns.qusType == 4) { + correctAnswer = this.formAns.answerList[subNum - i] == "✓" ? 1 : 2; + } + this.questionList[EndIndex - i].correctAnswer = correctAnswer; + } + this.diaSetAns = false; + }, setSubPro(type) { let tit; switch (type) { @@ -270,15 +321,26 @@ export default { event.returnValue = ""; } }, - setAnswer(obj, answer) { + setAnswer(type, ans) { + let txt = ""; + if (type == 2) { + txt = ans; + } else if (type == 3) { + txt = ans + ","; + } else if (type == 4) { + txt = ans == 1 ? "✓" : "✗"; + } + return txt; + }, + setMultiple(obj, answer) { //多选答案设置 obj.answerList += answer; let str = obj.answerList; let str2 = checkAnswer( str, 3, - obj.list[0].answerOptions, - obj.list.length + obj.answerOptions.split(",").length, + obj.answerList.length ); obj.answerList = str2; }, @@ -294,39 +356,16 @@ export default { } }, async saveAnswer() { - let questionList = [], - questionList2 = []; - if (this.editType) { - questionList = [...this.FormQuestionList]; - } else { - this.FormQuestionList2.map((item) => { - item.list.map((items, index) => { - if (items.questionType == 2 ) { - items.correctAnswer = item.answerList.split("")[index]; - } else if (items.questionType == 3) { - items.correctAnswer = item.answerList.split(",")[index]; - }else if (items.questionType == 4) { - items.correctAnswer = item.answerList[index] == "✓" ? 1 : 2; - } - questionList2.push(items); - }); - }); - questionList = this.FormQuestionList.map((item) => { - let subQuestions = item.subQuestions.map((items) => { - items.correctAnswer = questionList2.find((question) => { - return question.questionIndex == items.questionIndex; - })?.correctAnswer; - return items; - }); - return { - ...item, - subQuestions: [...subQuestions], - }; - }); + let questionList = []; + for (let i = 0; i < this.FormQuestionList.length; i++) { + if (this.FormQuestionList[i].qusType) { + this.FormQuestionList.splice(i, 1); + i--; + } } console.log(questionList); - const { data, status, message } = await this.$request.modifyPaper({ - paperId: this.paperId, + const { data, status, message } = await this.$request.setPeriodAnswer({ + periodId: this.paperId, questionList: questionList, }); if (status == 0) { diff --git a/src/components/upload.vue b/src/components/upload.vue index dd18682..f950457 100644 --- a/src/components/upload.vue +++ b/src/components/upload.vue @@ -7,7 +7,7 @@ ref="upload" :action="url" :multiple="false" - :data="{ id: id }" + :data="{ ...query }" :with-credentials="true" :limit="1" :on-change="change" @@ -34,6 +34,10 @@ export default { type: String, default: "", }, + examId: { + type: String, + default: "", + }, url: { type: String, default: "", @@ -44,6 +48,19 @@ export default { default: "模板", }, }, + computed: { + query: function () { + if (this.id) { + return { + id: this.id, + }; + } else if (this.examId) { + return { + examId: this.examId, + }; + } + }, + }, data() { return { file: null, diff --git a/src/views/ask/analysis.vue b/src/views/ask/analysis.vue index e2bf2e6..af7b4c1 100644 --- a/src/views/ask/analysis.vue +++ b/src/views/ask/analysis.vue @@ -10,150 +10,413 @@ 答题表现 学生问答表现 学生互动表现 签到明细
- - - - - - - - - - - - +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

+ 导出报表 + 设置答案 +

+
+ + \ No newline at end of file diff --git a/src/views/test/editAnswer.vue b/src/views/test/editAnswer.vue new file mode 100644 index 0000000..d492278 --- /dev/null +++ b/src/views/test/editAnswer.vue @@ -0,0 +1,814 @@ + + + + + \ No newline at end of file diff --git a/src/views/test/index.vue b/src/views/test/index.vue index 6fed0dd..3036fbc 100644 --- a/src/views/test/index.vue +++ b/src/views/test/index.vue @@ -1,5 +1,5 @@ {{ scoped.row.passRate }}% {{ scoped.row.failedRate }}% @@ -195,38 +194,33 @@ +
+ + +
-
- +
+ - - - - @@ -253,227 +247,37 @@

-
-
- -

修改答案

-
-
-
-
-

{{ form.title }}

-

卷面总分:{{ form.score }}分

-
-
-
-

- {{ setBigNum(index) }}、 - {{ question.questionTitle }} - 共 {{ question.score }} 分 -

-
    -
  • -
    题号
    -
    题型
    -
    分数
    -
    漏选得分
    -
    选项设置
    -
  • -
  • -

    - 批量设置答案 -

    -
    -
    {{ subQuestions.questionIndex }}
    -
    - {{ setSubPro(subQuestions.questionType) }} -
    -
    - {{ subQuestions.score }} -
    -
    -

    --

    -

    {{ subQuestions.partScore }}

    -
    -
    -

    --

    -

    - - -

    -

    - -

    -

    - -

    -
    -
    -
  • -
-
-
-
- 取消 - 保存 -
-
+
- -
-

- 请点击选项按钮设置答案,多选题题目之间用“,”隔开,若添加5道题:“AC,AD,BD,AC,CD” -

-

{{ setSubPro(formAns.qusType) }}:

-

- -

-

- - - - x -

-
- -
+ \ No newline at end of file -- libgit2 0.21.4