|
|
@@ -1,63 +1,19 @@
|
|
|
<template>
|
|
|
<div class="tab complex-tab">
|
|
|
<div class="left">
|
|
|
- <h1 class="title">课程测验
|
|
|
- <c-tag theme="green">学生</c-tag>
|
|
|
- </h1>
|
|
|
- <div class="quiz-show-type-bar mb-16">
|
|
|
- <c-button @click="showOngoingQuizzes = true" :right="6" block :theme="showOngoingQuizzes ? 'green' : 'normal'">
|
|
|
- 正在进行
|
|
|
- </c-button>
|
|
|
- <c-button @click="showOngoingQuizzes = false" :left="6" block :theme="showOngoingQuizzes ? 'normal' : 'green'">
|
|
|
- 已结束
|
|
|
- </c-button>
|
|
|
- </div>
|
|
|
- <div v-if="showOngoingQuizzes">
|
|
|
- <div class="sub-title">
|
|
|
- 待完成的测验
|
|
|
- <c-button :theme="showMore ? 'blue' : 'normal'" :left="8" text
|
|
|
- :icon="showMore ? 'unfold_less' : 'unfold_more'"
|
|
|
- @click="showMore = !showMore">
|
|
|
- {{showMore ? '收起' : '展开'}}
|
|
|
- </c-button>
|
|
|
- </div>
|
|
|
- <div class="no-content-warning" v-if="ongoingQuizzes === null">加载中...</div>
|
|
|
- <div class="quiz-link" :key="quiz.id" v-for="quiz in ongoingQuizzes">
|
|
|
- <router-link :to="`/student/quiz/${quiz.id}`">
|
|
|
- <div class="quiz-link--title">{{ quiz.name }}</div>
|
|
|
- <show-transition-small>
|
|
|
- <div v-if="showMore" class="quiz-link--info">对应课程:{{ quiz.course && quiz.course.name }}</div>
|
|
|
- </show-transition-small>
|
|
|
- <show-transition-small>
|
|
|
- <div v-if="showMore" class="quiz-link--info">对应课件:{{ quiz.slide && quiz.slide.name }}</div>
|
|
|
- </show-transition-small>
|
|
|
- </router-link>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div v-if="!showOngoingQuizzes">
|
|
|
- <div class="sub-title">
|
|
|
- 已完成的测验
|
|
|
- <c-button :theme="showMore ? 'blue' : 'normal'" :left="8" text
|
|
|
- :icon="showMore ? 'unfold_less' : 'unfold_more'"
|
|
|
- @click="showMore = !showMore">
|
|
|
- {{showMore ? '收起' : '展开'}}
|
|
|
- </c-button>
|
|
|
- </div>
|
|
|
- <div class="no-content-warning" v-if="closedQuizzes === null">加载中...</div>
|
|
|
- <div :key="quiz.id" class="quiz-link" v-for="quiz in closedQuizzes">
|
|
|
- <router-link :to="`/student/quiz/${quiz.id}`">
|
|
|
- <div class="quiz-link--title">{{ quiz.name }}</div>
|
|
|
- <show-transition-small>
|
|
|
- <div v-if="showMore" class="quiz-link--info">对应课程:{{ quiz.course && quiz.course.name }}</div>
|
|
|
- </show-transition-small>
|
|
|
- <show-transition-small>
|
|
|
- <div v-if="showMore" class="quiz-link--info">对应课件:{{ quiz.slide && quiz.slide.name }}</div>
|
|
|
- </show-transition-small>
|
|
|
- </router-link>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <h1 class="title">课程测验 <c-tag theme="green">学生</c-tag></h1>
|
|
|
+ <div class="sub-title">待完成的测验</div>
|
|
|
+ <quiz-card
|
|
|
+ :key="quiz.id" v-for="quiz in ongoingQuizzes"
|
|
|
+ :nav-path="{ name: 'student-quiz-detail', params: { quizId: quiz.id } }"
|
|
|
+ :quiz="quiz" hide-quiz-state hide-quiz-time />
|
|
|
+ <div class="sub-title">已完成的测验 & 结果</div>
|
|
|
+ <quiz-card
|
|
|
+ :key="quiz.id" v-for="quiz in closedQuizzes"
|
|
|
+ :nav-path="{ name: 'student-quiz-detail', params: { quizId: quiz.id } }"
|
|
|
+ :quiz="quiz" hide-quiz-state hide-quiz-time />
|
|
|
</div>
|
|
|
- <router-view/>
|
|
|
+ <router-view />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -65,20 +21,17 @@
|
|
|
import { getQuizList } from '@/server/quiz'
|
|
|
import { QuizState } from '@/server/enums/quiz-state'
|
|
|
import CTag from '@/components/Basic/CTag'
|
|
|
-import CButton from '@/components/Basic/CButton'
|
|
|
-import ShowTransitionSmall from '@/animations/ShowTransitionSmall'
|
|
|
+import QuizCard from '@/components/Cards/QuizCard'
|
|
|
|
|
|
export default {
|
|
|
- components: { ShowTransitionSmall, CButton, CTag },
|
|
|
- data () {
|
|
|
+ components: { QuizCard, CTag },
|
|
|
+ data() {
|
|
|
return {
|
|
|
- ongoingQuizzes: null,
|
|
|
- closedQuizzes: null,
|
|
|
- showOngoingQuizzes: true,
|
|
|
- showMore: false
|
|
|
+ ongoingQuizzes: [],
|
|
|
+ closedQuizzes: []
|
|
|
}
|
|
|
},
|
|
|
- mounted () {
|
|
|
+ mounted() {
|
|
|
getQuizList({ state: QuizState.ongoing })
|
|
|
.then(res => (this.ongoingQuizzes = res.quizzes))
|
|
|
.catch(err => this.$setErrorMessage(err.response.data.msg))
|
|
|
@@ -92,32 +45,4 @@ export default {
|
|
|
<style lang="scss" scoped>
|
|
|
@import "~@/style/theme.scss";
|
|
|
@import "~@/views/shared/tab-common";
|
|
|
-
|
|
|
-.quiz-show-type-bar {
|
|
|
- display: flex;
|
|
|
-}
|
|
|
-.sub-title {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
-}
|
|
|
-.quiz-link {
|
|
|
- padding: 2px 8px;
|
|
|
- border: 1px solid #cadaea;
|
|
|
- border-radius: 6px;
|
|
|
- margin: 12px 0;
|
|
|
-
|
|
|
- &--title {
|
|
|
- margin: 6px 0;
|
|
|
- }
|
|
|
-
|
|
|
- &--info {
|
|
|
- font-size: 12px;
|
|
|
- line-height: 16px;
|
|
|
- color: #7a8a9a;
|
|
|
- }
|
|
|
-
|
|
|
- &:hover {
|
|
|
- background-color: $theme-background-grey;
|
|
|
- }
|
|
|
-}
|
|
|
</style>
|