|
|
@@ -1,24 +1,82 @@
|
|
|
<template>
|
|
|
<v-container>
|
|
|
+ <page-header title="评测设置" :breadcrumb="breadcrumb"></page-header>
|
|
|
<v-container>
|
|
|
<v-card class="px-3 mb-5" v-if="examInfo">
|
|
|
- <v-card-title>评测「{{ examInfo.examName }}」创建成功</v-card-title>
|
|
|
- <v-card-subtitle>评测ID: {{ examInfo.examId }}</v-card-subtitle>
|
|
|
- <v-row no-gutters align-content="start">
|
|
|
- <v-col>
|
|
|
- <v-card-text class="pa-0 pb-3"
|
|
|
- >评测邀请码:{{ examInfo.inviteCode }}</v-card-text
|
|
|
- >
|
|
|
- </v-col>
|
|
|
- <v-col>
|
|
|
- <v-card-text class="pa-0 pb-5"
|
|
|
- >当前难度值:{{ examInfo.difficulty }}</v-card-text
|
|
|
- >
|
|
|
- </v-col>
|
|
|
- </v-row>
|
|
|
+ <v-card-title v-if="isSampleSet"
|
|
|
+ >评测「{{ examInfo.examName }}」</v-card-title
|
|
|
+ >
|
|
|
+ <v-card-title v-else
|
|
|
+ >评测「{{ examInfo.examName }}」创建成功 请选择样卷</v-card-title
|
|
|
+ >
|
|
|
+ <v-card-subtitle>评测ID: {{ examInfo.examId }} </v-card-subtitle>
|
|
|
+ <v-card-text>
|
|
|
+ <v-row no-gutters align-content="start">
|
|
|
+ <v-col>
|
|
|
+ <v-card-text class="pa-0 pb-3"
|
|
|
+ >评测邀请码:{{ examInfo.inviteCode }}</v-card-text
|
|
|
+ >
|
|
|
+ </v-col>
|
|
|
+ <v-col>
|
|
|
+ <v-card-text class="pa-0 pb-5"
|
|
|
+ >当前难度值:{{ examInfo.difficulty }}</v-card-text
|
|
|
+ >
|
|
|
+ </v-col>
|
|
|
+ </v-row>
|
|
|
+ <v-row no-gutters align-content="start">
|
|
|
+ <v-col>
|
|
|
+ <v-card-text class="pa-0 pb-3"
|
|
|
+ >开始时间:{{ examInfo.startTime }}</v-card-text
|
|
|
+ >
|
|
|
+ </v-col>
|
|
|
+ <v-col>
|
|
|
+ <v-card-text class="pa-0 pb-5"
|
|
|
+ >结束时间:{{ examInfo.endTime }}</v-card-text
|
|
|
+ >
|
|
|
+ </v-col>
|
|
|
+ </v-row>
|
|
|
+ </v-card-text>
|
|
|
</v-card>
|
|
|
- <v-container class="grey lighten-5 pa-6">
|
|
|
- <v-card-title>样卷</v-card-title>
|
|
|
+ <v-container class="grey lighten-5 pa-6 d-flex flex-column">
|
|
|
+ <div class="text-center display-1">样卷选择</div>
|
|
|
+ <v-tabs v-model="tab" v-if="examSamples[0]">
|
|
|
+ <v-tab v-for="i in examSamples.length" :key="i"> 样卷 {{ i }} </v-tab>
|
|
|
+ </v-tabs>
|
|
|
+ <v-tabs-items v-model="tab">
|
|
|
+ <v-tab-item v-for="sample in examSamples" :key="sample.id">
|
|
|
+ <div v-if="!fetching" style="min-height: 50vh">
|
|
|
+ <!-- <v-list-item-->
|
|
|
+ <!-- v-for="q in Object.entries(sample.questionAndScore)"-->
|
|
|
+ <!-- :key="q[0]"-->
|
|
|
+ <!-- >-->
|
|
|
+ <!-- 题目ID: {{ q[0] }} 分值: {{ q[1] }}-->
|
|
|
+ <!-- </v-list-item>-->
|
|
|
+ <v-row
|
|
|
+ v-for="question in sampleQuestions[tab]"
|
|
|
+ :key="question.id"
|
|
|
+ class="d-flex"
|
|
|
+ >
|
|
|
+ <v-col class="flex-grow-0 flex-shrink-0" cols="10">
|
|
|
+ <markdown-text
|
|
|
+ :raw="question.stem"
|
|
|
+ style="height: 100%;width: 100%"
|
|
|
+ ></markdown-text>
|
|
|
+ </v-col>
|
|
|
+ <v-col class="flex-shrink-1">
|
|
|
+ <v-card-text> 知识点: {{ question.keyPoints }} </v-card-text>
|
|
|
+ </v-col>
|
|
|
+ </v-row>
|
|
|
+ </div>
|
|
|
+ <v-row class="d-flex justify-center my-3">
|
|
|
+ <v-btn
|
|
|
+ class="primary align-self-center my-2 text-center"
|
|
|
+ @click="onSelectSample(sample.id)"
|
|
|
+ >
|
|
|
+ 选择
|
|
|
+ </v-btn>
|
|
|
+ </v-row>
|
|
|
+ </v-tab-item>
|
|
|
+ </v-tabs-items>
|
|
|
</v-container>
|
|
|
</v-container>
|
|
|
</v-container>
|
|
|
@@ -26,21 +84,112 @@
|
|
|
|
|
|
<script lang="ts">
|
|
|
import Vue from 'vue'
|
|
|
-import { ExamSerializer } from '@/api/types'
|
|
|
-import { getExamById } from '@/api/exam'
|
|
|
+import {
|
|
|
+ ExamSerializer,
|
|
|
+ ExtendedQuestionSerializer,
|
|
|
+ ID,
|
|
|
+ ReceivedData,
|
|
|
+ SampleSerializer
|
|
|
+} from '@/api/types'
|
|
|
+import {
|
|
|
+ getExamById,
|
|
|
+ getExamQuestions,
|
|
|
+ setExamPaperFromSample
|
|
|
+} from '@/api/exam'
|
|
|
+import { getQuestionInfo, getSamplePaper } from '@/api/question'
|
|
|
+import { AxiosResponse } from 'axios'
|
|
|
+import MarkdownText from '@/views/exam/components/MarkdownText.vue'
|
|
|
+import PageHeader from '@/components/PageHeader.vue'
|
|
|
|
|
|
export default Vue.extend({
|
|
|
name: 'EditExam',
|
|
|
+ components: {
|
|
|
+ MarkdownText,
|
|
|
+ PageHeader
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
- examInfo: (null as unknown) as ExamSerializer
|
|
|
+ examInfo: (null as unknown) as ExamSerializer,
|
|
|
+ tab: 0,
|
|
|
+ examSamples: [] as Array<SampleSerializer>,
|
|
|
+ sampleQuestions: [] as Array<Array<ExtendedQuestionSerializer>>,
|
|
|
+ fetching: false,
|
|
|
+ isSampleSet: false,
|
|
|
+ breadcrumb: [
|
|
|
+ {
|
|
|
+ text: '主页',
|
|
|
+ disabled: false,
|
|
|
+ href: '/teacher'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ text: '评测列表',
|
|
|
+ disabled: false,
|
|
|
+ href: '/teacher/created-exams'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ text: '评测设置',
|
|
|
+ disabled: true,
|
|
|
+ href: '/'
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ tab(val) {
|
|
|
+ this.fetchQuestionInfo(val)
|
|
|
}
|
|
|
},
|
|
|
+ methods: {
|
|
|
+ fetchQuestionInfo(val: number) {
|
|
|
+ if (this.sampleQuestions[val]) {
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ this.fetching = true
|
|
|
+
|
|
|
+ let questionsPromises: Promise<
|
|
|
+ AxiosResponse<ReceivedData<ExtendedQuestionSerializer, 0>>
|
|
|
+ >[] = []
|
|
|
+ let questionsIds = Object.entries(
|
|
|
+ this.examSamples[val].questionAndScore
|
|
|
+ )
|
|
|
+
|
|
|
+ questionsPromises = questionsIds.map((val) => {
|
|
|
+ return getQuestionInfo(val[0])
|
|
|
+ })
|
|
|
+
|
|
|
+ Promise.all(questionsPromises).then((reps) => {
|
|
|
+ this.sampleQuestions[val] = reps.map((value) => {
|
|
|
+ return value.data.result
|
|
|
+ })
|
|
|
+ this.fetching = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onSelectSample(sampleId: ID) {
|
|
|
+ setExamPaperFromSample(this.examInfo.examId ?? '', sampleId)
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
mounted() {
|
|
|
const examId = this.$route.params.examId
|
|
|
+
|
|
|
getExamById(examId).then(({ data }) => {
|
|
|
this.examInfo = data.result
|
|
|
})
|
|
|
+
|
|
|
+ getExamQuestions(examId ?? '')
|
|
|
+ .then(({ data }) => {
|
|
|
+ this.isSampleSet = true
|
|
|
+ })
|
|
|
+ .catch(({ data }) => {})
|
|
|
+
|
|
|
+ getSamplePaper().then(({ data }) => {
|
|
|
+ this.examSamples = data.result
|
|
|
+ // let tmp = clone(data.result[0])
|
|
|
+ // tmp.id = 2
|
|
|
+ // this.examSamples.push(tmp)
|
|
|
+ this.fetchQuestionInfo(0)
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
</script>
|