fix routes.

This commit is contained in:
2023-06-13 12:02:59 +08:00
parent c27f5c43c7
commit 03f24190fc
13 changed files with 408 additions and 454 deletions

View File

@@ -113,6 +113,6 @@ function handleAll() {
<style scoped>
.inputArea {
width: 200px;
height: calc(100vh - 108px);
height: 500px;
}
</style>

View File

@@ -105,6 +105,7 @@ declare global {
const toReactive: typeof import('@vueuse/core')['toReactive']
const toRef: typeof import('vue')['toRef']
const toRefs: typeof import('vue')['toRefs']
const toValue: typeof import('vue')['toValue']
const triggerRef: typeof import('vue')['triggerRef']
const tryOnBeforeMount: typeof import('@vueuse/core')['tryOnBeforeMount']
const tryOnBeforeUnmount: typeof import('@vueuse/core')['tryOnBeforeUnmount']

4
src/components.d.ts vendored
View File

@@ -3,11 +3,9 @@
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core'
export {}
declare module '@vue/runtime-core' {
declare module 'vue' {
export interface GlobalComponents {
IEpArrowRightBold: typeof import('~icons/ep/arrow-right-bold')['default']
IEpBell: typeof import('~icons/ep/bell')['default']

View File

@@ -1,24 +1,3 @@
我是第一步
我是第二步
我是第三步
我是第一步
我是第二步
我是第三步
我是第一步
我是第二步
我是第三步
我是第一步
我是第二步
我是第三步
我是第一步
我是第二步
我是第三步
我是第一步
我是第二步
我是第三步
我是第一步
我是第二步
我是第三步
我是第一步
我是第二步
我是第三步

View File

@@ -11,7 +11,7 @@ import { toggleLogin } from "./shared/composables/modal"
const router = createRouter({
history: createWebHistory(),
routes,
routes: [routes],
})
router.beforeEach((to, from, next) => {

View File

@@ -50,7 +50,7 @@ const columns: DataTableColumn<Rank>[] = [
() => row.user.username
),
},
{ title: "骚话", key: "mood", minWidth: 200 },
{ title: "自我介绍", key: "mood", minWidth: 200 },
{ title: "已解决", key: "accepted_number", width: 100 },
{ title: "提交数", key: "submission_number", width: 100 },
{

View File

@@ -127,7 +127,7 @@ const columns = computed(() => {
),
},
{
title: "编号",
title: "提交编号",
key: "id",
minWidth: 160,
render: (row) => {

View File

@@ -57,7 +57,7 @@ async function saveProfile() {
<n-form-item label="真名">
<n-input v-model:value="userStore.profile.real_name" />
</n-form-item>
<n-form-item label="骚话">
<n-form-item label="自我介绍">
<n-input v-model:value="userStore.profile.mood" />
</n-form-item>
<n-button

View File

@@ -1,176 +1,174 @@
import { RouteRecordRaw } from "vue-router"
import { loadChart } from "./shared/composables/chart"
export const routes: 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"),
name: "submissions",
},
{
path: "submission/:submissionID",
component: () => import("oj/submission/detail.vue"),
props: true,
meta: { requiresAuth: true },
},
{
path: "contest",
component: () => import("oj/contest/list.vue"),
name: "contests",
},
{
path: "contest/:contestID",
component: () => import("oj/contest/detail.vue"),
props: true,
meta: { requiresAuth: true },
children: [
{
path: "",
component: () => import("oj/contest/pages/problems.vue"),
props: true,
meta: { requiresAuth: true },
name: "contest problems",
},
{
path: "submission",
component: () => import("oj/submission/list.vue"),
meta: { requiresAuth: true },
name: "contest submissions",
},
{
path: "rank",
component: () => import("oj/contest/pages/rank.vue"),
props: true,
meta: { requiresAuth: true },
name: "contest rank",
},
],
},
{
path: "contest/:contestID/problem/:problemID",
component: () => import("oj/problem/detail.vue"),
props: true,
name: "contest problem",
meta: { requiresAuth: true },
beforeEnter: loadChart,
},
{
path: "rank",
component: () => import("oj/rank/list.vue"),
beforeEnter: loadChart,
},
{
path: "user",
component: () => import("oj/user/index.vue"),
meta: { requiresAuth: true },
},
{
path: "setting",
component: () => import("oj/user/setting.vue"),
meta: { requiresAuth: true },
},
{
path: "learn",
redirect: "learn/step-1",
},
{
path: "learn/:step+",
component: () => import("learn/index.vue"),
name: "learn",
},
],
},
{
path: "/admin",
component: () => import("~/shared/layout/admin.vue"),
children: [
{
path: "",
name: "admin home",
component: () => import("~/admin/setting/home.vue"),
},
{
path: "config",
name: "admin config",
component: () => import("admin/setting/config.vue"),
},
{
path: "announcement",
name: "admin announcement",
component: () => import("admin/setting/announcement.vue"),
},
{
path: "user/list",
name: "admin user list",
component: () => import("admin/user/list.vue"),
},
{
path: "user/generate",
name: "admin user generate",
component: () => import("~/admin/user/generate.vue"),
},
{
path: "problem/list",
name: "admin problem list",
component: () => import("admin/problem/list.vue"),
},
{
path: "problem/create",
name: "admin problem create",
component: () => import("admin/problem/detail.vue"),
},
{
path: "problem/edit/:problemID",
name: "admin problem edit",
component: () => import("admin/problem/detail.vue"),
props: true,
},
{
path: "contest/list",
name: "admin contest list",
component: () => import("admin/contest/list.vue"),
},
{
path: "contest/create",
name: "admin contest create",
component: () => import("admin/contest/detail.vue"),
},
{
path: "contest/edit/:contestID",
name: "admin contest edit",
component: () => import("admin/contest/detail.vue"),
props: true,
},
{
path: "contest/:contestID/problem/list",
name: "admin contest problem list",
component: () => import("admin/problem/list.vue"),
props: true,
},
{
path: "contest/:contestID/problem/create",
name: "admin contest problem create",
component: () => import("admin/problem/detail.vue"),
props: true,
},
{
path: "contest/:contestID/problem/edit/:problemID",
name: "admin contest problem edit",
component: () => import("admin/problem/detail.vue"),
props: true,
},
],
},
]
export const routes: 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"),
name: "submissions",
},
{
path: "submission/:submissionID",
component: () => import("oj/submission/detail.vue"),
props: true,
meta: { requiresAuth: true },
},
{
path: "contest",
component: () => import("oj/contest/list.vue"),
name: "contests",
},
{
path: "contest/:contestID",
component: () => import("oj/contest/detail.vue"),
props: true,
meta: { requiresAuth: true },
children: [
{
path: "",
component: () => import("oj/contest/pages/problems.vue"),
props: true,
meta: { requiresAuth: true },
name: "contest problems",
},
{
path: "submission",
component: () => import("oj/submission/list.vue"),
meta: { requiresAuth: true },
name: "contest submissions",
},
{
path: "rank",
component: () => import("oj/contest/pages/rank.vue"),
props: true,
meta: { requiresAuth: true },
name: "contest rank",
},
],
},
{
path: "contest/:contestID/problem/:problemID",
component: () => import("oj/problem/detail.vue"),
props: true,
name: "contest problem",
meta: { requiresAuth: true },
beforeEnter: loadChart,
},
{
path: "rank",
component: () => import("oj/rank/list.vue"),
beforeEnter: loadChart,
},
{
path: "user",
component: () => import("oj/user/index.vue"),
meta: { requiresAuth: true },
},
{
path: "setting",
component: () => import("oj/user/setting.vue"),
meta: { requiresAuth: true },
},
{
path: "learn",
redirect: "learn/step-1",
},
{
path: "learn/:step+",
component: () => import("learn/index.vue"),
name: "learn",
},
{
path: "/admin",
component: () => import("~/shared/layout/admin.vue"),
children: [
{
path: "",
name: "admin home",
component: () => import("~/admin/setting/home.vue"),
},
{
path: "config",
name: "admin config",
component: () => import("admin/setting/config.vue"),
},
{
path: "announcement",
name: "admin announcement",
component: () => import("admin/setting/announcement.vue"),
},
{
path: "user/list",
name: "admin user list",
component: () => import("admin/user/list.vue"),
},
{
path: "user/generate",
name: "admin user generate",
component: () => import("~/admin/user/generate.vue"),
},
{
path: "problem/list",
name: "admin problem list",
component: () => import("admin/problem/list.vue"),
},
{
path: "problem/create",
name: "admin problem create",
component: () => import("admin/problem/detail.vue"),
},
{
path: "problem/edit/:problemID",
name: "admin problem edit",
component: () => import("admin/problem/detail.vue"),
props: true,
},
{
path: "contest/list",
name: "admin contest list",
component: () => import("admin/contest/list.vue"),
},
{
path: "contest/create",
name: "admin contest create",
component: () => import("admin/contest/detail.vue"),
},
{
path: "contest/edit/:contestID",
name: "admin contest edit",
component: () => import("admin/contest/detail.vue"),
props: true,
},
{
path: "contest/:contestID/problem/list",
name: "admin contest problem list",
component: () => import("admin/problem/list.vue"),
props: true,
},
{
path: "contest/:contestID/problem/create",
name: "admin contest problem create",
component: () => import("admin/problem/detail.vue"),
props: true,
},
{
path: "contest/:contestID/problem/edit/:problemID",
name: "admin contest problem edit",
component: () => import("admin/problem/detail.vue"),
props: true,
},
],
},
],
}

View File

@@ -36,6 +36,7 @@ const menus = computed<MenuOption[]>(() => [
label: () =>
h(RouterLink, { to: "/learn/step-1" }, { default: () => "自学" }),
key: "learn",
show: false,
},
{
label: () => h(RouterLink, { to: "/" }, { default: () => "题库" }),

View File

@@ -8,10 +8,6 @@ const route = useRoute()
const router = useRouter()
const userStore = useUserStore()
const options: MenuOption[] = [
{
label: () => h(RouterLink, { to: "/" }, { default: () => "返回 OJ" }),
key: "return to OJ",
},
{
label: () => h(RouterLink, { to: "/admin" }, { default: () => "首页" }),
key: "admin home",
@@ -105,14 +101,19 @@ onMounted(async () => {
</script>
<template>
<n-layout has-sider position="absolute">
<n-layout-sider width="160" bordered :native-scrollbar="false">
<div class="admin">
<n-layout-sider width="160" bordered>
<n-menu :options="options" :value="active" />
</n-layout-sider>
<n-layout-content content-style="padding: 16px; min-width: 600px">
<router-view></router-view>
</n-layout-content>
</n-layout>
</div>
</template>
<style scoped></style>
<style scoped>
.admin {
margin: -16px;
display: flex;
}
</style>