|
|
@@ -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>
|