This commit is contained in:
2025-05-10 20:00:02 +08:00
parent b4c7238c8a
commit a686510211
4 changed files with 20 additions and 56 deletions

View File

@@ -6,13 +6,13 @@ import { STORAGE_KEY } from "utils/constants"
import storage from "utils/storage"
import App from "./App.vue"
import { admins, contestProblem, learns, ojs, problem } from "./routes"
import { admins, learns, ojs } from "./routes"
import { toggleLogin } from "./shared/composables/modal"
const router = createRouter({
history: createWebHistory(),
routes: [ojs, admins, problem, contestProblem, learns],
routes: [ojs, admins, learns],
})
router.beforeEach((to, from, next) => {

View File

@@ -1,40 +1,18 @@
import { RouteRecordRaw } from "vue-router"
import { loadChart } from "./shared/composables/chart"
export const problem: RouteRecordRaw = {
path: "/problem/:problemID",
component: () => import("~/shared/layout/full.vue"),
children: [
{
path: "",
component: () => import("oj/problem/detail.vue"),
props: true,
name: "problem",
beforeEnter: loadChart,
},
],
}
export const contestProblem: RouteRecordRaw = {
path: "/contest/:contestID/problem/:problemID",
component: () => import("~/shared/layout/full.vue"),
children: [
{
path: "",
component: () => import("oj/problem/detail.vue"),
props: true,
name: "contest problem",
meta: { requiresAuth: true },
beforeEnter: loadChart,
},
],
}
export const ojs: RouteRecordRaw = {
path: "/",
component: () => import("~/shared/layout/default.vue"),
children: [
{ path: "", component: () => import("oj/problem/list.vue") },
{
path: "problem/:problemID",
component: () => import("oj/problem/detail.vue"),
props: true,
name: "problem",
beforeEnter: loadChart,
},
{
path: "submission",
component: () => import("oj/submission/list.vue"),
@@ -64,6 +42,14 @@ export const ojs: RouteRecordRaw = {
meta: { requiresAuth: true },
name: "contest problems",
},
{
path: "problem/:problemID",
component: () => import("oj/problem/detail.vue"),
props: true,
name: "contest problem",
meta: { requiresAuth: true },
beforeEnter: loadChart,
},
{
path: "submission",
component: () => import("oj/submission/list.vue"),
@@ -108,7 +94,7 @@ export const ojs: RouteRecordRaw = {
export const learns: RouteRecordRaw = {
path: "/learn/:step+",
component: () => import("~/shared/layout/full.vue"),
component: () => import("~/shared/layout/default.vue"),
children: [
{
path: "",

View File

@@ -11,7 +11,7 @@ import Signup from "../components/Signup.vue"
<Header class="header" />
</n-layout-header>
<n-layout-content
content-style="padding: 16px; overflow-x: initial; max-width: 1600px; margin: 0 auto;"
content-style="padding: 16px; overflow-x: initial; max-width: 2000px; margin: 0 auto;"
>
<router-view></router-view>
</n-layout-content>
@@ -23,7 +23,7 @@ import Signup from "../components/Signup.vue"
<style scoped>
.header {
max-width: 1600px;
max-width: 2000px;
margin-left: auto;
margin-right: auto;
}

View File

@@ -1,22 +0,0 @@
<script setup lang="ts">
import Beian from "../components/Beian.vue"
import Header from "../components/Header.vue"
import Login from "../components/Login.vue"
import Signup from "../components/Signup.vue"
</script>
<template>
<n-layout position="absolute">
<n-layout-header bordered style="padding: 8px;">
<Header />
</n-layout-header>
<n-layout-content
content-style="padding: 16px; overflow-x: initial;"
>
<router-view></router-view>
</n-layout-content>
<Login />
<Signup />
<Beian />
</n-layout>
</template>