fix problem status.
This commit is contained in:
6
src/components.d.ts
vendored
6
src/components.d.ts
vendored
@@ -13,7 +13,6 @@ declare module '@vue/runtime-core' {
|
|||||||
IEpCaretRight: typeof import('~icons/ep/caret-right')['default']
|
IEpCaretRight: typeof import('~icons/ep/caret-right')['default']
|
||||||
IEpLoading: typeof import('~icons/ep/loading')['default']
|
IEpLoading: typeof import('~icons/ep/loading')['default']
|
||||||
IEpLock: typeof import('~icons/ep/lock')['default']
|
IEpLock: typeof import('~icons/ep/lock')['default']
|
||||||
IEpMenu: typeof import('~icons/ep/menu')['default']
|
|
||||||
IEpMoon: typeof import('~icons/ep/moon')['default']
|
IEpMoon: typeof import('~icons/ep/moon')['default']
|
||||||
IEpMoreFilled: typeof import('~icons/ep/more-filled')['default']
|
IEpMoreFilled: typeof import('~icons/ep/more-filled')['default']
|
||||||
IEpSunny: typeof import('~icons/ep/sunny')['default']
|
IEpSunny: typeof import('~icons/ep/sunny')['default']
|
||||||
@@ -23,10 +22,10 @@ declare module '@vue/runtime-core' {
|
|||||||
NCard: typeof import('naive-ui')['NCard']
|
NCard: typeof import('naive-ui')['NCard']
|
||||||
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
||||||
NCheckboxGroup: typeof import('naive-ui')['NCheckboxGroup']
|
NCheckboxGroup: typeof import('naive-ui')['NCheckboxGroup']
|
||||||
NCode: typeof import("naive-ui")["NCode"]
|
NCode: typeof import('naive-ui')['NCode']
|
||||||
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
||||||
NDataTable: typeof import('naive-ui')['NDataTable']
|
NDataTable: typeof import('naive-ui')['NDataTable']
|
||||||
NDatePicker: typeof import("naive-ui")["NDatePicker"]
|
NDatePicker: typeof import('naive-ui')['NDatePicker']
|
||||||
NDescriptions: typeof import('naive-ui')['NDescriptions']
|
NDescriptions: typeof import('naive-ui')['NDescriptions']
|
||||||
NDescriptionsItem: typeof import('naive-ui')['NDescriptionsItem']
|
NDescriptionsItem: typeof import('naive-ui')['NDescriptionsItem']
|
||||||
NDropdown: typeof import('naive-ui')['NDropdown']
|
NDropdown: typeof import('naive-ui')['NDropdown']
|
||||||
@@ -42,7 +41,6 @@ declare module '@vue/runtime-core' {
|
|||||||
NInput: typeof import('naive-ui')['NInput']
|
NInput: typeof import('naive-ui')['NInput']
|
||||||
NLayout: typeof import('naive-ui')['NLayout']
|
NLayout: typeof import('naive-ui')['NLayout']
|
||||||
NLayoutContent: typeof import('naive-ui')['NLayoutContent']
|
NLayoutContent: typeof import('naive-ui')['NLayoutContent']
|
||||||
NLayoutFooter: typeof import('naive-ui')['NLayoutFooter']
|
|
||||||
NLayoutHeader: typeof import('naive-ui')['NLayoutHeader']
|
NLayoutHeader: typeof import('naive-ui')['NLayoutHeader']
|
||||||
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
|
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
|
||||||
NMenu: typeof import('naive-ui')['NMenu']
|
NMenu: typeof import('naive-ui')['NMenu']
|
||||||
|
|||||||
@@ -75,10 +75,6 @@ export function getSubmission(id: string) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function submissionExists(problemID: number) {
|
|
||||||
return http.get("submission_exists", { params: { problem_id: problemID } })
|
|
||||||
}
|
|
||||||
|
|
||||||
export function submitCode(data: SubmitCodePayload) {
|
export function submitCode(data: SubmitCodePayload) {
|
||||||
return http.post("submission", data)
|
return http.post("submission", data)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,11 @@ function goSubmissions() {
|
|||||||
router.push({ name, query: { problem: props.problem._id } })
|
router.push({ name, query: { problem: props.problem._id } })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function goTestCat() {
|
||||||
|
const data = router.resolve({ name: "play" })
|
||||||
|
window.open(data.href, "_blank")
|
||||||
|
}
|
||||||
|
|
||||||
function edit() {
|
function edit() {
|
||||||
router.push("/admin/problem/edit/" + props.problem.id)
|
router.push("/admin/problem/edit/" + props.problem.id)
|
||||||
}
|
}
|
||||||
@@ -94,6 +99,7 @@ function select(key: string) {
|
|||||||
<n-space>
|
<n-space>
|
||||||
<n-button @click="reset">重置</n-button>
|
<n-button @click="reset">重置</n-button>
|
||||||
<n-button @click="goSubmissions">提交信息</n-button>
|
<n-button @click="goSubmissions">提交信息</n-button>
|
||||||
|
<n-button type="info" @click="goTestCat">自测猫</n-button>
|
||||||
<n-button type="warning" v-if="userStore.isSuperAdmin" @click="edit">
|
<n-button type="warning" v-if="userStore.isSuperAdmin" @click="edit">
|
||||||
编辑
|
编辑
|
||||||
</n-button>
|
</n-button>
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { code } from "oj/composables/code"
|
|||||||
import { SOURCES } from "utils/constants"
|
import { SOURCES } from "utils/constants"
|
||||||
import { Problem, ProblemStatus } from "utils/types"
|
import { Problem, ProblemStatus } from "utils/types"
|
||||||
import { createTestSubmission } from "utils/judge"
|
import { createTestSubmission } from "utils/judge"
|
||||||
import { submissionExists } from "oj/api"
|
|
||||||
import { useThemeVars } from "naive-ui"
|
import { useThemeVars } from "naive-ui"
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -18,14 +17,8 @@ type Sample = Problem["samples"][number] & {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<Props>()
|
const props = defineProps<Props>()
|
||||||
const route = useRoute()
|
|
||||||
const theme = useThemeVars()
|
const theme = useThemeVars()
|
||||||
const style = computed(() => "color: " + theme.value.primaryColor)
|
const style = computed(() => "color: " + theme.value.primaryColor)
|
||||||
const solved = ref(false)
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
if (route.params.contestID) checkSubmission()
|
|
||||||
})
|
|
||||||
|
|
||||||
const samples = ref<Sample[]>(
|
const samples = ref<Sample[]>(
|
||||||
props.problem.samples.map((sample, index) => ({
|
props.problem.samples.map((sample, index) => ({
|
||||||
@@ -46,11 +39,6 @@ const disabled = computed(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
async function checkSubmission() {
|
|
||||||
const res = await submissionExists(props.problem.id)
|
|
||||||
solved.value = res.data
|
|
||||||
}
|
|
||||||
|
|
||||||
async function test(sample: Sample, index: number) {
|
async function test(sample: Sample, index: number) {
|
||||||
samples.value = samples.value.map((sample) => {
|
samples.value = samples.value.map((sample) => {
|
||||||
if (sample.id === index) {
|
if (sample.id === index) {
|
||||||
@@ -97,7 +85,7 @@ function type(status: ProblemStatus) {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<n-alert
|
<n-alert
|
||||||
v-if="problem.my_status === 0 || (route.params.contestID && solved)"
|
v-if="problem.my_status === 0"
|
||||||
type="success"
|
type="success"
|
||||||
title="🎉 本 题 已 经 被 你 解 决 啦"
|
title="🎉 本 题 已 经 被 你 解 决 啦"
|
||||||
/>
|
/>
|
||||||
|
|||||||
5
src/play/index.vue
Normal file
5
src/play/index.vue
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<script lang="ts" setup></script>
|
||||||
|
<template>
|
||||||
|
<n-button>测试猫</n-button>
|
||||||
|
</template>
|
||||||
|
<style scoped></style>
|
||||||
@@ -92,6 +92,11 @@ export const routes: RouteRecordRaw[] = [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/play",
|
||||||
|
component: () => import("~/play/index.vue"),
|
||||||
|
name: "play",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "/admin",
|
path: "/admin",
|
||||||
component: () => import("~/shared/layout/admin.vue"),
|
component: () => import("~/shared/layout/admin.vue"),
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
import Login from "../Login.vue"
|
import Login from "../Login.vue"
|
||||||
import Signup from "../Signup.vue"
|
import Signup from "../Signup.vue"
|
||||||
import Header from "../Header.vue"
|
import Header from "../Header.vue"
|
||||||
import { useConfigStore } from "../store/config"
|
|
||||||
|
|
||||||
const configStore = useConfigStore()
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -15,7 +12,6 @@ const configStore = useConfigStore()
|
|||||||
<n-layout-content content-style="padding: 16px; overflow-x: initial">
|
<n-layout-content content-style="padding: 16px; overflow-x: initial">
|
||||||
<router-view></router-view>
|
<router-view></router-view>
|
||||||
</n-layout-content>
|
</n-layout-content>
|
||||||
<p class="footer">{{ configStore.config?.website_footer }}</p>
|
|
||||||
<Login />
|
<Login />
|
||||||
<Signup />
|
<Signup />
|
||||||
</n-layout>
|
</n-layout>
|
||||||
@@ -25,8 +21,4 @@ const configStore = useConfigStore()
|
|||||||
.header {
|
.header {
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
}
|
}
|
||||||
.footer {
|
|
||||||
text-align: center;
|
|
||||||
margin: 20px 0;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
"oj/*": ["./src/oj/*"],
|
"oj/*": ["./src/oj/*"],
|
||||||
"admin/*": ["./src/admin/*"],
|
"admin/*": ["./src/admin/*"],
|
||||||
"learn/*": ["./src/learn/*"],
|
"learn/*": ["./src/learn/*"],
|
||||||
|
"play/*": ["./src/play/*"],
|
||||||
},
|
},
|
||||||
"types": ["naive-ui/volar"]
|
"types": ["naive-ui/volar"]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ export default defineConfig({
|
|||||||
fancy: ["highlight.js", "party-js"],
|
fancy: ["highlight.js", "party-js"],
|
||||||
chart: ["vue-chartjs", "chart.js"],
|
chart: ["vue-chartjs", "chart.js"],
|
||||||
editor: ["@wangeditor/editor"],
|
editor: ["@wangeditor/editor"],
|
||||||
|
monaco: ["monaco-editor"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -36,6 +37,7 @@ export default defineConfig({
|
|||||||
oj: path.resolve(__dirname, "./src/oj"),
|
oj: path.resolve(__dirname, "./src/oj"),
|
||||||
admin: path.resolve(__dirname, "./src/admin"),
|
admin: path.resolve(__dirname, "./src/admin"),
|
||||||
learn: path.resolve(__dirname, "./src/learn"),
|
learn: path.resolve(__dirname, "./src/learn"),
|
||||||
|
play: path.relative(__dirname, "./src/play"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
|||||||
Reference in New Issue
Block a user