|
|
@@ -1,159 +1,161 @@
|
|
|
<template>
|
|
|
- <v-card class="d-flex flex-column questionCard pa-0">
|
|
|
- <!-- <div class="my-1 d-flex flex-grow-1 pa-1">-->
|
|
|
- <!-- <div class="flex-grow-1 d-flex flex-column justify-space-between">-->
|
|
|
- <!-- <div>-->
|
|
|
- <!-- <v-tabs v-model="tab" class="pa-0 ma-0 elevation-1" grow>-->
|
|
|
- <!-- <v-tab>题目描述</v-tab>-->
|
|
|
- <!-- <v-tab>提交记录</v-tab>-->
|
|
|
- <!-- </v-tabs>-->
|
|
|
- <!-- <v-tabs-items v-model="tab">-->
|
|
|
- <!-- <v-tab-item>-->
|
|
|
- <!-- <div class="overflow-y-auto" style="height: 80vh;max-width: 30vw">-->
|
|
|
- <!-- <markdown-text-->
|
|
|
- <!-- :raw="question.stem"-->
|
|
|
- <!-- style="height: 100%"-->
|
|
|
- <!-- ></markdown-text>-->
|
|
|
- <!-- </div>-->
|
|
|
- <!-- </v-tab-item>-->
|
|
|
- <!-- <v-tab-item>-->
|
|
|
- <!-- <div class="d-flex flex-column justify-space-between pa-2">-->
|
|
|
- <!-- <v-card-->
|
|
|
- <!-- flat-->
|
|
|
- <!-- class="d-flex flex-column justify-space-between mb-5"-->
|
|
|
- <!-- >-->
|
|
|
- <!-- <div class="d-inline mb-2">-->
|
|
|
- <!-- 执行结果:-->
|
|
|
- <!-- <v-chip-->
|
|
|
- <!-- :color="statusToColor(currentCommit.status)"-->
|
|
|
- <!-- outlined-->
|
|
|
- <!-- >{{ currentCommit.status }}</v-chip-->
|
|
|
- <!-- >-->
|
|
|
- <!-- </div>-->
|
|
|
- <!-- <v-card-text-->
|
|
|
- <!-- style="background-color: darkgray; height: 30vh"-->
|
|
|
- <!-- class="rounded ma-0 mb-5 overflow-y-auto pa-2"-->
|
|
|
- <!-- v-if="-->
|
|
|
- <!-- currentCommit && currentCommit.status === '编译或运行失败'-->
|
|
|
- <!-- "-->
|
|
|
- <!-- >-->
|
|
|
- <!-- TODO-->
|
|
|
- <!-- </v-card-text>-->
|
|
|
- <!-- </v-card>-->
|
|
|
- <!-- <!– <v-simple-table fixed-header height="40vh" class="flex-grow-1">–>-->
|
|
|
- <!-- <v-simple-table-->
|
|
|
- <!-- fixed-header-->
|
|
|
- <!-- :height="-->
|
|
|
- <!-- currentCommit && currentCommit.status === '编译或运行失败'-->
|
|
|
- <!-- ? 35 + 'vh'-->
|
|
|
- <!-- : 70 + 'vh'-->
|
|
|
- <!-- "-->
|
|
|
- <!-- >-->
|
|
|
- <!-- <thead>-->
|
|
|
- <!-- <tr>-->
|
|
|
- <!-- <th>提交时间</th>-->
|
|
|
- <!-- <th>状态</th>-->
|
|
|
- <!-- <th>成绩</th>-->
|
|
|
- <!-- <th>操作</th>-->
|
|
|
- <!-- </tr>-->
|
|
|
- <!-- </thead>-->
|
|
|
- <!-- <tbody>-->
|
|
|
- <!-- <tr v-for="item in commits" :key="item.id">-->
|
|
|
- <!-- <td>{{ item.submitTime }}</td>-->
|
|
|
- <!-- <td>-->
|
|
|
- <!-- <v-chip-->
|
|
|
- <!-- :color="statusToColor(item.status)"-->
|
|
|
- <!-- small-->
|
|
|
- <!-- outlined-->
|
|
|
- <!-- >-->
|
|
|
- <!-- {{ item.status }}-->
|
|
|
- <!-- </v-chip>-->
|
|
|
- <!-- </td>-->
|
|
|
- <!-- <td>{{ item.score }}</td>-->
|
|
|
- <!-- <td>-->
|
|
|
- <!-- <v-btn small>详情</v-btn>-->
|
|
|
- <!-- </td>-->
|
|
|
- <!-- </tr>-->
|
|
|
- <!-- </tbody>-->
|
|
|
- <!-- </v-simple-table>-->
|
|
|
- <!-- </div>-->
|
|
|
- <!-- </v-tab-item>-->
|
|
|
- <!-- </v-tabs-items>-->
|
|
|
- <!-- </div>-->
|
|
|
-
|
|
|
- <!-- <div style="height: 32px" class="d-flex justify-space-between">-->
|
|
|
- <!-- <span>-->
|
|
|
- <!-- <slot name="index"></slot>-->
|
|
|
- <!-- <v-card-title> 代码题</v-card-title>-->
|
|
|
- <!-- </span>-->
|
|
|
- <!-- <v-btn color="info" small @click="nextQuestion">下一题</v-btn>-->
|
|
|
- <!-- </div>-->
|
|
|
- <!-- </div>-->
|
|
|
- <!-- <v-divider vertical class="mx-1"></v-divider>-->
|
|
|
- <!-- <div style="width: 50vw; height: 100%" class="d-flex flex-column">-->
|
|
|
- <!-- <div-->
|
|
|
- <!-- style="height: 48px"-->
|
|
|
- <!-- class="d-flex pr-5 justify-space-between elevation-1 mb-1"-->
|
|
|
- <!-- >-->
|
|
|
- <!-- <div class="d-flex ml-5">-->
|
|
|
- <!-- <div class="d-flex">-->
|
|
|
- <!-- <v-select-->
|
|
|
- <!-- :items="languages"-->
|
|
|
- <!-- v-model="currentLang"-->
|
|
|
- <!-- dense-->
|
|
|
- <!-- style="width: 120px"-->
|
|
|
- <!-- class=" ma-0 pa-0"-->
|
|
|
- <!-- solo-->
|
|
|
- <!-- >-->
|
|
|
- <!-- </v-select>-->
|
|
|
- <!-- </div>-->
|
|
|
- <!-- <v-tooltip top>-->
|
|
|
- <!-- <template v-slot:activator="{ on, attrs }">-->
|
|
|
- <!-- <v-btn-->
|
|
|
- <!-- fab-->
|
|
|
- <!-- x-small-->
|
|
|
- <!-- tile-->
|
|
|
- <!-- class="mx-2 mb-2 pa-0 elevation-1 align-self-center"-->
|
|
|
- <!-- v-bind="attrs"-->
|
|
|
- <!-- v-on="on"-->
|
|
|
- <!-- @click="resetLastCommit"-->
|
|
|
- <!-- >-->
|
|
|
- <!-- <v-icon>mdi-arrow-left</v-icon>-->
|
|
|
- <!-- </v-btn>-->
|
|
|
- <!-- </template>-->
|
|
|
- <!-- <span>恢复到上次提交的代码</span>-->
|
|
|
- <!-- </v-tooltip>-->
|
|
|
- <!-- <v-tooltip top>-->
|
|
|
- <!-- <template v-slot:activator="{ on, attrs }">-->
|
|
|
- <!-- <v-btn-->
|
|
|
- <!-- fab-->
|
|
|
- <!-- x-small-->
|
|
|
- <!-- tile-->
|
|
|
- <!-- class="mx-2 mb-2 pa-0 elevation-1 align-self-center"-->
|
|
|
- <!-- v-bind="attrs"-->
|
|
|
- <!-- v-on="on"-->
|
|
|
- <!-- @click="resetOriginCode"-->
|
|
|
- <!-- >-->
|
|
|
- <!-- <v-icon>mdi-refresh</v-icon>-->
|
|
|
- <!-- </v-btn>-->
|
|
|
- <!-- </template>-->
|
|
|
- <!-- <span>重置代码至初始状态</span>-->
|
|
|
- <!-- </v-tooltip>-->
|
|
|
- <!-- </div>-->
|
|
|
- <!-- <v-btn-->
|
|
|
- <!-- color="primary"-->
|
|
|
- <!-- class="mx-2 mb-2 align-self-center"-->
|
|
|
- <!-- small-->
|
|
|
- <!-- v-on:click="submitCode"-->
|
|
|
- <!-- >保存测试</v-btn-->
|
|
|
- <!-- >-->
|
|
|
- <!-- </div>-->
|
|
|
- <!-- <code-editor-->
|
|
|
- <!-- :language="currentLang"-->
|
|
|
- <!-- v-model="currentCode"-->
|
|
|
- <!-- ></code-editor>-->
|
|
|
- <!-- </div>-->
|
|
|
- <!-- </div>-->
|
|
|
+ <v-card class="d-flex flex-column code-question pa-0">
|
|
|
+ <div class="my-1 d-flex flex-grow-1 pa-1">
|
|
|
+ <div class="flex-grow-1 d-flex flex-column justify-space-between">
|
|
|
+ <div>
|
|
|
+ <v-tabs v-model="tab" class="pa-0 ma-0 elevation-1" grow>
|
|
|
+ <v-tab>题目描述</v-tab>
|
|
|
+ <v-tab>提交记录</v-tab>
|
|
|
+ </v-tabs>
|
|
|
+ <v-tabs-items v-model="tab">
|
|
|
+ <v-tab-item>
|
|
|
+ <div
|
|
|
+ class="overflow-y-auto px-2"
|
|
|
+ style="height: 85vh;max-width: 30vw"
|
|
|
+ >
|
|
|
+ <markdown-text
|
|
|
+ :raw="question.stem"
|
|
|
+ style="height: 100%;margin-top:0"
|
|
|
+ ></markdown-text>
|
|
|
+ </div>
|
|
|
+ </v-tab-item>
|
|
|
+ <!-- <v-tab-item>-->
|
|
|
+ <!-- <div class="d-flex flex-column justify-space-between pa-2">-->
|
|
|
+ <!-- <v-card-->
|
|
|
+ <!-- flat-->
|
|
|
+ <!-- class="d-flex flex-column justify-space-between mb-5"-->
|
|
|
+ <!-- >-->
|
|
|
+ <!-- <div class="d-inline mb-2">-->
|
|
|
+ <!-- 执行结果:-->
|
|
|
+ <!-- <v-chip-->
|
|
|
+ <!-- :color="statusToColor(currentCommit.status)"-->
|
|
|
+ <!-- outlined-->
|
|
|
+ <!-- >{{ currentCommit.status }}</v-chip-->
|
|
|
+ <!-- >-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- <v-card-text-->
|
|
|
+ <!-- style="background-color: darkgray; height: 30vh"-->
|
|
|
+ <!-- class="rounded ma-0 mb-5 overflow-y-auto pa-2"-->
|
|
|
+ <!-- v-if="-->
|
|
|
+ <!-- currentCommit && currentCommit.status === '编译或运行失败'-->
|
|
|
+ <!-- "-->
|
|
|
+ <!-- >-->
|
|
|
+ <!-- TODO-->
|
|
|
+ <!-- </v-card-text>-->
|
|
|
+ <!-- </v-card>-->
|
|
|
+ <!-- <v-simple-table-->
|
|
|
+ <!-- fixed-header-->
|
|
|
+ <!-- :height="-->
|
|
|
+ <!-- currentCommit && currentCommit.status === '编译或运行失败'-->
|
|
|
+ <!-- ? 35 + 'vh'-->
|
|
|
+ <!-- : 70 + 'vh'-->
|
|
|
+ <!-- "-->
|
|
|
+ <!-- >-->
|
|
|
+ <!-- <thead>-->
|
|
|
+ <!-- <tr>-->
|
|
|
+ <!-- <th>提交时间</th>-->
|
|
|
+ <!-- <th>状态</th>-->
|
|
|
+ <!-- <th>成绩</th>-->
|
|
|
+ <!-- <th>操作</th>-->
|
|
|
+ <!-- </tr>-->
|
|
|
+ <!-- </thead>-->
|
|
|
+ <!-- <tbody>-->
|
|
|
+ <!-- <tr v-for="item in commits" :key="item.id">-->
|
|
|
+ <!-- <td>{{ item.submitTime }}</td>-->
|
|
|
+ <!-- <td>-->
|
|
|
+ <!-- <v-chip-->
|
|
|
+ <!-- :color="statusToColor(item.status)"-->
|
|
|
+ <!-- small-->
|
|
|
+ <!-- outlined-->
|
|
|
+ <!-- >-->
|
|
|
+ <!-- {{ item.status }}-->
|
|
|
+ <!-- </v-chip>-->
|
|
|
+ <!-- </td>-->
|
|
|
+ <!-- <td>{{ item.score }}</td>-->
|
|
|
+ <!-- <td>-->
|
|
|
+ <!-- <v-btn small>详情</v-btn>-->
|
|
|
+ <!-- </td>-->
|
|
|
+ <!-- </tr>-->
|
|
|
+ <!-- </tbody>-->
|
|
|
+ <!-- </v-simple-table>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- </v-tab-item>-->
|
|
|
+ </v-tabs-items>
|
|
|
+ </div>
|
|
|
+ <div style="height: 32px" class="d-flex justify-space-between px-2">
|
|
|
+ <span>
|
|
|
+ <span class="mx-2"> 代码题</span>
|
|
|
+ <slot name="index"></slot>
|
|
|
+ </span>
|
|
|
+ <v-btn color="info" small @click="prevQuestion">上一题</v-btn>
|
|
|
+ <v-btn color="info" small @click="nextQuestion">下一题</v-btn>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <v-divider vertical class="mx-1"></v-divider>
|
|
|
+ <div style="width: 50vw; height: 100%" class="d-flex flex-column">
|
|
|
+ <div
|
|
|
+ style="height: 48px"
|
|
|
+ class="d-flex pr-5 justify-space-between elevation-1 mb-1"
|
|
|
+ >
|
|
|
+ <div class="d-flex ml-5 mt-1">
|
|
|
+ <div class="d-flex">
|
|
|
+ <v-select
|
|
|
+ :items="languages"
|
|
|
+ v-model="currentLang"
|
|
|
+ dense
|
|
|
+ style="width: 120px"
|
|
|
+ class="ma-0 pa-0"
|
|
|
+ solo
|
|
|
+ >
|
|
|
+ </v-select>
|
|
|
+ </div>
|
|
|
+ <v-tooltip top>
|
|
|
+ <template v-slot:activator="{ on, attrs }">
|
|
|
+ <v-btn
|
|
|
+ fab
|
|
|
+ x-small
|
|
|
+ tile
|
|
|
+ class="mx-2 mb-2 pa-0 elevation-1 align-self-center"
|
|
|
+ v-bind="attrs"
|
|
|
+ v-on="on"
|
|
|
+ @click="resetLastCommit"
|
|
|
+ >
|
|
|
+ <v-icon>mdi-arrow-left</v-icon>
|
|
|
+ </v-btn>
|
|
|
+ </template>
|
|
|
+ <span>恢复到上次提交的代码</span>
|
|
|
+ </v-tooltip>
|
|
|
+ <v-tooltip top>
|
|
|
+ <template v-slot:activator="{ on, attrs }">
|
|
|
+ <v-btn
|
|
|
+ fab
|
|
|
+ x-small
|
|
|
+ tile
|
|
|
+ class="mx-2 mb-2 pa-0 elevation-1 align-self-center"
|
|
|
+ v-bind="attrs"
|
|
|
+ v-on="on"
|
|
|
+ @click="resetOriginCode"
|
|
|
+ >
|
|
|
+ <v-icon>mdi-refresh</v-icon>
|
|
|
+ </v-btn>
|
|
|
+ </template>
|
|
|
+ <span>重置代码至初始状态</span>
|
|
|
+ </v-tooltip>
|
|
|
+ </div>
|
|
|
+ <v-btn
|
|
|
+ color="primary"
|
|
|
+ class="mx-2 mb-2 align-self-center"
|
|
|
+ small
|
|
|
+ v-on:click="submitCode"
|
|
|
+ >保存测试</v-btn
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ <code-editor
|
|
|
+ :language="currentLang"
|
|
|
+ v-model="currentCode"
|
|
|
+ ></code-editor>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</v-card>
|
|
|
</template>
|
|
|
|
|
|
@@ -162,7 +164,12 @@ import Vue, { PropType } from 'vue'
|
|
|
import CodeEditor from '@/views/exam/components/CodeEditor.vue'
|
|
|
import MarkdownText from '@/views/exam/components/MarkdownText.vue'
|
|
|
import { clone } from 'ramda'
|
|
|
-import { CodeTuple } from '@/api/types'
|
|
|
+import {
|
|
|
+ CodeQuestionSerializer,
|
|
|
+ CodeSubmitSerializer,
|
|
|
+ CodeTuple
|
|
|
+} from '@/api/types'
|
|
|
+import { codeJudge } from '@/api/judge'
|
|
|
|
|
|
interface CommitInfo {
|
|
|
id?: string
|
|
|
@@ -174,120 +181,123 @@ interface CommitInfo {
|
|
|
}
|
|
|
|
|
|
export default Vue.extend({
|
|
|
- name: 'CodePane'
|
|
|
- // components: {
|
|
|
- // CodeEditor,
|
|
|
- // MarkdownText
|
|
|
- // },
|
|
|
- // props: {
|
|
|
- // question: {
|
|
|
- // required: true,
|
|
|
- // type: Object as PropType<CodeQuestionSerializer>
|
|
|
- // },
|
|
|
- // totalQuestionNum: {
|
|
|
- // required: true,
|
|
|
- // type: Number
|
|
|
- // }
|
|
|
- // },
|
|
|
- // data() {
|
|
|
- // return {
|
|
|
- // tab: 0,
|
|
|
- // commits: [] as CommitInfo[],
|
|
|
- // languages: ['cpp', 'java', 'python'],
|
|
|
- // currentLang: '',
|
|
|
- // currentCode: '',
|
|
|
- // codeCache: [] as CodeTuple[], // 切换语言时,将当前编辑的保存到cache中,下次切换回来可继续编辑
|
|
|
- // currentCommit: (null as unknown) as CommitInfo,
|
|
|
- // statusTags: [
|
|
|
- // '所有用例通过',
|
|
|
- // '有用例未通过',
|
|
|
- // '编译或运行失败',
|
|
|
- // '运行超时',
|
|
|
- // '等待运行'
|
|
|
- // ],
|
|
|
- // statusColors: ['success', 'warning', 'error', 'accent', 'info']
|
|
|
- // }
|
|
|
- // },
|
|
|
- // watch: {
|
|
|
- // currentLang(val, oldVal) {
|
|
|
- // if (oldVal !== '' && val !== oldVal) {
|
|
|
- // const newCode =
|
|
|
- // this.codeCache.find((value) => {
|
|
|
- // return value.lang === val
|
|
|
- // })?.code ?? ''
|
|
|
- //
|
|
|
- // const oldCodeTuple =
|
|
|
- // this.codeCache.find((value) => {
|
|
|
- // return value.lang === oldVal
|
|
|
- // }) ?? {}
|
|
|
- //
|
|
|
- // oldCodeTuple.code = this.currentCode
|
|
|
- // this.currentCode = newCode
|
|
|
- // }
|
|
|
- // }
|
|
|
- // },
|
|
|
- // created() {
|
|
|
- // this.languages =
|
|
|
- // this.question?.codeTuples?.map((value) => {
|
|
|
- // return value.lang ?? ''
|
|
|
- // }) ?? []
|
|
|
- // this.currentLang = this.languages[0]
|
|
|
- //
|
|
|
- // this.currentCode =
|
|
|
- // this.question?.codeTuples?.find((value, index) => {
|
|
|
- // return index === 0
|
|
|
- // })?.code ?? ''
|
|
|
- //
|
|
|
- // this.codeCache = clone(this.question.codeTuples) ?? []
|
|
|
- //
|
|
|
- // for (let i = 0; i < 10; i++) {
|
|
|
- // const r = Math.floor(Math.random() * 4 + 1)
|
|
|
- // this.commits.push({
|
|
|
- // id: i.toString(),
|
|
|
- // submitTime: '2020-12-11 20:02',
|
|
|
- // status: this.statusTags[r],
|
|
|
- // score: 6 * i
|
|
|
- // })
|
|
|
- // }
|
|
|
- // this.currentCommit = this.getCurrentCommit()
|
|
|
- // },
|
|
|
- // methods: {
|
|
|
- // submitCode(): void {
|
|
|
- // this.tab = 1
|
|
|
- // this.$emit('submitCode', this.currentCode, this.currentLang)
|
|
|
- // },
|
|
|
- // getCurrentCommit(): CommitInfo {
|
|
|
- // return this.commits[0]
|
|
|
- // },
|
|
|
- // statusToColor(status: string): string {
|
|
|
- // return this.statusColors[this.statusTags.indexOf(status)]
|
|
|
- // },
|
|
|
- // resetLastCommit() {
|
|
|
- // const lastCommitCodes = this.question.lastCommitCodes
|
|
|
- // const lastCommitTuple = lastCommitCodes?.find((val) => {
|
|
|
- // return val.lang === this.currentLang
|
|
|
- // })
|
|
|
- //
|
|
|
- // this.currentCode = lastCommitTuple?.code ?? ''
|
|
|
- // },
|
|
|
- // resetOriginCode() {
|
|
|
- // const originCodes = this.question.codeTuples ?? []
|
|
|
- // const originTuple =
|
|
|
- // originCodes.find((val) => {
|
|
|
- // return val.lang === this.currentLang
|
|
|
- // }) ?? {}
|
|
|
- // this.currentCode = originTuple.code ?? ''
|
|
|
- // },
|
|
|
- // nextQuestion() {
|
|
|
- // this.$emit('nextQuestion')
|
|
|
- // }
|
|
|
- // }
|
|
|
+ name: 'CodePane',
|
|
|
+ components: {
|
|
|
+ CodeEditor,
|
|
|
+ MarkdownText
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ question: {
|
|
|
+ required: true,
|
|
|
+ type: Object as PropType<CodeQuestionSerializer>
|
|
|
+ },
|
|
|
+ totalQuestionNum: {
|
|
|
+ required: true,
|
|
|
+ type: Number
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ tab: 0,
|
|
|
+ commits: [] as CommitInfo[],
|
|
|
+ languages: ['cpp', 'java', 'python'],
|
|
|
+ currentLang: '',
|
|
|
+ currentCode: '',
|
|
|
+ codeCache: [] as CodeTuple[], // 切换语言时,将当前编辑的保存到cache中,下次切换回来可继续编辑
|
|
|
+ // currentCommit: (null as unknown) as CommitInfo,
|
|
|
+ statusTags: [
|
|
|
+ '所有用例通过',
|
|
|
+ '有用例未通过',
|
|
|
+ '编译或运行失败',
|
|
|
+ '运行超时',
|
|
|
+ '等待运行'
|
|
|
+ ],
|
|
|
+ statusColors: ['success', 'warning', 'error', 'accent', 'info']
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ currentLang(val, oldVal) {
|
|
|
+ if (oldVal !== '' && val !== oldVal) {
|
|
|
+ const newCode =
|
|
|
+ this.codeCache.find((value) => {
|
|
|
+ return value.lang === val
|
|
|
+ })?.code ?? ''
|
|
|
+
|
|
|
+ this.codeCache.forEach((val) => {
|
|
|
+ if (val.lang === oldVal) {
|
|
|
+ val.code = this.currentCode
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ this.currentCode = newCode
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.currentLang = this.languages[0]
|
|
|
+
|
|
|
+ this.currentCode = ''
|
|
|
+
|
|
|
+ this.codeCache = this.languages.map((val) => {
|
|
|
+ return { lang: val, code: '' }
|
|
|
+ })
|
|
|
+ // TODO this is test
|
|
|
+ for (let i = 0; i < 10; i++) {
|
|
|
+ const r = Math.floor(Math.random() * 4 + 1)
|
|
|
+ this.commits.push({
|
|
|
+ id: i.toString(),
|
|
|
+ submitTime: '2020-12-11 20:02',
|
|
|
+ status: this.statusTags[r],
|
|
|
+ score: 6 * i
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ submitCode(): void {
|
|
|
+ this.tab = 1
|
|
|
+ const examId = this.$route.params.examId
|
|
|
+ const codeToSubmit: CodeSubmitSerializer = {
|
|
|
+ code: this.currentCode,
|
|
|
+ language: this.currentLang
|
|
|
+ }
|
|
|
+ codeJudge(examId, this.question.id, codeToSubmit).then(({ data }) => {
|
|
|
+ console.log(data.result)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // getCurrentCommit(): CommitInfo {
|
|
|
+ // return this.commits[0]
|
|
|
+ // },
|
|
|
+ statusToColor(status: string): string {
|
|
|
+ return this.statusColors[this.statusTags.indexOf(status)]
|
|
|
+ },
|
|
|
+ resetLastCommit() {
|
|
|
+ // const lastCommitCodes = this.question.lastCommitCodes
|
|
|
+ // const lastCommitTuple = lastCommitCodes?.find((val) => {
|
|
|
+ // return val.lang === this.currentLang
|
|
|
+ // })
|
|
|
+ //
|
|
|
+ // this.currentCode = lastCommitTuple?.code ?? ''
|
|
|
+ },
|
|
|
+ resetOriginCode() {
|
|
|
+ // const originCodes = this.question.codeTuples ?? []
|
|
|
+ // const originTuple =
|
|
|
+ // originCodes.find((val) => {
|
|
|
+ // return val.lang === this.currentLang
|
|
|
+ // }) ?? {}
|
|
|
+ // this.currentCode = originTuple.code ?? ''
|
|
|
+ },
|
|
|
+ prevQuestion() {
|
|
|
+ this.$emit('prevQuestion')
|
|
|
+ },
|
|
|
+ nextQuestion() {
|
|
|
+ this.$emit('nextQuestion')
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
-.questionCard {
|
|
|
- margin: 0.5vh;
|
|
|
- height: 92vh;
|
|
|
+.code-question {
|
|
|
+ height: 98vh;
|
|
|
}
|
|
|
</style>
|