reghao пре 7 месеци
родитељ
комит
36ca127750

+ 26 - 7
src/api/exam.js

@@ -1,22 +1,33 @@
 import { delete0, get, post } from '@/utils/request'
 
 const examApi = {
+  // *********************************************************************************************************************
+  // 科目接口
   getSubject: '/api/content/exam/subject',
   getSubjectKV: '/api/content/exam/subject/kv',
+  getSubjectCascade: '/api/content/exam/subject/cascade',
+  // *********************************************************************************************************************
+  // 试题接口
   getQuestionType: '/api/content/exam/question/type',
   getQuestion: '/api/content/exam/question',
   addQuestion: '/api/content/exam/question',
+  // *********************************************************************************************************************
+  // 试卷接口
   getPaper: '/api/content/exam/paper',
   getPaperDetail: '/api/content/exam/paper/detail',
   getPaperKeyValue: '/api/content/exam/paper/kv',
   addPaper: '/api/content/exam/paper',
+  // *********************************************************************************************************************
+  // 考试接口
   examList: '/api/content/exam/eval/list',
   startExam: '/api/content/exam/eval/start',
   cacheUserAnswer: '/api/content/exam/eval/cache',
   submitExam: '/api/content/exam/eval/submit',
+  // *********************************************************************************************************************
+  // 阅卷接口
+  getExamMarkList: '/api/content/exam/mark/list',
   getMarkView: '/api/content/exam/mark/view',
-  submitExamMark: '/api/content/exam/mark/submit',
-  getExamMark: '/api/content/exam/result/mark',
+  submitExamMark: '/api/content/exam/mark/submit'
 }
 
 // *********************************************************************************************************************
@@ -29,6 +40,10 @@ export function getSubjectKV() {
   return get(examApi.getSubjectKV)
 }
 
+export function getSubjectCascade() {
+  return get(examApi.getSubjectCascade)
+}
+
 // *********************************************************************************************************************
 // 试题接口
 export function getQuestionType() {
@@ -97,22 +112,26 @@ export function cacheUserAnswer(data) {
 
 // *********************************************************************************************************************
 // 阅卷接口
-export function getMarkView(paperId) {
-  return get(examApi.getMarkView + '/' + paperId)
+export function getMarkView(paperId, userId) {
+  return get(examApi.getMarkView + '?paperId=' + paperId + '&userId=' + userId)
 }
 
 export function getExamMarkList(params) {
-  return get(examApi.getExamMark, params)
+  return get(examApi.getExamMarkList, params)
 }
 
 export function submitExamMark(data) {
   return post(examApi.submitExamMark, data)
 }
 
-export function getExamScoreList() {
-  return get('/api/content/exam/result/score')
+// *********************************************************************************************************************
+// 考试结果接口
+export function getResultView(paperId) {
+  return get('/api/content/exam/result/view/' + paperId)
 }
 
+// *********************************************************************************************************************
+// 考试数据接口
 export function getExamCount() {
   return get('/api/content/exam/statistic/count')
 }

+ 0 - 26
src/router/exam.js

@@ -8,11 +8,9 @@ const ExamQuestionList = () => import('views/exam/ExamQuestionList')
 const ExamQuestionAdd = () => import('views/exam/ExamQuestionAdd')
 const ExamPaperList = () => import('views/exam/ExamPaperList')
 const ExamPaperAdd = () => import('views/exam/ExamPaperAdd')
-const ExamPaperPreview = () => import('views/exam/ExamPaperPreview')
 const ExamEvalList = () => import('views/exam/ExamEvalList')
 const ExamCard = () => import('views/exam/ExamCard')
 const ExamScoreIndex = () => import('views/exam/ExamScoreIndex')
-const ExamPaperResult = () => import('views/exam/ExamPaperResult')
 const ExamMarkIndex = () => import('views/exam/ExamMarkIndex')
 const ExamPaperDetail = () => import('views/exam/ExamPaperDetail')
 
@@ -34,36 +32,18 @@ export default {
       component: ExamCard,
       meta: { needAuth: true }
     },
-    {
-      path: '/exam/starts/:paperId',
-      name: 'ExamPaperPreview',
-      component: ExamPaperPreview,
-      meta: { needAuth: true }
-    },
     {
       path: '/exam/score',
       name: 'ExamScoreIndex',
       component: ExamScoreIndex,
       meta: { needAuth: true }
     },
-    {
-      path: '/exam/score/:resultId',
-      name: 'ExamScorePage',
-      component: ExamPaperResult,
-      meta: { needAuth: true }
-    },
     {
       path: '/exam/mark',
       name: 'ExamMarkIndex',
       component: ExamMarkIndex,
       meta: { needAuth: true }
     },
-    {
-      path: '/exam/mark/:resultId',
-      name: 'ExamMarkPage',
-      component: ExamPaperResult,
-      meta: { needAuth: true }
-    },
     {
       path: '/exam/subject',
       name: 'ExamSubject',
@@ -94,12 +74,6 @@ export default {
       component: ExamPaperAdd,
       meta: { needAuth: true }
     },
-    {
-      path: '/exam/preview/:paperId',
-      name: 'ExamPaperPreview',
-      component: ExamPaperPreview,
-      meta: { needAuth: true }
-    },
     {
       path: '/exam/eval',
       name: 'ExamEvalList',

+ 27 - 5
src/views/exam/ExamDashboard.vue

@@ -6,16 +6,16 @@
           <span>ExamSysDiagram</span>
         </div>
         <div>
-          <el-steps active="0" simple>
+          <el-steps :active="0" simple>
             <el-step title="管理员" icon="el-icon-s-custom" />
             <el-step title="普通用户" icon="el-icon-user" />
           </el-steps>
-          <el-steps active="0" finish-status="success" simple style="margin-top: 20px">
+          <el-steps :active="0" finish-status="success" simple style="margin-top: 20px">
             <el-step title="科目" icon="el-icon-s-grid" />
             <el-step title="试题" icon="el-icon-tickets" />
             <el-step title="试卷" icon="el-icon-notebook-2" />
           </el-steps>
-          <el-steps active="0" finish-status="success" simple style="margin-top: 20px">
+          <el-steps :active="0" finish-status="success" simple style="margin-top: 20px">
             <el-step title="试卷列表" icon="el-icon-files" />
             <el-step title="试卷测评" icon="el-icon-loading" />
             <el-step title="试卷批改" icon="el-icon-edit" />
@@ -51,6 +51,16 @@
       </el-col>
       <el-col :md="12" class="movie-list">
         <el-card>
+          <div slot="header" class="clearfix">
+            <span style="margin-right: 5px">三级联动</span>
+            <el-cascader
+              :options="cascaderOptions"
+              placeholder="试试搜索: 武侯"
+              clearable
+              filterable
+              @change="handleChange"
+            ></el-cascader>
+          </div>
           <div id="chart3" style="height:400px;" />
         </el-card>
       </el-col>
@@ -59,7 +69,7 @@
 </template>
 
 <script>
-import { getExamCount, getExamPassRate } from '@/api/exam'
+import { getExamCount, getExamPassRate, getSubjectCascade } from '@/api/exam'
 
 export default {
   name: 'ExamDashboard',
@@ -72,7 +82,8 @@ export default {
       // 饼图的数据
       pieData: [],
       selectedValue: '1',
-      chartOption: null
+      chartOption: null,
+      cascaderOptions: []
     }
   },
   created() {
@@ -85,8 +96,19 @@ export default {
     })
     this.getExamPassRate()
     this.getExamNumbers()
+    this.getData()
   },
   methods: {
+    getData() {
+      getSubjectCascade().then(resp => {
+        if (resp.code === 0) {
+          this.cascaderOptions = resp.data
+        }
+      })
+    },
+    handleChange(val) {
+      this.$message.info('select -> ' + val)
+    },
     onSelectChange() {
       this.getExamPassRate()
     },

+ 5 - 4
src/views/exam/ExamEvalList.vue

@@ -241,13 +241,13 @@ export default {
         path: '/exam/paper/detail',
         query: {
           paperId: paperId,
-          viewType: 2
+          viewType: 2,
+          userId: ''
         }
       })
       window.open(routeUrl.href, '_blank')
     },
     waitMark(index, row) {
-      const paperId = row.examId
       this.$message.info('试卷待批改')
     },
     markPaper(index, row) {
@@ -257,7 +257,7 @@ export default {
         query: {
           paperId: paperId,
           viewType: 3,
-          userId: ''
+          userId: 0
         }
       })
       window.open(routeUrl.href, '_blank')
@@ -268,7 +268,8 @@ export default {
         path: '/exam/paper/detail',
         query: {
           paperId: paperId,
-          viewType: 4
+          viewType: 4,
+          userId: ''
         }
       })
       window.open(routeUrl.href, '_blank')

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

@@ -78,10 +78,10 @@
 </template>
 
 <script>
-import {getSubjectKV, getExamMarkList, getPaperKeyValues} from '@/api/exam'
+import { getExamMarkList, getPaperKeyValues } from '@/api/exam'
 
 export default {
-  name: 'ExamPaper',
+  name: 'ExamMarkIndex',
   data() {
     return {
       // 屏幕宽度, 为了控制分页条的大小

+ 0 - 50
src/views/exam/ExamMarkPage.vue

@@ -1,50 +0,0 @@
-<template>
-  <el-main>
-  </el-main>
-</template>
-
-<script>
-export default {
-  name: 'ExamMarker',
-  data() {
-    return {
-      // 屏幕宽度, 为了控制分页条的大小
-      screenWidth: document.body.clientWidth,
-      currentPage: 1,
-      pageSize: 20,
-      totalSize: 0,
-      dataList: [],
-      // **********************************************************************
-      searchForm: {
-        page: 1,
-        type: '1',
-        content: null
-      },
-      // 开始考试的提示框
-      startExamDialog: false,
-      // 当前选中的考试的信息
-      currentSelectedExam: {
-        examId: 114511
-      }
-    }
-  },
-  created() {
-    document.title = '阅卷'
-    this.getData(this.searchForm)
-  },
-  methods: {
-    handleCurrentChange(pageNumber) {
-      this.currentPage = pageNumber
-      this.getData(this.searchForm)
-      // 回到顶部
-      scrollTo(0, 0)
-    },
-    getData(searchForm) {
-      this.dataList = []
-    }
-  }
-}
-</script>
-
-<style>
-</style>

+ 38 - 9
src/views/exam/ExamPaperDetail.vue

@@ -158,8 +158,8 @@
                   <div v-for="(item2, index2) in userAnswerMap[item1.questionId].submitAnswer" :key="index2">
                     <span style="left: 0;margin-right: 1px;color: black;">第 {{ index2 + 1 }} 题</span>
                     <el-input
-                      :disabled="paperInfo.viewType !== 2"
                       v-model="userAnswerMap[item1.questionId].submitAnswer[index2]"
+                      :disabled="paperInfo.viewType !== 2"
                       type="text"
                       placeholder="请输入答案"
                       style="width: 20%; padding-right: 2px"
@@ -204,9 +204,9 @@
                   <span v-html="item1.questionContent" />
                   <el-divider />
                   <editor
-                    :disabled="paperInfo.viewType !== 2"
                     :id="item1.questionId+''"
                     v-model="userAnswerMap[item1.questionId].submitAnswer[0]"
+                    :disabled="paperInfo.viewType !== 2"
                     :init="init"
                     style="width: 50%"
                   />
@@ -299,7 +299,15 @@ import 'tinymce/themes/silver/theme.min.js'
 import 'tinymce/icons/default/icons'
 import Editor from '@tinymce/tinymce-vue'
 
-import { cacheUserAnswer, getExamInfo, getMarkView, getPaper, submitExam, submitExamMark } from '@/api/exam'
+import {
+  cacheUserAnswer,
+  getExamInfo,
+  getMarkView,
+  getPaper,
+  getResultView,
+  submitExam,
+  submitExamMark
+} from '@/api/exam'
 
 export default {
   name: 'ExamPaperDetail',
@@ -382,20 +390,18 @@ export default {
 
     const viewTypeStr = this.$route.query.viewType
     this.paperInfo.viewType = parseInt(viewTypeStr)
-
-    const userIdStr = this.$route.query.userId
-    this.userId = userIdStr
+    this.userId = this.$route.query.userId
 
     if (this.paperInfo.viewType === 1) {
       document.title = '试卷预览'
     } else if (this.paperInfo.viewType === 2) {
+      document.title = '试卷详情'
     } else if (this.paperInfo.viewType === 3) {
       document.title = '试卷批改'
     } else if (this.paperInfo.viewType === 4) {
       document.title = '试卷结果'
     }
 
-    // this.getPaperDetail()
     this.getPaperData()
   },
   methods: {
@@ -417,7 +423,7 @@ export default {
       } else if (this.paperInfo.viewType === 3) {
         this.startMarkPaper()
       } else if (this.paperInfo.viewType === 4) {
-        this.getPaperDetail()
+        this.getPaperResult()
       } else {
         this.$message.error('viewType unknown')
         return
@@ -456,7 +462,7 @@ export default {
       })
     },
     startMarkPaper() {
-      getMarkView(this.paperInfo.paperId).then((resp) => {
+      getMarkView(this.paperInfo.paperId, this.userId).then((resp) => {
         if (resp.code === 0) {
           this.processPaperData(resp)
         } else {
@@ -472,6 +478,20 @@ export default {
       })
     },
     getPaperResult() {
+      getResultView(this.paperInfo.paperId).then((resp) => {
+        if (resp.code === 0) {
+          this.processPaperData(resp)
+        } else {
+          this.$message.error(resp.msg)
+        }
+      }).catch((error) => {
+        this.$notify({
+          title: 'Tips',
+          message: error.message,
+          type: 'error',
+          duration: 2000
+        })
+      })
     },
     processPaperData(resp) {
       const respData = resp.data
@@ -489,6 +509,15 @@ export default {
         this.$message.error('试卷由用户自己批改')
         return
       } else if (status === 5) {
+        this.$message.error('试卷结果不存在')
+        return
+      } else if (status === 6) {
+        this.$message.error('试卷尚未批改')
+        return
+      } else if (status === 7) {
+        this.$message.error('试卷已批改')
+        return
+      } else if (status === 8) {
         this.$message.error('试卷访问类型 viewType 未知')
         return
       }

+ 0 - 614
src/views/exam/ExamPaperPreview.vue

@@ -1,614 +0,0 @@
-<template>
-  <el-container v-if="showPaper">
-    <el-header>
-      <el-row>
-        <el-col style="border-bottom: 1px solid #f5f5f5">
-          <span class="startExam">试卷名字: </span>
-          <span style="color: red;font-size: 18px;">{{ examInfo.name }}</span>
-          <span class="examTitle">考试时长: </span>
-          <span style="color: red;font-size: 18px;">{{ examInfo.duration }} 分钟</span>
-          <div v-if="paperStatus === 2">
-            <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>
-
-    <el-main>
-      <el-row>
-        <el-col :span="16">
-          <el-row v-for="(item, index) in questionMap" :key="index">
-            <el-row class="card-style">
-              <el-card>
-                <!-- 题目信息 -->
-                <div>
-                  <span v-if="item[1].questionType === 1">【单选题】</span>
-                  <span v-else-if="item[1].questionType === 2">【多选题】</span>
-                  <span v-else-if="item[1].questionType === 3">【不定项选择题】</span>
-                  <span v-else-if="item[1].questionType === 4">【判断题】</span>
-                  <span v-else-if="item[1].questionType === 5">【填空题】</span>
-                  <span v-else-if="item[1].questionType === 6">【问答题】</span>
-                  <span v-else-if="item[1].questionType === 7">【理解题】</span>
-                  <span v-else>【综合题】</span>
-                  <br>
-                  <br>
-                  <i class="num">{{ item[1].pos }}</i>
-                  <span style="color: red">
-                    ({{ item[1].score }} 分)
-                  </span>
-                  <span v-html="item[1].questionContent" />
-                  <div v-if="item[1].questionType === 8">
-                    <div v-for="(child, childIndex) in item[1].children" :key="childIndex">
-                      <div>
-                        <i class="num">{{ item[1].pos }}</i>
-                        <i class="num">{{ child.pos }}</i>
-                        <span style="color: red">
-                          ({{ child.score }} 分)
-                        </span>
-                        <span v-html="child.questionContent" />
-                      </div>
-                      <!-- 单选和判断题候选答案列表 -->
-                      <div
-                        v-show="child.questionType === 1 || child.questionType === 4"
-                        style="margin-top: 25px"
-                      >
-                        <el-radio-group
-                          v-for="(ans,ans_index) in child.answer"
-                          :key="ans_index"
-                          v-model="singleChecks[ans.questionId]"
-                          @change="singleCheckChange(child)"
-                        >
-                          <el-radio :label="ans.pos">
-                            <span>{{ optionName[ans.pos-1] + '、' + ans.answer }}</span>
-                          </el-radio>
-                        </el-radio-group>
-                      </div>
-
-                      <!-- 多选和不定项选择题的候选答案列表 -->
-                      <div
-                        v-show="child.questionType === 2 || child.questionType === 3"
-                        style="margin-top: 25px"
-                      >
-                        <el-checkbox-group
-                          v-for="(ans,ans_index) in child.answer"
-                          :key="ans_index"
-                          v-model="multipleChecked[item[1].pos]"
-                          @change="multipleCheckChange(child)"
-                        >
-                          <el-checkbox
-                            :label="ans.pos"
-                            border
-                            style="margin-top: 20px"
-                          >
-                            <span>{{ optionName[ans.pos-1] + '、' + ans.answer }}</span>
-                          </el-checkbox>
-                        </el-checkbox-group>
-                      </div>
-
-                      <!-- 填空题和问答题的回答区 -->
-                      <div
-                        v-show="child.questionType === 5 || child.questionType === 6"
-                        style="margin-top: 25px"
-                      >
-                        <el-input
-                          v-model="userAnswer[curIndex]"
-                          type="textarea"
-                          :rows="8"
-                          placeholder="请输入答案"
-                        />
-                      </div>
-                    </div>
-                  </div>
-                </div>
-
-                <!-- 单选和判断题候选答案列表 -->
-                <div
-                  v-show="item[1].questionType === 1 || item[1].questionType === 4"
-                  style="margin-top: 25px"
-                >
-                  <el-radio-group
-                    v-for="(ans,ans_index) in item[1].answer"
-                    :key="ans_index"
-                    v-model="singleChecks[ans.questionId]"
-                    @change="singleCheckChange(item[1])"
-                  >
-                    <el-radio :label="ans.pos">
-                      <span>{{ optionName[ans.pos-1] + '、' + ans.answer }}</span>
-                    </el-radio>
-                  </el-radio-group>
-                </div>
-
-                <!-- 多选和不定项选择题的候选答案列表 -->
-                <div
-                  v-show="item[1].questionType === 2 || item[1].questionType === 3"
-                  style="margin-top: 25px"
-                >
-                  <el-checkbox-group
-                    v-for="(ans,ans_index) in item[1].answer"
-                    :key="ans_index"
-                    v-model="multipleChecked[item[1].pos]"
-                    @change="multipleCheckChange(item[1])"
-                  >
-                    <el-checkbox
-                      :label="ans.pos"
-                      border
-                      style="margin-top: 20px;"
-                    >
-                      <span>{{ optionName[ans.pos-1] + '、' + ans.answer }}</span>
-                    </el-checkbox>
-                  </el-checkbox-group>
-                </div>
-
-                <!-- 填空题的回答区 -->
-                <div
-                  v-show="item[1].questionType === 5"
-                  style="margin-top: 25px"
-                >
-                  <el-input
-                    v-model="question5[item[1].questionId]"
-                    type="text"
-                    placeholder="请输入答案"
-                    @blur="onInputBlur(item[1])"
-                  />
-                </div>
-                <!-- 问答题的回答区 -->
-                <div
-                  v-show="item[1].questionType === 6"
-                  style="margin-top: 25px"
-                >
-                  <el-input
-                    v-model="question6[item[1].questionId]"
-                    type="textarea"
-                    :rows="8"
-                    placeholder="请输入答案"
-                    @blur="onInputBlur(item[1])"
-                  />
-                </div>
-              </el-card>
-            </el-row>
-          </el-row>
-        </el-col>
-        <!-- 答题卡 -->
-        <el-col :span="8">
-          <el-row class="card-style">
-            <el-card>
-              <div>
-                <p style="font-size: 18px;">答题卡</p>
-              </div>
-              <!-- 单选的答题卡 -->
-              <div style="margin-top: 25px">
-                <p style="font-size: 18px;">单选题</p>
-                <el-button
-                  v-for="item in questionList.length"
-                  v-show="questionList[item-1].questionType === 1"
-                  :key="item"
-                  style="margin-top: 10px;margin-left: 15px"
-                  size="mini"
-                  :class="questionList[item-1].questionType === 1 && userAnswer[item-1] !== undefined ?
-                    'done' : userAnswer[item-1] === undefined ? curIndex === (item-1) ? 'orange' : 'noAnswer' : 'noAnswer'"
-                >{{ item }}
-                </el-button>
-              </div>
-              <!-- 多选的答题卡 -->
-              <div style="margin-top: 25px">
-                <p style="font-size: 18px;">多选题</p>
-                <el-button
-                  v-for="item in questionList.length"
-                  v-show="questionList[item-1].questionType === 2"
-                  :key="item"
-                  style="margin-top: 10px;margin-left: 15px"
-                  size="mini"
-                >{{ item }}
-                </el-button>
-              </div>
-              <!-- 不定项选择题的答题卡 -->
-              <div style="margin-top: 25px">
-                <p style="font-size: 18px;">不定项选择题</p>
-                <el-button
-                  v-for="item in questionList.length"
-                  v-show="questionList[item-1].questionType === 3"
-                  :key="item"
-                  style="margin-top: 10px;margin-left: 15px"
-                  size="mini"
-                  :class="questionList[item-1].questionType === 3 && userAnswer[item-1] !== undefined ?
-                    'done' : userAnswer[item-1] === undefined ? curIndex === (item-1) ? 'orange' : 'noAnswer' : 'noAnswer'"
-                >{{ item }}
-                </el-button>
-              </div>
-
-              <!-- 判断题的答题卡 -->
-              <div style="margin-top: 25px">
-                <p style="font-size: 18px;">判断题</p>
-                <el-button
-                  v-for="item in questionList.length"
-                  v-show="questionList[item-1].questionType === 4"
-                  :key="item"
-                  style="margin-top: 10px;margin-left: 15px"
-                  size="mini"
-                  :class="questionList[item-1].questionType === 4 && userAnswer[item-1] !== undefined ?
-                    'done' : userAnswer[item-1] === undefined ? curIndex === (item-1) ? 'orange' : 'noAnswer' : 'noAnswer'"
-                >{{ item }}
-                </el-button>
-              </div>
-
-              <!-- 填空题的答题卡 -->
-              <div style="margin-top: 25px">
-                <p style="font-size: 18px;">填空题</p>
-                <el-button
-                  v-for="item in questionList.length"
-                  v-show="questionList[item-1].questionType === 5"
-                  :key="item"
-                  style="margin-top: 10px;margin-left: 15px"
-                  size="mini"
-                  :class="questionList[item-1].questionType === 5 && userAnswer[item-1] !== undefined ?
-                    'done' : userAnswer[item-1] === undefined ? curIndex === (item-1) ? 'orange' : 'noAnswer' : 'noAnswer'"
-                >{{ item }}
-                </el-button>
-              </div>
-
-              <!-- 问答题的答题卡 -->
-              <div style="margin-top: 25px">
-                <p style="font-size: 18px;">问答题</p>
-                <el-button
-                  v-for="item in questionList.length"
-                  v-show="questionList[item-1].questionType === 6"
-                  :key="item"
-                  style="margin-top: 10px;margin-left: 15px"
-                  size="mini"
-                  :class="questionList[item-1].questionType === 6 && userAnswer[item-1] !== undefined ?
-                    'done' : userAnswer[item-1] === undefined ? curIndex === (item-1) ? 'orange' : 'noAnswer' : 'noAnswer'"
-                >{{ item }}
-                </el-button>
-              </div>
-
-              <!-- 综合题的答题卡 -->
-              <div style="margin-top: 25px">
-                <p style="font-size: 18px;">综合题</p>
-                <el-button
-                  v-for="item in questionList.length"
-                  v-show="questionList[item-1].questionType === 8"
-                  :key="item"
-                  style="margin-top: 10px;margin-left: 15px"
-                  size="mini"
-                  :class="questionList[item-1].questionType === 8 && userAnswer[item-1] !== undefined ?
-                    'done' : userAnswer[item-1] === undefined ? curIndex === (item-1) ? 'orange' : 'noAnswer' : 'noAnswer'"
-                  @click="curIndex = item-1"
-                >{{ item }}
-                </el-button>
-              </div>
-            </el-card>
-          </el-row>
-        </el-col>
-      </el-row>
-    </el-main>
-  </el-container>
-</template>
-
-<script>
-import { getPaper, submitExam } from '@/api/exam'
-
-export default {
-  name: 'ExamPaperPreview',
-  data() {
-    return {
-      paperStatus: 1,
-      // 当前考试的信息
-      examInfo: {
-        name: '',
-        description: '',
-        duration: 0,
-        totalScore: 0
-      },
-      // 当前的考试题目
-      questionList: [
-        {
-          questionType: ''
-        }
-      ],
-      // 当前题目的索引值
-      curIndex: 0,
-      // 控制大图的对话框
-      bigImgDialog: false,
-      // 当前要展示的大图的url
-      bigImgUrl: '',
-      // 用户选择的答案
-      userAnswer: [],
-      // 页面数据加载
-      loading: {},
-      // 页面绘制是否开始
-      showPaper: false,
-      // 答案的选项名abcd数据
-      optionName: ['A', 'B', 'C', 'D', 'E', 'F', 'G'],
-      // 考试总时长
-      duration: 0,
-      answer: {
-        pos: null,
-        questionId: null,
-        questionType: null,
-        questionAnswer: null,
-        children: []
-      },
-      questionMap: new Map(),
-      childMap: new Map(),
-      userAnswers: new Map(),
-      singleChecks: {},
-      multipleCheck: [],
-      multipleChecked: [
-        [], [], [], [], [], [], [], [], [], [],
-        [], [], [], [], [], [], [], [], [], [],
-        [], [], [], [], [], [], [], [], [], [],
-        [], [], [], [], [], [], [], [], [], [],
-        [], [], [], [], [], [], [], [], [], [],
-        [], [], [], [], [], [], [], [], [], [],
-        [], [], [], [], [], [], [], [], [], [],
-        [], [], [], [], [], [], [], [], [], [],
-        [], [], [], [], [], [], [], [], [], [],
-        [], [], [], [], [], [], [], [], [], []
-      ],
-      multipleChecks: {},
-      question5: {},
-      question6: {}
-    }
-  },
-  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
-    }
-
-    const paperId = this.$route.params.paperId
-    this.getPaperDeatil(paperId)
-  },
-  methods: {
-    renderByMathjax() {
-      // tinymce 的 mathjax 插件生成的 latex 格式公式放在 className 为 math-tex 的 span 标签内
-      const className = 'math-tex'
-      this.$nextTick(function() {
-        if (this.MathJax.isMathjaxConfig) {
-          this.MathJax.initMathjaxConfig()
-        }
-        this.MathJax.MathQueue1(className)
-      })
-    },
-    // 查询当前考试的信息
-    getPaperDeatil(paperId) {
-      getPaper(paperId).then((resp) => {
-        if (resp.code === 0) {
-          const respData = resp.data
-          this.examInfo.paperId = respData.paperId
-          this.examInfo.name = respData.name
-          this.examInfo.description = respData.description
-          this.examInfo.duration = respData.duration
-          this.examInfo.totalScore = respData.totalScore
-
-          this.questionList = respData.questions
-          // 重置问题的顺序 单选 ->  -> 判断 -> 简答
-          this.questionList = this.questionList.sort(function(a, b) {
-            return a.questionType - b.questionType
-          })
-
-          for (const item of this.questionList) {
-            this.questionMap.set(item.questionId, item)
-            if (item.questionType === 2 || item.questionType === 3) {
-              this.$set(this.multipleChecks, item.questionId, [])
-            } else if (item.questionType === 5) {
-              this.$set(this.question5, item.questionId, null)
-            } else if (item.questionType === 6) {
-              this.$set(this.question6, item.questionId, null)
-            }
-
-            if (item.children !== undefined && item.children !== null) {
-              for (const child of item.children) {
-                this.childMap.set(child.questionId, item.questionId)
-                this.questionMap.set(item.questionId, item)
-                if (child.questionType === 2 || child.questionType === 3) {
-                  this.$set(this.multipleChecks, child.questionId, [])
-                } else if (child.questionType === 5) {
-                  this.$set(this.question5, child.questionId, null)
-                } else if (child.questionType === 6) {
-                  this.$set(this.question6, child.questionId, null)
-                }
-              }
-            }
-          }
-          this.showPaper = true
-          this.renderByMathjax()
-        }
-      })
-    },
-    // ****************************************************************************************************************
-    // 单选和判断
-    singleCheckChange(val) {
-      const questionId = val.questionId
-      var pid = this.getPid(questionId)
-      const answer = this.singleChecks[questionId]
-      this.setUserAnswers(val, answer, pid)
-    },
-    // 多选和不定项选择题
-    multipleCheckChange(val) {
-      var questionId = val.questionId
-      var pid = this.getPid(questionId)
-      var answer = this.multipleChecked[val.pos]
-      var answerStr = answer.join(',')
-      this.setUserAnswers(val, answerStr, pid)
-    },
-    // 填空和问答题
-    onInputBlur(val) {
-      var questionId = val.questionId
-      var pid = this.getPid(questionId)
-      var questionType = val.questionType
-      if (questionType === 5) {
-        const answer = this.question5[questionId]
-        this.setUserAnswers(val, answer, pid)
-      } else if (questionType === 6) {
-        const answer = this.question6[questionId]
-        this.setUserAnswers(val, answer, pid)
-      }
-    },
-    getPid(questionId) {
-      var pid = this.childMap.get(questionId)
-      if (pid !== undefined && pid !== null) {
-        return pid
-      } else {
-        return 0
-      }
-    },
-    setUserAnswers(question, answer, pid) {
-      const userAnswer = {}
-      userAnswer.questionId = question.questionId
-      userAnswer.questionType = question.questionType
-      userAnswer.pos = question.pos
-      userAnswer.answer = answer
-      userAnswer.pid = pid
-      this.userAnswers.set(userAnswer.questionId, userAnswer)
-    },
-    async uploadExamToAdmin() {
-      for (const item of this.questionMap) {
-        const questionId = item[0]
-        const question = item[1]
-        const questionType = question.questionType
-        if (questionType === 8) {
-          continue
-        }
-
-        const answer = this.userAnswers.get(questionId)
-        if (answer === undefined || answer === null) {
-          console.log(questionId)
-          this.$message.error('试题 ' + question.pos + ' 还未完成')
-        } else {
-          if (answer.answer === null || answer.answer === '') {
-            console.log(questionId)
-            this.$message.error('试题 ' + question.pos + ' 答案不能为空')
-          }
-        }
-      }
-
-      var submitAnswers = []
-      for (const item of this.userAnswers) {
-        submitAnswers.push(item[1])
-      }
-
-      const userResult = {}
-      userResult.paperId = this.examInfo.paperId
-      userResult.userAnswers = submitAnswers
-      submitExam(userResult).then((resp) => {
-        if (resp.code === 0) {
-          this.$notify({
-            title: 'Tips',
-            message: '考试结果已提交',
-            type: 'success',
-            duration: 2000
-          })
-          this.$router.push('/exam/score')
-        }
-      }).catch(error => {
-        this.$notify({
-          title: '提示',
-          message: error.message,
-          type: 'error',
-          duration: 3000
-        })
-      })
-    }
-  }
-}
-</script>
-
-<style lang="scss" scoped>
-* {
-  font-weight: 800;
-}
-
-.el-container {
-  width: 100%;
-  height: 100%;
-}
-
-.startExam {
-  color: #160f58;
-  border-bottom: 4px solid #ffd550;
-  font-size: 18px;
-  font-weight: 700;
-  padding-bottom: 10px
-}
-
-.examTitle {
-  font-size: 18px;
-  color: #cbcacf;
-  margin-left: 20px;
-  font-weight: 700;
-}
-
-.el-radio-group label {
-  display: block;
-  width: 400px;
-  padding: 48px 20px 10px 20px;
-  border-radius: 4px;
-  border: 1px solid #dcdfe6;
-  margin-bottom: 10px;
-  cursor: pointer;
-  position: relative;
-
-  span {
-    position: absolute;
-    top: 50%;
-    transform: translateY(-50%);
-    font-size: 16px;
-  }
-}
-
-.el-radio-group label:hover {
-  background-color: rgb(245, 247, 250);
-}
-
-/*当前选中的答案*/
-.active {
-  border: 1px solid #1f90ff !important;
-  opacity: .5;
-}
-
-/*做过的题目的高亮颜色*/
-.done {
-  background-color: rgb(87, 148, 247);
-}
-
-/*未做题目的高亮颜色*/
-.noAnswer {
-  background-color: rgb(238, 238, 238);
-}
-
-/*当前在做的题目高亮的颜色*/
-.orange {
-  background-color: rgb(255, 213, 80);
-}
-
-.num {
-  display: inline-block;
-  background: url('../../assets/img/examTitle.png') no-repeat 95%;
-  background-size: contain;
-  height: 37px;
-  width: 37px;
-  line-height: 30px;
-  color: #fff;
-  font-size: 20px;
-  text-align: center;
-  margin-right: 15px;
-}
-
-.card-style {
-  padding-top: 5px;
-  padding-bottom: 5px;
-  padding-left: 5px;
-  padding-right: 5px;
-}
-</style>

+ 0 - 746
src/views/exam/ExamPaperResult.vue

@@ -1,746 +0,0 @@
-<template>
-  <el-container v-if="showPaper">
-    <el-header>
-      <el-row>
-        <el-col style="border-bottom: 1px solid #f5f5f5">
-          <el-row>
-            <span class="examTitle">试卷名字: </span>
-            <span style="color: red;font-size: 18px;">{{ examInfo.examName }}</span>
-            <span class="examTitle">试卷总分: </span>
-            <span style="color: red;font-size: 18px;">{{ examInfo.paperScore }} 分</span>
-            <span class="examTitle">考试时间: </span>
-            <span style="color: red;font-size: 18px;">{{ examInfo.examTime }}</span>
-          </el-row>
-          <el-row>
-            <span class="examTitle">总分: </span>
-            <span style="color: red;font-size: 18px;">{{ examInfo.userScore }} 分</span>
-            <span class="examTitle">客观题得分: </span>
-            <span style="color: red;font-size: 18px;">{{ examInfo.objectiveScore }} 分</span>
-            <span class="examTitle">主观题得分: </span>
-            <span style="color: red;font-size: 18px;">{{ examInfo.subjectiveScore }} 分</span>
-          </el-row>
-          <el-row>
-            <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-row>
-        </el-col>
-      </el-row>
-    </el-header>
-
-    <el-main>
-      <el-row>
-        <el-col :span="16">
-          <el-row v-for="(item, index) in questionResults" :key="index">
-            <el-row class="card-style">
-              <el-card>
-                <!-- 题目信息 -->
-                <div>
-                  <span v-if="item.questionInfo.questionType === 1">【单选题】</span>
-                  <span v-else-if="item.questionInfo.questionType === 2">【多选题】</span>
-                  <span v-else-if="item.questionInfo.questionType === 3">【不定项选择题】</span>
-                  <span v-else-if="item.questionInfo.questionType === 4">【判断题】</span>
-                  <span v-else-if="item.questionInfo.questionType === 5">【填空题】</span>
-                  <span v-else-if="item.questionInfo.questionType === 6">【问答题】</span>
-                  <span v-else-if="item.questionInfo.questionType === 7">【理解题】</span>
-                  <span v-else>【综合题】</span>
-                  <br>
-                  <br>
-                  <i class="num">{{ item.questionInfo.pos }}</i>
-                  <span style="color: red">
-                    ({{ item.questionInfo.score }} 分)
-                  </span>
-                  <span v-html="item.questionInfo.questionContent" />
-                  <span style="color: green">
-                    (得分: {{ item.userScore }} 分)
-                  </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
-                        style="margin-top: 40px"
-                      >
-                        <span style="color: red">
-                          ({{ child.questionInfo.score }} 分)
-                        </span>
-                        <span v-html="child.questionInfo.questionContent" />
-                        <span style="color: green">
-                          (得分: {{ child.userScore }} 分)
-                        </span>
-                        <el-button
-                          type="warning"
-                          size="mini"
-                          icon="el-icon-info"
-                          @click="questionAnalysisDialog = true"
-                        >试题解析</el-button>
-                      </div>
-                      <!-- 单选和判断题候选答案列表 -->
-                      <div
-                        v-show="child.questionInfo.questionType === 1 || child.questionInfo.questionType === 4"
-                        style="margin-top: 25px"
-                      >
-                        <el-radio-group
-                          v-for="(ans,ans_index) in child.questionInfo.answer"
-                          :key="ans_index"
-                          v-model="child.userAnswer"
-                          text-color="green"
-                        >
-                          <el-radio-button
-                            :label="ans.pos"
-                            disabled
-                          >
-                            <span
-                              :class="ans.correct ? 'el-icon-check' : ''"
-                            >
-                              {{ optionName[ans_index] + '、' + ans.answer }}
-                            </span>
-                          </el-radio-button>
-                        </el-radio-group>
-                        <div style="margin-top: 25px">
-                          <el-divider />
-                          <span>答案解析</span>
-                        </div>
-                      </div>
-
-                      <!-- 多选和不定项选择题的候选答案列表 -->
-                      <div
-                        v-show="child.questionType === 2 || child.questionType === 3"
-                        style="margin-top: 25px"
-                      >
-                        <el-checkbox-group
-                          v-for="(ans,ans_index) in child.answer"
-                          :key="ans_index"
-                          v-model="child.userAnswer"
-                          text-color="green"
-                        >
-                          <el-checkbox :label="ans_index">
-                            <span
-                              :class="ans.correct ? 'el-icon-check' : ''"
-                            >
-                              {{ optionName[ans_index] + '、' + ans.answer }}
-                            </span>
-                          </el-checkbox>
-                        </el-checkbox-group>
-                        <div style="margin-top: 25px">
-                          <span>答案解析</span>
-                        </div>
-                      </div>
-
-                      <!-- 填空题和问答题的回答区 -->
-                      <div
-                        v-show="child.questionType === 5 || child.questionType === 6"
-                        style="margin-top: 25px"
-                      >
-                        <el-input
-                          v-model="userAnswer[curIndex]"
-                          type="textarea"
-                          :rows="8"
-                          placeholder="请输入答案"
-                        />
-                      </div>
-                    </div>
-                  </div>
-                </div>
-
-                <!-- 单选和判断题候选答案列表 -->
-                <div
-                  v-show="item.questionInfo.questionType === 1 || item.questionInfo.questionType === 4"
-                  style="margin-top: 25px"
-                >
-                  <el-radio-group
-                    v-for="(ans,ans_index) in item.questionInfo.answer"
-                    :key="ans_index"
-                    v-model="item.userAnswer"
-                    text-color="green"
-                  >
-                    <el-radio-button
-                      :label="ans.pos"
-                      disabled
-                    >
-                      <span
-                        :class="ans.correct ? 'el-icon-check' : ''"
-                      >
-                        {{ optionName[ans_index] + '、' + ans.answer }}
-                      </span>
-                    </el-radio-button>
-                  </el-radio-group>
-                  <div style="margin-top: 25px">
-                    <span>答案解析</span>
-                  </div>
-                </div>
-
-                <!-- 多选和不定项选择题的候选答案列表 -->
-                <div
-                  v-show="item.questionInfo.questionType === 2 || item.questionInfo.questionType === 3"
-                  style="margin-top: 25px"
-                >
-                  <el-checkbox-group
-                    v-for="(ans,ans_index) in item.questionInfo.answer"
-                    :key="ans_index"
-                    v-model="item.userAnswer"
-                    text-color="green"
-                  >
-                    <el-checkbox-button
-                      :label="ans.pos"
-                      border
-                      style="margin-top: 20px;"
-                      disabled
-                    >
-                      <span
-                        :class="ans.correct ? 'el-icon-check' : ''"
-                      >
-                        {{ optionName[ans_index] + '、' + ans.answer }}
-                      </span>
-                    </el-checkbox-button>
-                  </el-checkbox-group>
-                  <div style="margin-top: 25px">
-                    <el-divider />
-                    <span>答案解析</span>
-                  </div>
-                </div>
-
-                <!-- 填空题的回答区 -->
-                <div
-                  v-show="item.questionInfo.questionType === 5"
-                  style="margin-top: 25px"
-                >
-                  <div style="margin-top: 25px">
-                    <el-row>
-                      <span>用户答案:</span>
-                    </el-row>
-                    <el-row>
-                      <span style="color: green" v-html="item.userAnswer" />
-                    </el-row>
-                  </div>
-                  <div style="margin-top: 25px">
-                    <el-row>
-                      <span>正确答案:</span>
-                    </el-row>
-                    <el-row>
-                      <span style="color: orangered" v-html="item.correctAnswer" />
-                    </el-row>
-                  </div>
-                  <div v-if="paperStatus === 3" style="margin-top: 25px">
-                    <span>评分:</span>
-                    <el-input-number
-                      v-model="questionMarks[item.questionInfo.pos].score"
-                      :min="0"
-                      :max="50"
-                      @change="onInputNumber(item.questionInfo)"
-                    />
-                    <el-input
-                      v-model="questionMarks[item.questionInfo.pos].review"
-                      type="textarea"
-                      :rows="3"
-                      placeholder="请输入评语"
-                      @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
-                  v-show="item.questionInfo.questionType === 6"
-                  style="margin-top: 25px"
-                >
-                  <div style="margin-top: 25px">
-                    <el-row>
-                      <span>用户答案:</span>
-                    </el-row>
-                    <el-row>
-                      <span style="color: green" v-html="item.userAnswer" />
-                    </el-row>
-                  </div>
-                  <div style="margin-top: 25px">
-                    <el-row>
-                      <span>正确答案:</span>
-                    </el-row>
-                    <el-row>
-                      <span style="color: orangered" v-html="item.correctAnswer" />
-                    </el-row>
-                  </div>
-                  <div v-if="paperStatus === 3" style="margin-top: 25px">
-                    <span>评分:</span>
-                    <el-input-number
-                      v-model="questionMarks[item.questionInfo.pos].score"
-                      :min="0"
-                      :max="50"
-                      @change="onInputNumber(item.questionInfo)"
-                    />
-                    <el-input
-                      v-model="questionMarks[item.questionInfo.pos].review"
-                      type="textarea"
-                      :rows="3"
-                      placeholder="请输入评语"
-                      @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>
-          </el-row>
-        </el-col>
-        <!-- 答题卡 -->
-        <el-col :span="8">
-          <el-row class="card-style">
-            <el-card>
-              <div slot="header" class="clearfix">
-                <h1>阅卷须知</h1>
-              </div>
-              <div class="text item">
-                <el-row>
-                  <h3>客观题部分</h3>
-                  <span>
-                    系统已自动对客观题进行了阅卷<br>
-                  </span>
-                  <span>
-                    用户答案使用<span style="color: green">绿色</span>文字标记<br>
-                  </span>
-                  <span>
-                    参考答案前面会使用 <span class="el-icon-check" /> 来标记<br>
-                  </span>
-                </el-row>
-                <el-row>
-                  <h3>主观题部分</h3>
-                  <span>
-                    用户答案使用<span style="color: green">绿色</span>文字标记<br>
-                  </span>
-                  <span>
-                    参考答案使用<span style="color: orangered">红色</span>文字标记<br>
-                  </span>
-                </el-row>
-              </div>
-            </el-card>
-          </el-row>
-          <el-row class="card-style">
-            <el-card>
-              <div>
-                <p style="font-size: 18px;">答题卡</p>
-              </div>
-              <!-- 单选的答题卡 -->
-              <div style="margin-top: 25px">
-                <p style="font-size: 18px;">单选题</p>
-                <el-button
-                  v-for="item in questionList.length"
-                  v-show="questionList[item-1].questionType === 1"
-                  :key="item"
-                  style="margin-top: 10px;margin-left: 15px"
-                  size="mini"
-                  :class="questionList[item-1].questionType === 1 && userAnswer[item-1] !== undefined ?
-                    'done' : userAnswer[item-1] === undefined ? curIndex === (item-1) ? 'orange' : 'noAnswer' : 'noAnswer'"
-                >{{ item }}
-                </el-button>
-              </div>
-              <!-- 多选的答题卡 -->
-              <div style="margin-top: 25px">
-                <p style="font-size: 18px;">多选题</p>
-                <el-button
-                  v-for="item in questionList.length"
-                  v-show="questionList[item-1].questionType === 2"
-                  :key="item"
-                  style="margin-top: 10px;margin-left: 15px"
-                  size="mini"
-                >{{ item }}
-                </el-button>
-              </div>
-              <!-- 不定项选择题的答题卡 -->
-              <div style="margin-top: 25px">
-                <p style="font-size: 18px;">不定项选择题</p>
-                <el-button
-                  v-for="item in questionList.length"
-                  v-show="questionList[item-1].questionType === 3"
-                  :key="item"
-                  style="margin-top: 10px;margin-left: 15px"
-                  size="mini"
-                  :class="questionList[item-1].questionType === 3 && userAnswer[item-1] !== undefined ?
-                    'done' : userAnswer[item-1] === undefined ? curIndex === (item-1) ? 'orange' : 'noAnswer' : 'noAnswer'"
-                >{{ item }}
-                </el-button>
-              </div>
-
-              <!-- 判断题的答题卡 -->
-              <div style="margin-top: 25px">
-                <p style="font-size: 18px;">判断题</p>
-                <el-button
-                  v-for="item in questionList.length"
-                  v-show="questionList[item-1].questionType === 4"
-                  :key="item"
-                  style="margin-top: 10px;margin-left: 15px"
-                  size="mini"
-                  :class="questionList[item-1].questionType === 4 && userAnswer[item-1] !== undefined ?
-                    'done' : userAnswer[item-1] === undefined ? curIndex === (item-1) ? 'orange' : 'noAnswer' : 'noAnswer'"
-                >{{ item }}
-                </el-button>
-              </div>
-
-              <!-- 填空题的答题卡 -->
-              <div style="margin-top: 25px">
-                <p style="font-size: 18px;">填空题</p>
-                <el-button
-                  v-for="item in questionList.length"
-                  v-show="questionList[item-1].questionType === 5"
-                  :key="item"
-                  style="margin-top: 10px;margin-left: 15px"
-                  size="mini"
-                  :class="questionList[item-1].questionType === 5 && userAnswer[item-1] !== undefined ?
-                    'done' : userAnswer[item-1] === undefined ? curIndex === (item-1) ? 'orange' : 'noAnswer' : 'noAnswer'"
-                >{{ item }}
-                </el-button>
-              </div>
-
-              <!-- 问答题的答题卡 -->
-              <div style="margin-top: 25px">
-                <p style="font-size: 18px;">问答题</p>
-                <el-button
-                  v-for="item in questionList.length"
-                  v-show="questionList[item-1].questionType === 6"
-                  :key="item"
-                  style="margin-top: 10px;margin-left: 15px"
-                  size="mini"
-                  :class="questionList[item-1].questionType === 6 && userAnswer[item-1] !== undefined ?
-                    'done' : userAnswer[item-1] === undefined ? curIndex === (item-1) ? 'orange' : 'noAnswer' : 'noAnswer'"
-                >{{ item }}
-                </el-button>
-              </div>
-
-              <!-- 综合题的答题卡 -->
-              <div style="margin-top: 25px">
-                <p style="font-size: 18px;">综合题</p>
-                <el-button
-                  v-for="item in questionList.length"
-                  v-show="questionList[item-1].questionType === 8"
-                  :key="item"
-                  style="margin-top: 10px;margin-left: 15px"
-                  size="mini"
-                  :class="questionList[item-1].questionType === 8 && userAnswer[item-1] !== undefined ?
-                    'done' : userAnswer[item-1] === undefined ? curIndex === (item-1) ? 'orange' : 'noAnswer' : 'noAnswer'"
-                  @click="curIndex = item-1"
-                >{{ item }}
-                </el-button>
-              </div>
-            </el-card>
-          </el-row>
-        </el-col>
-      </el-row>
-    </el-main>
-
-    <el-dialog :visible.sync="questionAnalysisDialog" @close="questionAnalysisDialog = false">
-      <span>试题解析</span>
-    </el-dialog>
-  </el-container>
-</template>
-
-<script>
-import { getMarkView, getPaperQuestions, submitExamMark } from '@/api/exam'
-
-export default {
-  name: 'ExamPaperResult',
-  data() {
-    return {
-      paperStatus: 1,
-      questionAnalysisDialog: false,
-      // 当前考试的信息
-      examInfo: {},
-      // 当前的考试题目
-      questionList: [
-        {
-          questionType: ''
-        }
-      ],
-      // 当前题目的索引值
-      curIndex: 0,
-      // 控制大图的对话框
-      bigImgDialog: false,
-      // 当前要展示的大图的url
-      bigImgUrl: '',
-      // 用户选择的答案
-      userAnswer: [],
-      // 页面数据加载
-      loading: {},
-      // 页面绘制是否开始
-      showPaper: false,
-      // 答案的选项名abcd数据
-      optionName: ['A', 'B', 'C', 'D', 'E', 'F', 'G'],
-      // 考试总时长
-      duration: 0,
-      answer: {
-        pos: null,
-        questionId: null,
-        questionType: null,
-        questionAnswer: null,
-        children: []
-      },
-      questionMap: new Map(),
-      childMap: new Map(),
-      questionResults: [],
-      questionMarks: [
-        { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' },
-        { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' },
-        { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' },
-        { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' },
-        { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' },
-        { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' },
-        { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' },
-        { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' },
-        { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' },
-        { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' },
-        { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' }, { score: 0, review: '' }
-      ]
-    }
-  },
-  created() {
-    const path = this.$route.path
-    if (path.startsWith('/exam/mark')) {
-      document.title = '试卷评判'
-      this.paperStatus = 3
-      const resultId = this.$route.params.resultId
-      this.getExamResult(resultId)
-    } else if (path.startsWith('/exam/score')) {
-      document.title = '试卷成绩'
-      this.paperStatus = 4
-      const resultId = this.$route.params.resultId
-      this.getExamResult(resultId)
-    }
-
-    const paperId = this.$route.params.paperId
-  },
-  methods: {
-    renderByMathjax() {
-      // tinymce 的 mathjax 插件生成的 latex 格式公式放在 className 为 math-tex 的 span 标签内
-      const className = 'math-tex'
-      this.$nextTick(function() {
-        if (this.MathJax.isMathjaxConfig) {
-          this.MathJax.initMathjaxConfig()
-        }
-        this.MathJax.MathQueue1(className)
-      })
-    },
-    getExamResult(resultId) {
-      getMarkView(resultId).then((resp) => {
-        if (resp.code === 0) {
-          const respData = resp.data
-          this.examInfo = {
-            examId: respData.examId,
-            resultId: respData.resultId,
-            examName: respData.examName,
-            paperScore: respData.paperScore,
-            examTime: respData.examTime,
-            userScore: respData.userScore,
-            objectiveScore: respData.objectiveScore,
-            subjectiveScore: respData.subjectiveScore
-          }
-          this.questionResults = resp.data.questionResults
-          const paperId = resp.data.examId
-          this.getQuestionInfo1(paperId)
-        }
-      })
-    },
-    // 查询考试的题目信息
-    getQuestionInfo1(paperId) {
-      getPaperQuestions(paperId).then(resp => {
-        if (resp.code === 0) {
-          this.questionList = resp.data || []
-          // 重置问题的顺序 单选 ->  -> 判断 -> 简答
-          this.questionList = this.questionList.sort(function(a, b) {
-            return a.questionType - b.questionType
-          })
-
-          for (const item of this.questionList) {
-            if (item.questionType === 5 || item.questionType === 6) {
-              this.questionMap.set(item.questionId, item)
-            }
-
-            if (item.children !== undefined && item.children !== null) {
-              for (const child of item.children) {
-                if (child.questionType === 5 || child.questionType === 6) {
-                  this.childMap.set(child.questionId, item.questionId)
-                  this.questionMap.set(item.questionId, item)
-                }
-              }
-            }
-          }
-          this.showPaper = true
-          this.renderByMathjax()
-        }
-      })
-    },
-    // ****************************************************************************************************************
-    // 填空和问答题
-    onInputNumber(val) {
-      console.log(this.questionMarks[val.pos])
-    },
-    onInputBlur(val) {
-      console.log(this.questionMarks[val.pos])
-    },
-    async uploadExamToAdmin() {
-      var submitMarks = []
-      for (const item of this.questionMap) {
-        const question = item[1]
-        const pos = question.pos
-        const markForm = this.questionMarks[pos]
-        submitMarks.push({
-          questionId: question.questionId,
-          pos: pos,
-          score: markForm.score,
-          review: markForm.review
-        })
-      }
-
-      const markResult = {}
-      markResult.paperId = this.examInfo.examId
-      markResult.resultId = this.examInfo.resultId
-      markResult.paperMarks = submitMarks
-      submitExamMark(markResult).then((resp) => {
-        if (resp.code === 0) {
-          this.$notify({
-            title: 'Tips',
-            message: '阅卷结果已提交',
-            type: 'success',
-            duration: 2000
-          })
-          this.$router.push('/exam/mark')
-        }
-      }).catch(error => {
-        this.$notify({
-          title: '提示',
-          message: error.message,
-          type: 'error',
-          duration: 3000
-        })
-      })
-    },
-    showCorrectAnswer(correctAnswer) {
-      this.$message.info(correctAnswer)
-    }
-  }
-}
-</script>
-
-<style lang="scss" scoped>
-* {
-  font-weight: 800;
-}
-
-.el-container {
-  width: 100%;
-  height: 100%;
-}
-
-.startExam {
-  color: #160f58;
-  border-bottom: 4px solid #ffd550;
-  font-size: 18px;
-  font-weight: 700;
-  padding-bottom: 10px
-}
-
-.examTitle {
-  font-size: 18px;
-  color: #cbcacf;
-  margin-left: 20px;
-  font-weight: 700;
-}
-
-.el-radio-group label {
-  display: block;
-  width: 400px;
-  padding: 48px 20px 10px 20px;
-  border-radius: 4px;
-  border: 1px solid #dcdfe6;
-  margin-bottom: 10px;
-  cursor: pointer;
-  position: relative;
-
-  span {
-    position: absolute;
-    top: 50%;
-    transform: translateY(-50%);
-    font-size: 16px;
-  }
-}
-
-.el-radio-group label:hover {
-  background-color: rgb(245, 247, 250);
-}
-
-/*当前选中的答案*/
-.active {
-  border: 1px solid #1f90ff !important;
-  opacity: .5;
-}
-
-/*做过的题目的高亮颜色*/
-.done {
-  background-color: rgb(87, 148, 247);
-}
-
-/*未做题目的高亮颜色*/
-.noAnswer {
-  background-color: rgb(238, 238, 238);
-}
-
-/*当前在做的题目高亮的颜色*/
-.orange {
-  background-color: rgb(255, 213, 80);
-}
-
-.num {
-  display: inline-block;
-  background: url('../../assets/img/examTitle.png') no-repeat 95%;
-  background-size: contain;
-  height: 37px;
-  width: 37px;
-  line-height: 30px;
-  color: #fff;
-  font-size: 20px;
-  text-align: center;
-  margin-right: 15px;
-}
-
-.card-style {
-  padding-top: 5px;
-  padding-bottom: 5px;
-  padding-left: 5px;
-  padding-right: 5px;
-}
-</style>

+ 5 - 138
src/views/exam/ExamScoreIndex.vue

@@ -1,158 +1,25 @@
 <template>
   <el-container>
-    <el-header height="220">
-      <el-row>
-        <el-select
-          v-model="queryInfo.subjectId"
-          clearable
-          placeholder="请选择科目"
-          style="margin-left: 5px"
-          @change="subjectChange"
-        >
-          <el-option
-            v-for="item in allSubject"
-            :key="item.key"
-            :label="item.value"
-            :value="item.key"
-          />
-        </el-select>
-      </el-row>
-    </el-header>
-
     <el-main>
-      <el-table
-        :data="dataList"
-        border
-        style="width: 100%"
-      >
-        <el-table-column
-          fixed="left"
-          label="No"
-          type="index"
-        />
-        <el-table-column
-          prop="name"
-          label="试卷名称"
-          width="150"
-        />
-        <el-table-column
-          prop="examTime"
-          label="考试时间"
-          width="150"
-        />
-        <el-table-column
-          prop="totalScore"
-          label="考试总分"
-        />
-        <el-table-column
-          prop="userScore"
-          label="我的得分"
-        />
-        <el-table-column
-          fixed="right"
-          label="操作"
-          width="320"
-        >
-          <template slot-scope="scope">
-            <el-button
-              size="mini"
-              type="warning"
-              @click="viewExamResult(scope.$index, scope.row)"
-            >查看</el-button>
-          </template>
-        </el-table-column>
-      </el-table>
-      <el-pagination
-        background
-        :small="screenWidth <= 768"
-        layout="prev, pager, next"
-        :page-size="pageSize"
-        :current-page="currentPage"
-        :total="totalSize"
-        @current-change="handleCurrentChange"
-        @prev-click="handleCurrentChange"
-        @next-click="handleCurrentChange"
-      />
+      <span>my score</span>
     </el-main>
   </el-container>
 </template>
 
 <script>
-import {getSubjectKV, getExamScoreList} from '@/api/exam'
-
 export default {
-  name: 'ExamPaper',
+  name: 'ExamScoreIndex',
   data() {
     return {
-      // 屏幕宽度, 为了控制分页条的大小
-      screenWidth: document.body.clientWidth,
-      currentPage: 1,
-      pageSize: 20,
-      totalSize: 0,
-      dataList: [],
-      // **********************************************************************
-      queryInfo: {
-        pageNumber: 1,
-        pageSize: 10,
-        subjectId: null
-      },
-      allSubject: []
     }
   },
   created() {
     document.title = '我的成绩'
-    this.getData(this.queryInfo)
-    this.getSubjects()
+    this.getData()
   },
   methods: {
-    handleCurrentChange(pageNumber) {
-      this.currentPage = pageNumber
-      this.queryInfo.pageNumber = this.currentPage
-      this.queryInfo.pageSize = this.pageSize
-      this.getData(this.queryInfo)
-      // 回到顶部
-      scrollTo(0, 0)
-    },
-    getData(queryInfo) {
-      getExamScoreList(queryInfo).then(resp => {
-        if (resp.code === 0) {
-          this.dataList = resp.data.list
-          this.totalSize = resp.data.totalSize
-        } else {
-          this.$notify({
-            title: '提示',
-            message: resp.msg,
-            type: 'warning',
-            duration: 3000
-          })
-        }
-      }).catch(error => {
-        this.$notify({
-          title: '提示',
-          message: error.message,
-          type: 'error',
-          duration: 3000
-        })
-      })
-    },
-    getSubjects() {
-      getSubjectKV().then((resp) => {
-        if (resp.code === 0) {
-          this.allSubject = resp.data
-        }
-      })
-    },
-    // 题库变化
-    subjectChange(val) {
-      this.queryInfo.paperId = val
-      this.queryInfo.pageNumber = this.currentPage
-      this.queryInfo.pageSize = this.pageSize
-      this.getData(this.queryInfo)
-    },
-    viewExamResult(index, row) {
-      // this.$router.push('/exam/score/' + row.resultId)
-      const routeData = this.$router.resolve({ path: '/exam/score/' + row.resultId })
-      window.open(routeData.href, '_blank')
+    getData() {
+      this.$message.info('获取成绩数据')
     }
   }
 }