reghao 1 gadu atpakaļ
vecāks
revīzija
51ec9b7cf7

+ 9 - 3
src/router/exam.js

@@ -19,7 +19,7 @@ const ExamPaper = () => import('views/exam/ExamPaper')
 const ExamPaperAdd = () => import('views/exam/ExamPaperAdd')
 const ExamPaperPreview = () => import('views/exam/ExamPaperPreview')
 const ExamScoreIndex = () => import('views/exam/ExamScoreIndex')
-const ExamResultPage = () => import('views/exam/ExamResultPage')
+const ExamPaperResult = () => import('views/exam/ExamPaperResult')
 const ExamMarkIndex = () => import('views/exam/ExamMarkIndex')
 
 export default {
@@ -40,6 +40,12 @@ export default {
       component: ExamCard,
       meta: { needAuth: true }
     },
+    {
+      path: '/exam/starts/:paperId',
+      name: 'ExamPaperPreview',
+      component: ExamPaperPreview,
+      meta: { needAuth: true }
+    },
     {
       path: '/exam/score',
       name: 'ExamScoreIndex',
@@ -49,7 +55,7 @@ export default {
     {
       path: '/exam/score/:resultId',
       name: 'ExamScorePage',
-      component: ExamResultPage,
+      component: ExamPaperResult,
       meta: { needAuth: true }
     },
     {
@@ -61,7 +67,7 @@ export default {
     {
       path: '/exam/mark/:resultId',
       name: 'ExamMarkPage',
-      component: ExamResultPage,
+      component: ExamPaperResult,
       meta: { needAuth: true }
     },
     {

+ 2 - 3
src/views/exam/ExamList.vue

@@ -218,9 +218,8 @@ export default {
       }
     },
     startExam(paperId) {
-      const path = '/exam/start/' + paperId
-      console.log(path)
-      this.$router.push('/exam/start/' + paperId)
+      const routeData = this.$router.resolve({ path: '/exam/starts/' + paperId })
+      window.open(routeData.href, '_blank')
     }
   }
 }

+ 12 - 3
src/views/exam/ExamPaperPreview.vue

@@ -283,12 +283,13 @@
 </template>
 
 <script>
-import {getExamInfo, getPaperQuestions, submitExam} from '@/api/exam'
+import { getExamInfo, getPaperQuestions, submitExam } from '@/api/exam'
 
 export default {
   name: 'ExamPaperPreview',
   data() {
     return {
+      paperStatus: 1,
       // 当前考试的信息
       examInfo: {},
       // 当前的考试题目
@@ -343,7 +344,15 @@ export default {
     }
   },
   created() {
-    document.title = '试卷预览'
+    const path = this.$route.path
+    if (path.startsWith('/exam/preview')) {
+      document.title = '试卷预览'
+      this.paperStatus = 1
+    } else if (path.startsWith('/exam/start')) {
+      document.title = '试卷考试'
+      this.paperStatus = 2
+    }
+
     const paperId = this.$route.params.paperId
     this.getQuestionInfo1(paperId)
     this.getExamInfo(paperId)
@@ -491,7 +500,7 @@ export default {
             duration: 2000
           })
           const resultId = resp.data
-          this.$router.push('/exam/result/' + resultId)
+          this.$router.push('/exam/score')
         }
       }).catch(error => {
         this.$notify({

+ 77 - 18
src/views/exam/ExamResultPage.vue → src/views/exam/ExamPaperResult.vue

@@ -7,13 +7,15 @@
           <span style="color: red;font-size: 18px;">{{ examInfo.examName }}</span>
           <span class="examTitle">考试时间:</span>
           <span style="color: red;font-size: 18px;">{{ examInfo.examTime }}</span>
-          <el-button
-            type="warning"
-            round
-            style="background-color: #ffd550;float: right;color: black;font-weight: 800"
-            @click="uploadExamToAdmin"
-          >提交阅卷
-          </el-button>
+          <div v-if="paperStatus === 3">
+            <el-button
+              type="warning"
+              round
+              style="background-color: #ffd550;float: right;color: black;font-weight: 800"
+              @click="uploadExamToAdmin"
+            >提交阅卷
+            </el-button>
+          </div>
         </el-col>
       </el-row>
     </el-header>
@@ -44,9 +46,19 @@
                   <span v-if="item.questionInfo.questionType !== 8" style="color: green">
                     (得分: {{ item.questionInfo.score }} 分)
                   </span>
+                  <div v-if="item.questionInfo.questionType !== 8">
+                    <el-button
+                      type="warning"
+                      size="mini"
+                      icon="el-icon-info"
+                      @click="questionAnalysisDialog = true"
+                    >试题解析</el-button>
+                  </div>
                   <div v-if="item.questionInfo.questionType === 8">
                     <div v-for="(child, childIndex) in item.children" :key="childIndex">
-                      <div>
+                      <div
+                        style="margin-top: 40px"
+                      >
                         <span style="color: red">
                           ({{ child.questionInfo.score }} 分)
                         </span>
@@ -54,6 +66,12 @@
                         <span style="color: green">
                           (得分: {{ child.questionInfo.score }} 分)
                         </span>
+                        <el-button
+                          type="warning"
+                          size="mini"
+                          icon="el-icon-info"
+                          @click="questionAnalysisDialog = true"
+                        >试题解析</el-button>
                       </div>
                       <!-- 单选和判断题候选答案列表 -->
                       <div
@@ -77,6 +95,10 @@
                             </span>
                           </el-radio-button>
                         </el-radio-group>
+                        <div style="margin-top: 25px">
+                          <el-divider />
+                          <span>答案解析</span>
+                        </div>
                       </div>
 
                       <!-- 多选和不定项选择题的候选答案列表 -->
@@ -98,6 +120,9 @@
                             </span>
                           </el-checkbox>
                         </el-checkbox-group>
+                        <div style="margin-top: 25px">
+                          <span>答案解析</span>
+                        </div>
                       </div>
 
                       <!-- 填空题和问答题的回答区 -->
@@ -138,6 +163,9 @@
                       </span>
                     </el-radio-button>
                   </el-radio-group>
+                  <div style="margin-top: 25px">
+                    <span>答案解析</span>
+                  </div>
                 </div>
 
                 <!-- 多选和不定项选择题的候选答案列表 -->
@@ -164,6 +192,10 @@
                       </span>
                     </el-checkbox-button>
                   </el-checkbox-group>
+                  <div style="margin-top: 25px">
+                    <el-divider />
+                    <span>答案解析</span>
+                  </div>
                 </div>
 
                 <!-- 填空题的回答区 -->
@@ -187,7 +219,7 @@
                       <span style="color: orangered" v-html="item.correctAnswer" />
                     </el-row>
                   </div>
-                  <div style="margin-top: 25px">
+                  <div v-if="paperStatus === 3" style="margin-top: 25px">
                     <span>评分:</span>
                     <el-input-number
                       v-model="questionMarks[item.questionInfo.pos].score"
@@ -203,6 +235,20 @@
                       @blur="onInputBlur(item.questionInfo)"
                     />
                   </div>
+                  <div v-if="paperStatus === 4" style="margin-top: 25px">
+                    <span>
+                      得分: <span style="color: green">{{ questionMarks[item.questionInfo.pos].score }}</span>
+                    </span>
+                    <br/>
+                    <br/>
+                    <span>
+                      评语: <span style="color: green">{{ questionMarks[item.questionInfo.pos].review }}</span>
+                    </span>
+                  </div>
+                  <div style="margin-top: 25px">
+                    <el-divider />
+                    <span>答案解析</span>
+                  </div>
                 </div>
                 <!-- 问答题的回答区 -->
                 <div
@@ -225,7 +271,7 @@
                       <span style="color: orangered" v-html="item.correctAnswer" />
                     </el-row>
                   </div>
-                  <div style="margin-top: 25px">
+                  <div v-if="paperStatus === 3" style="margin-top: 25px">
                     <span>评分:</span>
                     <el-input-number
                       v-model="questionMarks[item.questionInfo.pos].score"
@@ -241,6 +287,20 @@
                       @blur="onInputBlur(item.questionInfo)"
                     />
                   </div>
+                  <div v-if="paperStatus === 4" style="margin-top: 25px">
+                    <span>
+                      得分: <span style="color: green">{{ questionMarks[item.questionInfo.pos].score }}</span>
+                    </span>
+                    <br/>
+                    <br/>
+                    <span>
+                      评语: <span style="color: green">{{ questionMarks[item.questionInfo.pos].review }}</span>
+                    </span>
+                  </div>
+                  <div style="margin-top: 25px">
+                    <el-divider />
+                    <span>答案解析</span>
+                  </div>
                 </div>
               </el-card>
             </el-row>
@@ -408,6 +468,10 @@
         </el-col>
       </el-row>
     </el-main>
+
+    <el-dialog :visible.sync="questionAnalysisDialog" @close="questionAnalysisDialog = false">
+      <span>试题解析</span>
+    </el-dialog>
   </el-container>
 </template>
 
@@ -415,10 +479,11 @@
 import { getExamResult, getPaperQuestions, submitExamMark } from '@/api/exam'
 
 export default {
-  name: 'ExamPaperPreview',
+  name: 'ExamPaperResult',
   data() {
     return {
       paperStatus: 1,
+      questionAnalysisDialog: false,
       // 当前考试的信息
       examInfo: {},
       // 当前的考试题目
@@ -483,13 +548,7 @@ export default {
   },
   created() {
     const path = this.$route.path
-    if (path.startsWith('/exam/preview')) {
-      document.title = '试卷预览'
-      this.paperStatus = 1
-    } else if (path.startsWith('/exam/start')) {
-      document.title = '试卷考试'
-      this.paperStatus = 2
-    } else if (path.startsWith('/exam/mark')) {
+    if (path.startsWith('/exam/mark')) {
       document.title = '试卷评判'
       this.paperStatus = 3
       const resultId = this.$route.params.resultId