Pārlūkot izejas kodu

更新 科目管理 页面和接口

reghao 1 gadu atpakaļ
vecāks
revīzija
fb116f4f10
2 mainītis faili ar 30 papildinājumiem un 20 dzēšanām
  1. 5 0
      src/api/exam.js
  2. 25 20
      src/views/exam/ExamSubject.vue

+ 5 - 0
src/api/exam.js

@@ -1,6 +1,7 @@
 import { get, post } from '@/utils/request'
 
 const examApi = {
+  getExamSubject: '/api/content/exam/subject',
   postExamPaper: '/api/content/exam/paper',
   getExamQuestion: '/api/content/exam/question',
   getExamResult: '/api/content/exam/result',
@@ -9,6 +10,10 @@ const examApi = {
   getExam: '/api/content/exam'
 }
 
+export function getExamSubjects() {
+  return get(examApi.getExamSubject)
+}
+
 export function getExams(pageNumber) {
   return get(examApi.getExam)
 }

+ 25 - 20
src/views/exam/ExamSubject.vue

@@ -1,6 +1,11 @@
 <template>
-  <el-row>
-    <el-row>
+  <el-container>
+    <el-header height="220">
+      <el-row style="margin-top: 10px">
+        <el-button type="plain" icon="el-icon-plus" @click="addSubjectVisible = true">添加</el-button>
+      </el-row>
+    </el-header>
+    <el-main>
       <el-table
         :data="dataList"
         border
@@ -12,48 +17,47 @@
           type="index"
         />
         <el-table-column
-          prop="examName"
+          prop="subjectName"
           label="科目"
         />
         <el-table-column
-          prop="passScore"
+          prop="question7Count"
           label="单选题"
         />
         <el-table-column
-          prop="passScore"
+          prop="question7Count"
           label="多选题"
         />
         <el-table-column
-          prop="duration"
+          prop="question7Count"
           label="不定项选择题"
         />
         <el-table-column
-          prop="totalScore"
+          prop="question7Count"
           label="填空题"
         />
         <el-table-column
-          prop="passScore"
+          prop="question7Count"
           label="判断题"
         />
         <el-table-column
-          prop="passScore"
+          prop="question7Count"
           label="问答题"
         />
         <el-table-column
-          prop="passScore"
+          prop="question7Count"
           label="理解题"
         />
         <el-table-column
-          prop="passScore"
+          prop="paperCount"
           label="试卷"
         />
       </el-table>
-    </el-row>
-    <el-row>
       <el-pagination
-        background
+        style="margin-top: 25px"
         :small="screenWidth <= 768"
-        layout="prev, pager, next"
+        layout="total, sizes, prev, pager, next, jumper"
+        :page-sizes="[10, 20, 50]"
         :page-size="pageSize"
         :current-page="currentPage"
         :total="totalSize"
@@ -61,12 +65,12 @@
         @prev-click="handleCurrentChange"
         @next-click="handleCurrentChange"
       />
-    </el-row>
-  </el-row>
+    </el-main>
+  </el-container>
 </template>
 
 <script>
-import {getExams} from '@/api/exam'
+import { getExamSubjects } from '@/api/exam'
 
 export default {
   name: 'ExamSubject',
@@ -77,7 +81,8 @@ export default {
       currentPage: 1,
       pageSize: 20,
       totalSize: 0,
-      dataList: []
+      dataList: [],
+      addSubjectVisible: false
     }
   },
   created() {
@@ -93,7 +98,7 @@ export default {
     },
     getData() {
       this.dataList = []
-      getExams(this.currentPage).then(resp => {
+      getExamSubjects(this.currentPage).then(resp => {
         if (resp.code === 0) {
           this.dataList = resp.data.list
           this.totalSize = resp.data.totalSize