reghao 1 jaar geleden
bovenliggende
commit
d5c146bd69

+ 8 - 2
src/api/exam.js

@@ -10,7 +10,9 @@ const examApi = {
   addPaper: '/api/content/exam/paper',
   startExam: '/api/content/exam/start',
   submitExam: '/api/content/exam/submit',
-  getExamResult: '/api/content/exam/result'
+  getExamResult: '/api/content/exam/result/view',
+  getExamMark: '/api/content/exam/result/mark',
+  submitExamMark: '/api/content/exam/result/mark'
 }
 
 export function getSubject() {
@@ -70,7 +72,11 @@ export function getExamResult(examId) {
 }
 
 export function getExamMarkList() {
-  return get('/api/content/exam/result/mark')
+  return get(examApi.getExamMark)
+}
+
+export function submitExamMark(data) {
+  return post(examApi.submitExamMark, data)
 }
 
 export function getExamScoreList() {

+ 1 - 1
src/router/exam.js

@@ -40,7 +40,7 @@ export default {
       meta: { needAuth: true }
     },
     {
-      path: '/exam/result',
+      path: '/exam/score',
       name: 'ExamResultIndex',
       component: ExamResultIndex,
       meta: { needAuth: true }

+ 1 - 1
src/views/exam/Exam.vue

@@ -48,7 +48,7 @@
                 <i class="el-icon-film" />
                 <span slot="title">考试列表</span>
               </el-menu-item>
-              <el-menu-item index="/exam/result">
+              <el-menu-item index="/exam/score">
                 <i class="el-icon-film" />
                 <span slot="title">我的成绩</span>
               </el-menu-item>

+ 2 - 2
src/views/exam/ExamMarkIndex.vue

@@ -78,7 +78,7 @@
 </template>
 
 <script>
-import {getSubjectKV, getPapers, getExamMarkList} from '@/api/exam'
+import {getSubjectKV, getExamMarkList} from '@/api/exam'
 
 export default {
   name: 'ExamPaper',
@@ -151,7 +151,7 @@ export default {
       this.getData(this.queryInfo)
     },
     previewPaper(index, row) {
-      this.$message('预览试卷')
+      this.$router.push('/exam/result/' + row.resultId)
     }
   }
 }

+ 1 - 1
src/views/exam/ExamResultIndex.vue

@@ -150,7 +150,7 @@ export default {
       this.getData(this.queryInfo)
     },
     previewPaper(index, row) {
-      this.$message('查看试卷')
+      this.$router.push('/exam/result/' + row.paperId)
     }
   }
 }

+ 45 - 3
src/views/exam/ExamResultPage.vue

@@ -125,6 +125,9 @@
             </div>
           </div>
         </div>
+        <div>
+          <el-button type="primary" @click="submitMark">提交评卷</el-button>
+        </div>
       </el-card>
     </el-main>
 
@@ -136,7 +139,7 @@
 </template>
 
 <script>
-import { getExamResult, getPaperQuestions } from '@/api/exam'
+import {getExamResult, getPaperQuestions, submitExamMark} from '@/api/exam'
 
 export default {
   name: 'ExamResult',
@@ -158,9 +161,19 @@ export default {
       bigImgDialog: false,
       // 用户回答的答案
       userAnswer: [],
-      markExam: true,
+      markExam: false,
       markForm: {
-        review: null
+        paperId: null,
+        resultId: null,
+        markResults: [
+          {
+            pos: 0,
+            questionId: null,
+            score: 0,
+            markScore: 0,
+            review: null
+          }
+        ]
       }
     }
   },
@@ -220,6 +233,35 @@ export default {
     },
     // 根据考试id查询考试中每一题的分数
     async getQuestionScore(examId) {
+    },
+    submitMark() {
+      this.markForm.paperId = this.examRecord.examId
+      this.markForm.resultId = this.examRecord.resultId
+      submitExamMark(this.markForm).then(resp => {
+        if (resp.code === 0) {
+          this.$notify({
+            title: '提示',
+            message: '评卷结果已提交',
+            type: 'warning',
+            duration: 3000
+          })
+          this.$router.push('/exam/marker')
+        } else {
+          this.$notify({
+            title: '提示',
+            message: resp.msg,
+            type: 'warning',
+            duration: 3000
+          })
+        }
+      }).catch(error => {
+        this.$notify({
+          title: '提示',
+          message: error.message,
+          type: 'error',
+          duration: 3000
+        })
+      })
     }
   }
 }