fix.
This commit is contained in:
@@ -71,7 +71,7 @@ const options = {
|
|||||||
</n-space>
|
</n-space>
|
||||||
</n-descriptions-item>
|
</n-descriptions-item>
|
||||||
</n-descriptions>
|
</n-descriptions>
|
||||||
<div class="pie">
|
<div class="pie" v-if="problem.submission_number > 0">
|
||||||
<Pie :data="data" :options="options" />
|
<Pie :data="data" :options="options" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -8,10 +8,12 @@ import { Problem, Submission, SubmitCodePayload } from "utils/types"
|
|||||||
import { getSubmission, submitCode } from "oj/api"
|
import { getSubmission, submitCode } from "oj/api"
|
||||||
import SubmissionResultTag from "~/shared/SubmissionResultTag.vue"
|
import SubmissionResultTag from "~/shared/SubmissionResultTag.vue"
|
||||||
import type { DataTableColumn } from "naive-ui"
|
import type { DataTableColumn } from "naive-ui"
|
||||||
|
import { useUserStore } from "~/shared/store/user"
|
||||||
|
|
||||||
|
const userStore = useUserStore()
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
const problem = inject<Ref<Problem>>("problem")
|
const problem = inject<Ref<Problem>>("problem")
|
||||||
|
|
||||||
const route = useRoute()
|
|
||||||
const contestID = <string>route.params.contestID ?? ""
|
const contestID = <string>route.params.contestID ?? ""
|
||||||
|
|
||||||
const submissionId = ref("")
|
const submissionId = ref("")
|
||||||
@@ -60,6 +62,9 @@ const submitting = computed(
|
|||||||
)
|
)
|
||||||
|
|
||||||
const submitDisabled = computed(() => {
|
const submitDisabled = computed(() => {
|
||||||
|
if (!userStore.isAuthed) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
const value = code.value
|
const value = code.value
|
||||||
if (
|
if (
|
||||||
value.trim() === "" ||
|
value.trim() === "" ||
|
||||||
@@ -81,6 +86,9 @@ const submitDisabled = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const submitLabel = computed(() => {
|
const submitLabel = computed(() => {
|
||||||
|
if (!userStore.isAuthed) {
|
||||||
|
return "请先登录"
|
||||||
|
}
|
||||||
if (submitting.value) {
|
if (submitting.value) {
|
||||||
return "正在提交"
|
return "正在提交"
|
||||||
}
|
}
|
||||||
@@ -154,6 +162,9 @@ const columns: DataTableColumn<Submission["info"]["data"][number]>[] = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
async function submit() {
|
async function submit() {
|
||||||
|
if (!userStore.isAuthed) {
|
||||||
|
return
|
||||||
|
}
|
||||||
const data: SubmitCodePayload = {
|
const data: SubmitCodePayload = {
|
||||||
problem_id: problem!.value.id,
|
problem_id: problem!.value.id,
|
||||||
language: code.language,
|
language: code.language,
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ provide("problem", readonly(problem))
|
|||||||
<n-grid v-if="problem" x-gap="16" :cols="2">
|
<n-grid v-if="problem" x-gap="16" :cols="2">
|
||||||
<n-gi :span="isDesktop ? 1 : 2">
|
<n-gi :span="isDesktop ? 1 : 2">
|
||||||
<n-scrollbar v-if="isDesktop" style="max-height: calc(100vh - 92px)">
|
<n-scrollbar v-if="isDesktop" style="max-height: calc(100vh - 92px)">
|
||||||
<n-tabs default-value="content">
|
<n-tabs default-value="content" type="segment">
|
||||||
<n-tab-pane name="content" tab="题目描述">
|
<n-tab-pane name="content" tab="题目描述">
|
||||||
<ProblemContent :problem="problem" />
|
<ProblemContent :problem="problem" />
|
||||||
</n-tab-pane>
|
</n-tab-pane>
|
||||||
@@ -50,7 +50,7 @@ provide("problem", readonly(problem))
|
|||||||
</n-tab-pane>
|
</n-tab-pane>
|
||||||
</n-tabs>
|
</n-tabs>
|
||||||
</n-scrollbar>
|
</n-scrollbar>
|
||||||
<n-tabs v-else default-value="content">
|
<n-tabs v-else default-value="content" type="segment">
|
||||||
<n-tab-pane name="content" tab="题目描述">
|
<n-tab-pane name="content" tab="题目描述">
|
||||||
<ProblemContent :problem="problem" />
|
<ProblemContent :problem="problem" />
|
||||||
</n-tab-pane>
|
</n-tab-pane>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { useUserStore } from "~/shared/store/user"
|
import { useUserStore } from "~/shared/store/user"
|
||||||
import { filterEmptyValue, getTagColor } from "utils/functions"
|
import { filterEmptyValue, getTagColor } from "utils/functions"
|
||||||
import { ProblemFiltered } from "utils/types"
|
import { ProblemFiltered } from "utils/types"
|
||||||
import { isDesktop } from "~/shared/composables/breakpoints"
|
import { isMobile } from "~/shared/composables/breakpoints"
|
||||||
import { getProblemList, getRandomProblemID } from "oj/api"
|
import { getProblemList, getRandomProblemID } from "oj/api"
|
||||||
import Pagination from "~/shared/Pagination.vue"
|
import Pagination from "~/shared/Pagination.vue"
|
||||||
import { DataTableColumn, NSpace, NTag } from "naive-ui"
|
import { DataTableColumn, NSpace, NTag } from "naive-ui"
|
||||||
@@ -169,7 +169,8 @@ function rowProps(row: ProblemFiltered) {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<n-form :inline="isDesktop" label-placement="left">
|
<n-space :vertical="isMobile">
|
||||||
|
<n-form inline label-placement="left">
|
||||||
<n-form-item label="难度">
|
<n-form-item label="难度">
|
||||||
<n-select
|
<n-select
|
||||||
class="select"
|
class="select"
|
||||||
@@ -178,8 +179,14 @@ function rowProps(row: ProblemFiltered) {
|
|||||||
/>
|
/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
<n-form-item>
|
<n-form-item>
|
||||||
<n-input placeholder="输入编号或标题后回车" clearable @change="search" />
|
<n-input
|
||||||
|
placeholder="输入编号或标题后回车"
|
||||||
|
clearable
|
||||||
|
@change="search"
|
||||||
|
/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
|
</n-form>
|
||||||
|
<n-form inline label-placement="left">
|
||||||
<n-form-item>
|
<n-form-item>
|
||||||
<n-space>
|
<n-space>
|
||||||
<n-button @click="search(query.keyword)">搜索</n-button>
|
<n-button @click="search(query.keyword)">搜索</n-button>
|
||||||
@@ -188,6 +195,7 @@ function rowProps(row: ProblemFiltered) {
|
|||||||
</n-space>
|
</n-space>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
</n-form>
|
</n-form>
|
||||||
|
</n-space>
|
||||||
<n-space>
|
<n-space>
|
||||||
<div class="tagTitle">标签</div>
|
<div class="tagTitle">标签</div>
|
||||||
<n-button
|
<n-button
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import Header from "../Header.vue"
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<n-layout position="absolute">
|
<n-layout>
|
||||||
<n-layout-header bordered class="header">
|
<n-layout-header bordered class="header">
|
||||||
<Header />
|
<Header />
|
||||||
</n-layout-header>
|
</n-layout-header>
|
||||||
|
|||||||
Reference in New Issue
Block a user