fix routes.

This commit is contained in:
2023-06-13 12:11:16 +08:00
parent 03f24190fc
commit 995dd98ddb
3 changed files with 91 additions and 91 deletions

View File

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

View File

@@ -1,7 +1,7 @@
import { RouteRecordRaw } from "vue-router"
import { loadChart } from "./shared/composables/chart"
export const routes: RouteRecordRaw = {
export const ojs: RouteRecordRaw = {
path: "/",
component: () => import("~/shared/layout/default.vue"),
children: [
@@ -89,7 +89,10 @@ export const routes: RouteRecordRaw = {
component: () => import("learn/index.vue"),
name: "learn",
},
{
],
}
export const admins: RouteRecordRaw = {
path: "/admin",
component: () => import("~/shared/layout/admin.vue"),
children: [
@@ -169,6 +172,4 @@ export const routes: RouteRecordRaw = {
props: true,
},
],
},
],
}

View File

@@ -8,6 +8,10 @@ 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",
@@ -101,19 +105,14 @@ onMounted(async () => {
</script>
<template>
<div class="admin">
<n-layout-sider width="160" bordered>
<n-layout has-sider position="absolute">
<n-layout-sider width="160" bordered :native-scrollbar="false">
<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>
</div>
</n-layout>
</template>
<style scoped>
.admin {
margin: -16px;
display: flex;
}
</style>
<style scoped></style>