Browse Source

提交网考代码

chenken 6 years ago
parent
commit
06654bdedd

+ 63 - 0
src/modules/oe/component/commonExport.vue

@@ -0,0 +1,63 @@
+<template>
+  <span class="exportSpan">
+    <el-button
+      v-show="!exportLoading"
+      @click="exportData"
+      type="primary"
+      size="medium"
+      plain
+      >批量导出</el-button
+    >
+    <el-button :loading="true" v-show="exportLoading">导出数据中...</el-button>
+  </span></template
+>
+<script>
+export default {
+  props: ["form", "exportUrl", "exportFileName"],
+  data() {
+    return { exportLoading: false };
+  },
+  methods: {
+    exportData() {
+      if (!this.form.examId) {
+        this.$notify({
+          title: "警告",
+          message: "请选择考试批次",
+          type: "warning",
+          duration: 1000
+        });
+        return false;
+      }
+      this.exportLoading = true;
+      this.$http
+        .get(this.exportUrl, {
+          params: {
+            query: this.form
+          },
+          responseType: "arraybuffer"
+        })
+        .then(response => {
+          if (response.data) {
+            var blob = new Blob([response.data], {
+              type:
+                "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
+            });
+            var url = URL.createObjectURL(blob);
+            var a = document.createElement("a");
+            a.href = url;
+            a.download = this.exportFileName + ".xlsx";
+            a.target = "_blank";
+            a.click();
+            URL.revokeObjectURL(url);
+          }
+          this.exportLoading = false;
+        });
+    }
+  }
+};
+</script>
+<style>
+.exportSpan {
+  margin-left: 10px;
+}
+</style>

+ 6 - 0
src/modules/oe/routes/routes.js

@@ -7,6 +7,7 @@ import scoreStatistics from "../views/scoreStatistics.vue";
 import examDetail from "../views/examDetail.vue";
 import examScheduling from "../views/examScheduling.vue";
 import captureDetail from "../views/captureDetail.vue";
+import examPaperDetail from "../views/examPaperDetail.vue";
 export default [
   {
     path: "/oe/absent",
@@ -52,5 +53,10 @@ export default [
     path: "/oe/captureDetail/:examRecordDataId",
     name: "captureDetail",
     component: captureDetail //抓拍详情
+  },
+  {
+    path: "/oe/examPaperDetail/:courseId/:examRecordDataId",
+    name: "examPaperDetail",
+    component: examPaperDetail //考卷详情
   }
 ];

+ 10 - 48
src/modules/oe/views/absent.vue

@@ -11,17 +11,11 @@
           <el-button @click="search" size="medium" type="primary"
             >查询</el-button
           >
-          <el-button
-            v-show="!exportLoading"
-            @click="exportData"
-            type="primary"
-            size="medium"
-            plain
-            >批量导出</el-button
-          >
-          <el-button :loading="true" v-show="exportLoading"
-            >导出数据中...</el-button
-          >
+          <commonExportVue
+            :form="form"
+            :exportUrl="exportUrl"
+            :exportFileName="exportFileName"
+          ></commonExportVue>
         </el-col>
       </el-row>
 
@@ -66,8 +60,9 @@
 <script>
 import { mapState } from "vuex";
 import commonFormVue from "../component/commonForm.vue";
+import commonExportVue from "../component/commonExport.vue";
 export default {
-  components: { commonFormVue },
+  components: { commonFormVue, commonExportVue },
   data() {
     return {
       total: 0,
@@ -92,7 +87,9 @@ export default {
         params: { name: "", examTypes: "ONLINE#OFFLINE" },
         filterCondition: "IS_FACE_ENABLE"
       },
-      tableData: []
+      tableData: [],
+      exportUrl: "/api/ecs_oe_admin/exam/student/unfinished/list/export",
+      exportFileName: "缺考登记"
     };
   },
   computed: {
@@ -122,41 +119,6 @@ export default {
           this.tableLoading = false;
         });
     },
-    exportData() {
-      if (!this.form.examId) {
-        this.$notify({
-          title: "警告",
-          message: "请选择考试批次",
-          type: "warning",
-          duration: 1000
-        });
-        return false;
-      }
-      this.exportLoading = true;
-      this.$http
-        .get("/api/ecs_oe_admin/exam/student/unfinished/list/export", {
-          params: {
-            query: this.form
-          },
-          responseType: "arraybuffer"
-        })
-        .then(response => {
-          if (response.data) {
-            var blob = new Blob([response.data], {
-              type:
-                "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
-            });
-            var url = URL.createObjectURL(blob);
-            var a = document.createElement("a");
-            a.href = url;
-            a.download = "缺考登记.xlsx";
-            a.target = "_blank";
-            a.click();
-            URL.revokeObjectURL(url);
-          }
-          this.exportLoading = false;
-        });
-    },
     /**
      * pagesize改变时触发
      */

+ 43 - 11
src/modules/oe/views/examDetail.vue

@@ -35,6 +35,11 @@
           <el-button @click="search" size="medium" type="primary"
             >查询</el-button
           >
+          <commonExportVue
+            :form="form"
+            :exportUrl="exportUrl"
+            :exportFileName="exportFileName"
+          ></commonExportVue>
         </el-col>
       </el-row>
       <el-row class="margin-top-10"
@@ -47,15 +52,25 @@
             :data="tableData"
             border
           >
-            <el-table-column sortable label="学习中心" prop="orgName">
+            <el-table-column fixed sortable label="学习中心" prop="orgName">
             </el-table-column>
-            <el-table-column sortable label="姓名" prop="studentName">
+            <el-table-column fixed sortable label="姓名" prop="studentName">
             </el-table-column>
-            <el-table-column sortable label="身份证号" prop="identityNumber">
+            <el-table-column
+              fixed
+              sortable
+              label="身份证号"
+              prop="identityNumber"
+            >
             </el-table-column>
-            <el-table-column sortable label="学号" prop="studentCode">
+            <el-table-column fixed sortable label="学号" prop="studentCode">
             </el-table-column>
-            <el-table-column sortable label="课程" prop="courseNameAndCode">
+            <el-table-column
+              fixed
+              sortable
+              label="课程"
+              prop="courseNameAndCode"
+            >
             </el-table-column>
             <el-table-column sortable label="课程层次" prop="courseLevel">
             </el-table-column>
@@ -87,8 +102,15 @@
             </el-table-column>
             <el-table-column sortable label="是否提交" prop="isSubmit">
             </el-table-column>
-            <el-table-column label="详情">
-              <el-button>调卷</el-button>
+            <el-table-column fixed="right" label="详情">
+              <template slot-scope="scope">
+                <el-button
+                  @click="
+                    examPaperDetail(scope.row.courseId, scope.row.dataId);
+                  "
+                  >调卷</el-button
+                >
+              </template>
             </el-table-column>
           </el-table>
           <div class="block">
@@ -109,9 +131,10 @@
 <script>
 import { mapState } from "vuex";
 import commonFormVue from "../component/commonForm.vue";
+import commonExportVue from "../component/commonExport.vue";
 import { disciplineTypeList } from "../constants/constants";
 export default {
-  components: { commonFormVue },
+  components: { commonFormVue, commonExportVue },
   data() {
     return {
       disciplineTypeList: disciplineTypeList,
@@ -132,7 +155,7 @@ export default {
         studentName: null,
         isWarn: null,
         pageNo: 1,
-        pageSize: "10",
+        pageSize: 10,
         rootOrgId: null,
         startTime: null,
         endTime: null,
@@ -146,7 +169,9 @@ export default {
         },
         filterCondition: ""
       },
-      tableData: []
+      tableData: [],
+      exportUrl: "/api/ecs_oe_admin/exam/record/detail/list/export",
+      exportFileName: "考试明细"
     };
   },
   computed: {
@@ -191,9 +216,16 @@ export default {
      */
     handleCurrentChange() {
       this.search();
+    },
+    examPaperDetail(courseId, examRecordDataId) {
+      this.$router.push({
+        path: "/oe/examPaperDetail/" + courseId + "/" + examRecordDataId
+      });
     }
   },
-  created() {}
+  created() {
+    this.form.rootOrgId = this.user.rootOrgId;
+  }
 };
 </script>
 <style scope>

+ 280 - 0
src/modules/oe/views/examPaperDetail.vue

@@ -0,0 +1,280 @@
+<template>
+  <div class="paperView">
+    <!-- 遍历大题 -->
+    <div
+      v-for="(questionGroup, index) in paperStruct.questionGroupList"
+      :key="index"
+      class="mainQuestionDiv"
+    >
+      <div style="font-size: 16px;font-weight: bold;">
+        {{ toChineseNumber(index + 1) }}、{{ questionGroup.groupName }}({{
+          questionGroup.groupScore
+        }}分)
+      </div>
+      <div>{{ questionGroup.score }}</div>
+      <!-- 遍历大题下的小题 -->
+      <div
+        v-for="(questionWrapper, index) in questionGroup.questionWrapperList"
+        :key="index"
+      >
+        <div
+          v-for="(question, index) in questionWrapper.questionList"
+          :key="index"
+        >
+          <div style="display: flex;flex-direction:row;">
+            <div v-html="restoreAudio(question.body)"></div>
+          </div>
+          <div
+            v-for="(questionUnit, index) in question.questionUnitList"
+            :key="index"
+          >
+            <div style="display: flex;flex-direction:row;">
+              <div>{{ questionUnit.order }}、</div>
+              <div v-html="restoreAudio(questionUnit.body)"></div>
+              <span>({{ questionUnit.questionScore }}分)</span>
+              <div>
+                <span
+                  style="color:green;font-size: 18px;"
+                  class="glyphicon glyphicon-ok"
+                  ng-show="questionUnit.isRight"
+                ></span>
+              </div>
+            </div>
+
+            <div
+              v-for="(option, index) in questionUnit.quesOptions"
+              :key="index"
+            >
+              <div style="display: flex;flex-direction:row;">
+                <div>{{ option.letter }}.</div>
+                <div v-html="restoreAudio(option.body)"></div>
+              </div>
+            </div>
+
+            <div>
+              <div
+                style="display: flex;flex-direction:row;color: green;font-weight: bold;"
+              >
+                <div>标准答案:</div>
+                <span v-html="questionUnit.correctAnswer"></span>
+              </div>
+              <div style="color: blue;font-weight: bold;">
+                学生答案:<span v-html="questionUnit.studentAnswer"></span>
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      courseId: "",
+      examRecordDataId: "",
+      examRecordData: {},
+      courseInfo: {},
+      paperStruct: {},
+      examQuestionList: []
+    };
+  },
+  methods: {
+    getExamRecordData() {
+      this.$http
+        .get("/api/ecs_oe_admin/exam/record/data/findExamRecordDataEntity", {
+          params: { examRecordDataId: this.examRecordDataId }
+        })
+        .then(response => {
+          this.examRecordData = response.data;
+        });
+    },
+    getCourseInfo() {
+      this.$http.get("/api/ecs_core/course/" + this.courseId).then(response => {
+        this.courseInfo = response.data;
+      });
+    },
+    getPaperData() {
+      this.$http
+        .get(
+          "/api/ecs_oe_admin/examRecordPaperStruct/getExamRecordPaperStruct",
+          { params: { examRecordDataId: this.examRecordDataId } }
+        )
+        .then(response => {
+          this.paperStruct = response.data.defaultPaper;
+          var questionGroupList = this.paperStruct.questionGroupList; //大题集合
+          this.$http
+            .get(
+              "/api/ecs_oe_admin/examRecordQuestions/getExamRecordQuestions",
+              { params: { examRecordDataId: this.examRecordDataId } }
+            )
+            .then(response => {
+              this.examQuestionList = response.data.examQuestionEntities;
+              var order = 0;
+              for (var i = 0; i < questionGroupList.length; i++) {
+                var questionGroup = questionGroupList[i]; //大题
+                var questionWrapperList = questionGroup.questionWrapperList; //大题下小题集合
+                for (var j = 0; j < questionWrapperList.length; j++) {
+                  var questionWrapper = questionWrapperList[j];
+                  order += questionWrapper.questionUnitWrapperList.length;
+                  this.getQuestionContent(
+                    questionWrapper.questionId,
+                    questionWrapper,
+                    order
+                  );
+                }
+              }
+            });
+        });
+    },
+    getQuestionContent(questionId, questionWrapper, order) {
+      var params = {
+        examId: this.examRecordData.examRecord.examId,
+        courseCode: this.courseInfo.code,
+        groupCode: this.examRecordData.examRecord.paperType,
+        questionId: questionId
+      };
+      var _this = this;
+      this.$http
+        .post("/api/ecs_ques/default_question/question", params)
+        .then(function success(response) {
+          var question = response.data.masterVersion;
+          var questionUnitList = question.questionUnitList;
+          var num = questionUnitList.length;
+          for (var i = 0; i < questionUnitList.length; i++) {
+            _this.reOrderOptions(questionUnitList[i], order - num + 1);
+            num--;
+          }
+          var questionList = questionWrapper.questionList;
+          if (!questionList) {
+            questionList = [];
+            questionList.push(question);
+          } else {
+            questionList.push(question);
+          }
+          questionWrapper.questionList = questionList;
+        });
+    },
+    reOrderOptions(question, order) {
+      question.order = order; //设置序号
+      var questionScore = this.examQuestionList[order - 1].questionScore;
+      var studentAnswer = this.examQuestionList[order - 1].studentAnswer;
+      var correctAnswer = question.rightAnswer; //从题中获取正确答案
+      var optionList = question.questionOptionList;
+      //单选,多选
+      if (optionList && optionList.length > 0) {
+        var correctAnswerInExamQuestion = this.examQuestionList[order - 1]
+          .correctAnswer;
+        //如果是字母,说明是旧数据
+        var reg = /^[a-zA-Z]+$/; //匹配任意字母
+        if (
+          correctAnswerInExamQuestion &&
+          reg.test(correctAnswerInExamQuestion)
+        ) {
+          question.studentAnswer = studentAnswer;
+          question.correctAnswer = correctAnswerInExamQuestion;
+          for (var i1 = 0; i1 < optionList.length; i1++) {
+            var letter1 = String.fromCharCode(i1 + 65);
+            optionList[i1].letter = letter1;
+          }
+          question.quesOptions = optionList; //选项
+        } else {
+          var optionPermutation = this.examQuestionList[order - 1]
+            .optionPermutation;
+          for (var i2 = 0; i2 < optionList.length; i2++) {
+            optionList[i2].optionId = i2;
+          }
+          //按照optionPermutation排序
+          var newOptionList = [];
+          for (var i3 = 0; i3 < optionPermutation.length; i3++) {
+            var optionId = optionPermutation[i3];
+            for (var i4 = 0; i4 < optionList.length; i4++) {
+              if (optionList[i4].optionId == optionId) {
+                newOptionList.push(optionList[i4]);
+                break;
+              }
+            }
+          }
+          var newCorrectAnswer = []; //正确答案
+          var newStudentAnswer = []; //考生作答
+          for (var i5 = 0; i5 < newOptionList.length; i5++) {
+            var letter = String.fromCharCode(i5 + 65);
+            newOptionList[i5].letter = letter;
+            if (
+              correctAnswer &&
+              correctAnswer.indexOf(newOptionList[i5].optionId.toString()) > -1
+            ) {
+              newCorrectAnswer.push(letter);
+            }
+            if (
+              studentAnswer &&
+              studentAnswer.indexOf(newOptionList[i5].optionId.toString()) > -1
+            ) {
+              newStudentAnswer.push(letter);
+            }
+          }
+          question.quesOptions = newOptionList; //选项
+          question.correctAnswer = newCorrectAnswer;
+          question.studentAnswer = newStudentAnswer;
+        }
+      } else {
+        question.studentAnswer = studentAnswer;
+        question.correctAnswer = correctAnswer;
+        if (question.questionType == "TRUE_OR_FALSE") {
+          if (studentAnswer == "true") {
+            question.studentAnswer = "正确";
+          } else if (studentAnswer == "false") {
+            question.studentAnswer = "错误";
+          }
+          if (correctAnswer == "true") {
+            question.correctAnswer = "正确";
+          } else if (correctAnswer == "false") {
+            question.correctAnswer = "错误";
+          }
+        }
+      }
+      question.questionScore = questionScore;
+      if (question.studentAnswer) {
+        question.studentAnswer = question.studentAnswer.toString();
+      }
+      if (question.correctAnswer) {
+        question.correctAnswer = question.correctAnswer.toString();
+      }
+      if (
+        question.studentAnswer &&
+        question.correctAnswer &&
+        question.studentAnswer == question.correctAnswer
+      ) {
+        question.isRight = true;
+      }
+      this.$forceUpdate(); //刷新视图
+    },
+    toChineseNumber(num) {
+      return num.toLocaleString("zh-u-nu-hanidec");
+    },
+    restoreAudio(str) {
+      return (str || "")
+        .replace(/<a/g, "<audio controls ")
+        .replace(/url=/g, "src=")
+        .replace(/a>/g, "audio>");
+    }
+  },
+  created() {
+    this.courseId = this.$route.params.courseId;
+    this.examRecordDataId = this.$route.params.examRecordDataId;
+    this.getExamRecordData();
+    this.getCourseInfo();
+    this.getPaperData();
+  }
+};
+</script>
+
+<style scoped>
+.mainQuestionDiv {
+  font-size: 14px;
+  margin: 20px 60px;
+  border-bottom: 1px dashed black;
+}
+</style>

+ 10 - 2
src/modules/oe/views/examScheduling.vue

@@ -23,6 +23,11 @@
           <el-button @click="search" size="medium" type="primary"
             >查询</el-button
           >
+          <commonExportVue
+            :form="form"
+            :exportUrl="exportUrl"
+            :exportFileName="exportFileName"
+          ></commonExportVue>
         </el-col>
       </el-row>
       <el-row class="margin-top-10"
@@ -91,8 +96,9 @@
 <script>
 import { mapState } from "vuex";
 import commonFormVue from "../component/commonForm.vue";
+import commonExportVue from "../component/commonExport.vue";
 export default {
-  components: { commonFormVue },
+  components: { commonFormVue, commonExportVue },
   data() {
     return {
       total: 0,
@@ -124,7 +130,9 @@ export default {
         },
         filterCondition: ""
       },
-      tableData: []
+      tableData: [],
+      exportUrl: "/api/ecs_oe_admin/exam/student/all/list/export",
+      exportFileName: "考试进度详情"
     };
   },
   computed: {

+ 14 - 3
src/modules/oe/views/illegalityNameList.vue

@@ -26,6 +26,11 @@
           <el-button @click="search" size="medium" type="primary"
             >查询</el-button
           >
+          <commonExportVue
+            :form="form"
+            :exportUrl="exportUrl"
+            :exportFileName="exportFileName"
+          ></commonExportVue>
         </el-col>
       </el-row>
       <el-row class="margin-top-10"
@@ -87,14 +92,16 @@
 <script>
 import { mapState } from "vuex";
 import commonFormVue from "../component/commonForm.vue";
+import commonExportVue from "../component/commonExport.vue";
 import { disciplineTypeList } from "../constants/constants";
 export default {
-  components: { commonFormVue },
+  components: { commonFormVue, commonExportVue },
   data() {
     return {
       disciplineTypeList: disciplineTypeList,
       total: 0,
       tableLoading: false,
+      exportLoading: false,
       form: {
         examRecordDataId: null,
         hasStranger: null,
@@ -122,7 +129,9 @@ export default {
         },
         filterCondition: ""
       },
-      tableData: []
+      tableData: [],
+      exportUrl: "/api/ecs_oe_admin/exam/audit/discipline/list/export",
+      exportFileName: "违纪名单"
     };
   },
   computed: {
@@ -172,7 +181,9 @@ export default {
       this.search();
     }
   },
-  created() {}
+  created() {
+    this.form.rootOrgId = this.user.rootOrgId;
+  }
 };
 </script>
 <style scoped>

+ 10 - 2
src/modules/oe/views/scoreStatistics.vue

@@ -17,6 +17,11 @@
           <el-button @click="search" size="medium" type="primary"
             >查询</el-button
           >
+          <commonExportVue
+            :form="form"
+            :exportUrl="exportUrl"
+            :exportFileName="exportFileName"
+          ></commonExportVue>
         </el-col>
       </el-row>
       <el-row class="margin-top-10"
@@ -76,9 +81,10 @@
 <script>
 import { mapState } from "vuex";
 import commonFormVue from "../component/commonForm.vue";
+import commonExportVue from "../component/commonExport.vue";
 import { disciplineTypeList } from "../constants/constants";
 export default {
-  components: { commonFormVue },
+  components: { commonFormVue, commonExportVue },
   data() {
     return {
       disciplineTypeList: disciplineTypeList,
@@ -112,7 +118,9 @@ export default {
         },
         filterCondition: ""
       },
-      tableData: []
+      tableData: [],
+      exportUrl: "/api/ecs_oe_admin/exam/score/statistic/list/export",
+      exportFileName: "成绩统计"
     };
   },
   computed: {

+ 4 - 0
vue.config.js

@@ -17,6 +17,10 @@ const proxy = {
     target: process.env.VUE_APP_OE_HOST_URL || "http://192.168.10.39:8013",
     changeOrigin: true
   },
+  "/api/ecs_oe_student": {
+    target: process.env.VUE_APP_OE_HOST_URL || "http://192.168.10.39:8003",
+    changeOrigin: true
+  },
   "/api/ecs_marking": {
     target: process.env.VUE_APP_MARKING_HOST_URL || "http://192.168.10.39:8004",
     changeOrigin: true