|
@@ -1,7 +1,10 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="quiz-detail">
|
|
<div class="quiz-detail">
|
|
|
<div class="info">
|
|
<div class="info">
|
|
|
- <back-title>{{ quizDetail.name }}</back-title>
|
|
|
|
|
|
|
+ <back-title>
|
|
|
|
|
+ {{ quizDetail.name }}
|
|
|
|
|
+ <c-button :left="12" text theme="red" @click="handleDelete" icon="error" no-bold>删除测试</c-button>
|
|
|
|
|
+ </back-title>
|
|
|
<div class="sub-title">学生提交结果列表</div>
|
|
<div class="sub-title">学生提交结果列表</div>
|
|
|
<template v-if="quizDetail.state === QuizState.closed || quizDetail.state === QuizState.ongoing">
|
|
<template v-if="quizDetail.state === QuizState.closed || quizDetail.state === QuizState.ongoing">
|
|
|
<answer-card @click="handleSelectAnswer(answer)" v-for="answer of result" :key="answer.studentId"
|
|
<answer-card @click="handleSelectAnswer(answer)" v-for="answer of result" :key="answer.studentId"
|
|
@@ -20,13 +23,14 @@
|
|
|
import { createDefaultQuiz } from '@/views/quiz/utils/default'
|
|
import { createDefaultQuiz } from '@/views/quiz/utils/default'
|
|
|
import BackTitle from '@/components/Basic/BackTitle'
|
|
import BackTitle from '@/components/Basic/BackTitle'
|
|
|
import { QuizState } from '@/server/enums/quiz-state'
|
|
import { QuizState } from '@/server/enums/quiz-state'
|
|
|
-import { getOneQuiz, getQuizStudentAnswers } from '@/server/quiz'
|
|
|
|
|
|
|
+import { deleteQuiz, getOneQuiz, getQuizStudentAnswers } from '@/server/quiz'
|
|
|
import QuizDetailFactory from '@/views/quiz/components/QuizDetailFactory'
|
|
import QuizDetailFactory from '@/views/quiz/components/QuizDetailFactory'
|
|
|
import AnswerCard from '@/components/Cards/AnswerCard'
|
|
import AnswerCard from '@/components/Cards/AnswerCard'
|
|
|
|
|
+import CButton from '@/components/Basic/CButton'
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: 'QuizDetail',
|
|
name: 'QuizDetail',
|
|
|
- components: { AnswerCard, QuizDetailFactory, BackTitle },
|
|
|
|
|
|
|
+ components: { CButton, AnswerCard, QuizDetailFactory, BackTitle },
|
|
|
data () {
|
|
data () {
|
|
|
return {
|
|
return {
|
|
|
quizDetail: createDefaultQuiz(),
|
|
quizDetail: createDefaultQuiz(),
|
|
@@ -59,6 +63,17 @@ export default {
|
|
|
this.showSubmitAt = answer.submitAt
|
|
this.showSubmitAt = answer.submitAt
|
|
|
this.showAnswers = answer.answers
|
|
this.showAnswers = answer.answers
|
|
|
this.showStudentName = answer.studentName
|
|
this.showStudentName = answer.studentName
|
|
|
|
|
+ },
|
|
|
|
|
+ handleDelete () {
|
|
|
|
|
+ const msg = '这个测试已公布,您确认删除整个测试吗?'
|
|
|
|
|
+ if (confirm(msg)) {
|
|
|
|
|
+ deleteQuiz({ quizId: this.quizDetail.id }).then(() => {
|
|
|
|
|
+ this.$setSuccessMessage('删除成功')
|
|
|
|
|
+ this.$router.go(-1)
|
|
|
|
|
+ }).catch(err => {
|
|
|
|
|
+ this.$setErrorMessage(err.response.data.msg)
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|