Parcourir la source

update views/exam module

reghao il y a 7 mois
Parent
commit
7451566625

+ 1 - 2
src/views/exam/ExamPaper.vue

@@ -98,8 +98,7 @@
 </template>
 
 <script>
-import {getSubjectKV, getPapers, deletePaper} from '@/api/exam'
-import {deleteArticle} from "@/api/article";
+import { getSubjectKV, getPapers, deletePaper } from '@/api/exam'
 
 export default {
   name: 'ExamPaper',

+ 16 - 13
src/views/exam/ExamPaperAdd.vue

@@ -85,10 +85,10 @@
                   style="margin-left: 5px"
                 >
                   <el-option
-                    v-for="item in allSubject"
-                    :key="item.questionBank.bankId"
-                    :label="item.questionBank.bankName"
-                    :value="item.questionBank.bankName"
+                    v-for="item in bankList"
+                    :key="item.bankId"
+                    :label="item.bankName"
+                    :value="item.bankName"
                   />
                 </el-select>
               </template>
@@ -99,31 +99,26 @@
                 <el-input v-model="scope.row.singleScore" style="margin-left: 5px" />
               </template>
             </el-table-column>
-
             <el-table-column label="多选题分数" align="center">
               <template slot-scope="scope">
                 <el-input v-model="scope.row.multipleScore" style="margin-left: 5px" />
               </template>
             </el-table-column>
-
             <el-table-column label="判断题分数" align="center">
               <template slot-scope="scope">
                 <el-input v-model="scope.row.judgeScore" style="margin-left: 5px" />
               </template>
             </el-table-column>
-
             <el-table-column label="简答题分数" align="center">
               <template slot-scope="scope">
                 <el-input v-model="scope.row.shortScore" style="margin-left: 5px" />
               </template>
             </el-table-column>
-
             <el-table-column label="操作" width="80" align="center">
               <template slot-scope="scope">
                 <el-button type="danger" icon="el-icon-delete" circle @click="delBank(scope.row.bankId)" />
               </template>
             </el-table-column>
-
           </el-table>
         </div>
       </el-card>
@@ -349,7 +344,14 @@ export default {
         pageSize: 10
       },
       // 所有题库信息
-      allSubject: [],
+      allSubject: [
+      ],
+      bankList: [
+         {
+           bankId: 1,
+           bankName: '默认题库'
+         }
+      ],
       allType: [],
       // 当前的步骤
       curStep: 1,
@@ -484,7 +486,8 @@ export default {
     // 添加题库组卷中的题库
     addBank() {
       this.addExamQuestion2.push({
-        'bankName': '',
+        'bankId': 1,
+        'bankName': '默认题库',
         'singleScore': 1,
         'multipleScore': 1,
         'judgeScore': 1,
@@ -557,14 +560,14 @@ export default {
     },
     // 分页插件的页数
     handleCurrentChange(val) {
-      this.queryInfo.pageNo = val
+      this.queryInfo.pageNumber = val
       this.getQuestionInfo()
     },
     // 自由组卷中选中的题目添加进去
     addQuToFree() {
       this.selectedTable.forEach(item => {
         // 不存在有当前题目
-        if (!this.addExamQuestion1.some(i2 => { return i2.questionId === item.id })) {
+        if (!this.addExamQuestion1.some(i2 => { return i2.questionId === item.questionId })) {
           this.addExamQuestion1.push({
             'pos': this.addExamQuestion1.length + 1,
             'questionId': item.questionId,

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

@@ -385,6 +385,7 @@ export default {
       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
@@ -420,7 +421,6 @@ export default {
               }
             }
           }
-
           this.showPaper = true
           this.renderByMathjax()
         }
@@ -499,7 +499,7 @@ export default {
       }
 
       const userResult = {}
-      userResult.paperId = this.examInfo.examId
+      userResult.paperId = this.examInfo.paperId
       userResult.userAnswers = submitAnswers
       submitExam(userResult).then((resp) => {
         if (resp.code === 0) {
@@ -509,7 +509,6 @@ export default {
             type: 'success',
             duration: 2000
           })
-          const resultId = resp.data
           this.$router.push('/exam/score')
         }
       }).catch(error => {