Prechádzať zdrojové kódy

Merge branch 'develop'

ChenYangfan 6 rokov pred
rodič
commit
cf43226e06

+ 2 - 2
src/config/server-info.js

@@ -4,9 +4,9 @@
 
 // const host = 'http://106.14.178.184:8080/seec_helper'
 // const host = 'http://192.168.3.70:18080'
-const host = process.env.NODE_ENV === 'development' ? 'http://helper.seecoder.cn' : ''
+// const host = process.env.NODE_ENV === 'development' ? 'http://helper.seecoder.cn' : ''
 
-// const host = process.env.NODE_ENV === 'development' ? 'http://localhost:8080' : ''
+const host = process.env.NODE_ENV === 'development' ? 'http://localhost:8080' : ''
 const wsHost = process.env.NODE_ENV === 'development' ? 'ws://localhost:8080' : 'ws://' + location.host
 
 const adminUrl = host + '/api/admin'

+ 0 - 5
src/router/quiz.js

@@ -8,11 +8,6 @@ export default [{
   path: '/quiz-detail/:quizId',
   name: 'quiz-detail',
   component: () => import(/* webpackChunkName: "teacher-quiz" */ '@/views/quiz/QuizDetail.vue')
-}, {
-  meta: { roles: ['teacher'] },
-  path: '/all-quiz',
-  name: 'all-quiz',
-  component: () => import(/* webpackChunkName: "teacher-quiz" */ '@/views/quiz/TeacherCheckAllQuiz.vue')
 }, {
   meta: { roles: ['teacher'] },
   path: '/quiz-detail/:quizId/edit',

+ 5 - 0
src/router/teacher.js

@@ -29,6 +29,11 @@ export default [{
       path: '/quiz-setting/:slideId',
       name: 'teacher-quiz-setting',
       component: () => import(/* webpackChunkName: "teacher-quiz" */ '@/views/teacher/components/TeacherQuizSetting.vue')
+    }, {
+      meta: { roles: ['teacher'] },
+      path: '/all-quiz',
+      name: 'all-quiz',
+      component: () => import(/* webpackChunkName: "teacher-quiz" */ '@/views/teacher/components/TeacherCheckAllQuiz.vue')
     }]
   }, {
     // 教师创建幻灯片

+ 2 - 2
src/server/quiz.js

@@ -9,12 +9,12 @@ export function teacherGetQuizzes ({ slideId, key = '', page = 1, size = 200, so
     .then(res => res.data)
 }
 
-// todo use it!
+// 教师根据状态获取测试(实际上和学生是同样的接口))
 export function getQuizzesByState ({ state, key = '', page = 1, size = 200, sort = '' }) {
   const params = generateSearchParams({ key, page, size, sort })
   params.append('state', state)
   return axios
-    .get(useQuizServer('state'))
+    .get(useQuizServer('/state'), { params })
     .then(res => res.data)
 }
 

+ 0 - 15
src/views/quiz/TeacherCheckAllQuiz.vue

@@ -1,15 +0,0 @@
-<template>
-  <div>
-    // 在这里查看各个状态的所有测试,等待后端添加 api
-  </div>
-</template>
-
-<script>
-export default {
-  name: 'TeacherCheckAllQuiz'
-}
-</script>
-
-<style lang="scss" scoped>
-
-</style>

+ 2 - 2
src/views/quiz/components/QuizStatistic.vue

@@ -9,8 +9,8 @@
       分数分布
     </div>
     <div>
-      <la-polar fill-container v-if="statistic" :data="submitTimesValues"  :width="200" :height="200">
-        <la-pie show-label label-prop="name" :font-size="12" prop="pv"></la-pie>
+      <la-polar fill-container v-if="statistic" :data="submitTimesValues"  :width="180" :height="180">
+        <la-pie show-label show-value label-prop="name" :font-size="12" prop="pv"></la-pie>
       </la-polar>
       提交次数分布
     </div>

+ 82 - 0
src/views/teacher/components/TeacherCheckAllQuiz.vue

@@ -0,0 +1,82 @@
+<template>
+  <tab-side-component>
+    <back-title>所有测试</back-title>
+    <section>
+      <div class="sub-title">
+        正在进行中的测试
+      </div>
+      <div class="no-content-warning" v-if="ongoingQuizzes === null">加载中...</div>
+      <div class="no-content-warning" v-else-if="ongoingQuizzes.length === 0">无正在进行的测试</div>
+      <quiz-card is-teacher :key="quiz.id" v-for="quiz in ongoingQuizzes" :quiz="quiz" :nav-path="navPath(quiz)"></quiz-card>
+    </section>
+    <section>
+      <div class="sub-title mt-24">
+        未开始的测试
+      </div>
+      <div class="no-content-warning" v-if="notStartQuizzes === null">加载中...</div>
+      <div class="no-content-warning" v-else-if="notStartQuizzes.length === 0">无未开始的测试</div>
+      <quiz-card is-teacher :key="quiz.id" v-for="quiz in notStartQuizzes" :quiz="quiz" :nav-path="navPath(quiz)"></quiz-card>
+    </section>
+    <section>
+      <div class="sub-title mt-24">
+        已结束的测试
+      </div>
+      <div class="no-content-warning" v-if="closedQuizzes === null">加载中...</div>
+      <div class="no-content-warning" v-else-if="closedQuizzes.length === 0">无已结束的测试</div>
+      <quiz-card is-teacher :key="quiz.id" v-for="quiz in closedQuizzes" :quiz="quiz" :nav-path="navPath(quiz)"></quiz-card>
+    </section>
+  </tab-side-component>
+</template>
+
+<script>
+import TabSideComponent from '@/components/Layouts/TabSideComponent'
+import { QuizState } from '@/enums/quiz-state'
+import { getQuizzesByState } from '@/server/quiz'
+import QuizCard from '@/components/Cards/QuizCard'
+import BackTitle from '@/components/Basic/BackTitle'
+
+export default {
+  name: 'TeacherCheckAllQuiz',
+  components: { BackTitle, QuizCard, TabSideComponent },
+  data () {
+    return {
+      ongoingQuizzes: null,
+      notStartQuizzes: null,
+      closedQuizzes: null
+    }
+  },
+  created () {
+    this.getQuizzes()
+  },
+  methods: {
+    getQuizzes () {
+      getQuizzesByState({ state: QuizState.ongoing })
+        .then(res => (this.ongoingQuizzes = res.data))
+        .catch(err => this.$setErrorMessage(err.response.data.msg))
+
+      getQuizzesByState({ state: QuizState.notStart })
+        .then(res => (this.notStartQuizzes = res.data))
+        .catch(err => this.$setErrorMessage(err.response.data.msg))
+
+      getQuizzesByState({ state: QuizState.closed })
+        .then(res => (this.closedQuizzes = res.data))
+        .catch(err => this.$setErrorMessage(err.response.data.msg))
+    },
+    navPath (quiz) {
+      if (quiz.state === QuizState.notStart) {
+        return { name: 'edit-quiz', params: { quizId: quiz.id } }
+      } else {
+        return { name: 'quiz-detail', params: { quizId: quiz.id } }
+      }
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.no-content-warning {
+  margin: 24px 0;
+  padding: 0;
+  height: 100%;
+}
+</style>

+ 7 - 6
src/views/teacher/components/TeacherCourseDetail.vue

@@ -15,16 +15,18 @@
         <notice-card can-edit :notice="notice" :key="'notice-' + notice.id"></notice-card>
       </template>
     </template>
-    <c-button icon="list" theme="blue" block class="mt-24 mb-8" @click="handleCheckSlideList">课件列表</c-button>
+    <div class="vertical-center">
+      <c-button icon="list" theme="blue" block @click="handleCheckSlideList">课件列表</c-button>
+      <router-link :to="{ name: 'teacher-edit-notice', params: { noticeId: 0, courseId: course.id } }">
+        <c-button theme="green" :left="12" icon="add">新建课程公告</c-button>
+      </router-link>
+    </div>
     <div class="sub-title mt-24">修改选课码:</div>
     <div class="change-wrapper mb-24">
       <c-input placeholder="修改不会影响已选学生" v-model="newCode"/>
       <c-button text theme="green" icon="check">确认</c-button>
     </div>
-    <router-link :to="{ name: 'teacher-edit-notice', params: { noticeId: 0, courseId: course.id } }">
-      <c-button theme="green" block class="mb-12" icon="add">新建课程公告</c-button>
-    </router-link>
-    <c-button icon="delete" theme="red" block @click="handleDeleteCourse">删除课程</c-button>
+    <c-button icon="delete" class="mt-32" theme="red" block @click="handleDeleteCourse">删除课程</c-button>
   </tab-side-component>
 </template>
 
@@ -94,7 +96,6 @@ export default {
 .c-input {
   margin-bottom: 24px;
 }
-
 .change-wrapper {
   display: flex;
   align-items: center;

+ 1 - 1
src/views/teacher/tabs/TeacherCoursesManager.vue

@@ -44,7 +44,7 @@ export default {
   data () {
     return {
       courses: null,
-      showActions: false,
+      showActions: true,
       showMore: false
     }
   },

+ 1 - 1
src/views/teacher/tabs/TeacherExplore.vue

@@ -14,7 +14,7 @@
       </tab-actions>
       <!--      <search-bar></search-bar>-->
       <section class="mb-24">
-        <h1 class="sub-title">我的测试</h1>
+        <h1 class="sub-title">课堂测试</h1>
         <router-link :to="{ name: 'all-quiz'}">
           <c-button theme="green" icon="edit">所有测试</c-button>
         </router-link>