layout update
This commit is contained in:
@@ -6,13 +6,13 @@ import { STORAGE_KEY } from "utils/constants"
|
||||
import storage from "utils/storage"
|
||||
|
||||
import App from "./App.vue"
|
||||
import { admins, ojs } from "./routes"
|
||||
import { admins, contestProblem, learns, ojs, problem } from "./routes"
|
||||
|
||||
import { toggleLogin } from "./shared/composables/modal"
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: [ojs, admins],
|
||||
routes: [ojs, admins, problem, contestProblem, learns],
|
||||
})
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
|
||||
@@ -69,7 +69,7 @@ watch(query, listAnnouncements, { deep: true })
|
||||
</script>
|
||||
<template>
|
||||
<n-data-table
|
||||
striped
|
||||
:bordered="false"
|
||||
:data="announcements"
|
||||
:columns="columns"
|
||||
:row-props="rowProps"
|
||||
|
||||
@@ -175,7 +175,7 @@ function rowProps(row: Contest) {
|
||||
</n-form>
|
||||
</n-space>
|
||||
<n-data-table
|
||||
striped
|
||||
:bordered="false"
|
||||
:columns="columns"
|
||||
:data="data"
|
||||
:row-props="rowProps"
|
||||
|
||||
@@ -268,7 +268,7 @@ function rowProps(row: ProblemFiltered) {
|
||||
</n-flex>
|
||||
</n-collapse-transition>
|
||||
<n-data-table
|
||||
striped
|
||||
:bordered="false"
|
||||
:data="problems"
|
||||
:columns="columns"
|
||||
:row-props="rowProps"
|
||||
|
||||
@@ -166,7 +166,7 @@ onMounted(async () => {
|
||||
<n-flex justify="center">
|
||||
<n-h2>全校前100名</n-h2>
|
||||
</n-flex>
|
||||
<n-data-table striped :data="data" :columns="columns" />
|
||||
<n-data-table :data="data" :columns="columns" />
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="query.page"
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { NButton, NH2, NText } from "naive-ui"
|
||||
import { adminRejudge, getSubmissions, getTodaySubmissionCount } from "oj/api"
|
||||
import {
|
||||
filterEmptyValue,
|
||||
parseTime,
|
||||
submissionMemoryFormat,
|
||||
submissionTimeFormat,
|
||||
} from "utils/functions"
|
||||
import { filterEmptyValue, parseTime } from "utils/functions"
|
||||
import { Submission } from "utils/types"
|
||||
import Pagination from "~/shared/components/Pagination.vue"
|
||||
import SubmissionResultTag from "~/shared/components/SubmissionResultTag.vue"
|
||||
@@ -203,20 +198,6 @@ const columns = computed(() => {
|
||||
() => row.problem,
|
||||
),
|
||||
},
|
||||
{
|
||||
title: renderTableTitle("执行耗时", "streamline-emojis:snail"),
|
||||
key: "time",
|
||||
width: 120,
|
||||
align: "center",
|
||||
render: (row) => submissionTimeFormat(row.statistic_info.time_cost),
|
||||
},
|
||||
{
|
||||
title: renderTableTitle("占用内存", "streamline-emojis:bell"),
|
||||
key: "memory",
|
||||
width: 120,
|
||||
align: "center",
|
||||
render: (row) => submissionMemoryFormat(row.statistic_info.memory_cost),
|
||||
},
|
||||
{
|
||||
title: renderTableTitle(
|
||||
"语言",
|
||||
@@ -318,7 +299,7 @@ const columns = computed(() => {
|
||||
</n-form-item>
|
||||
</n-form>
|
||||
</n-space>
|
||||
<n-data-table striped :columns="columns" :data="submissions" />
|
||||
<n-data-table :bordered="false" :columns="columns" :data="submissions" />
|
||||
</n-flex>
|
||||
<Pagination
|
||||
:total="total"
|
||||
|
||||
@@ -1,18 +1,40 @@
|
||||
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"),
|
||||
@@ -57,14 +79,6 @@ export const ojs: RouteRecordRaw = {
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
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"),
|
||||
@@ -89,8 +103,15 @@ export const ojs: RouteRecordRaw = {
|
||||
component: () => import("oj/user/message.vue"),
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
export const learns: RouteRecordRaw = {
|
||||
path: "/learn/:step+",
|
||||
component: () => import("~/shared/layout/full.vue"),
|
||||
children: [
|
||||
{
|
||||
path: "learn/:step+",
|
||||
path: "",
|
||||
component: () => import("learn/index.vue"),
|
||||
name: "learn",
|
||||
},
|
||||
|
||||
@@ -89,6 +89,7 @@ const options: Array<DropdownOption | DropdownDividerOption> = [
|
||||
{
|
||||
label: "我的消息",
|
||||
key: "message",
|
||||
show: false,
|
||||
icon: renderIcon("streamline-emojis:herb"),
|
||||
props: {
|
||||
onClick: () => router.push("/message"),
|
||||
|
||||
@@ -7,11 +7,11 @@ import Signup from "../components/Signup.vue"
|
||||
|
||||
<template>
|
||||
<n-layout position="absolute">
|
||||
<n-layout-header bordered class="header">
|
||||
<Header />
|
||||
<n-layout-header bordered style="padding: 8px;">
|
||||
<Header class="header" />
|
||||
</n-layout-header>
|
||||
<n-layout-content
|
||||
content-style="padding: 16px; overflow-x: initial; max-width: 2000px; margin: 0 auto;"
|
||||
content-style="padding: 16px; overflow-x: initial; max-width: 1600px; margin: 0 auto;"
|
||||
>
|
||||
<router-view></router-view>
|
||||
</n-layout-content>
|
||||
@@ -22,9 +22,8 @@ import Signup from "../components/Signup.vue"
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.header {
|
||||
padding: 8px;
|
||||
max-width: 2000px;
|
||||
.header {
|
||||
max-width: 1600px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
22
src/shared/layout/full.vue
Normal file
22
src/shared/layout/full.vue
Normal file
@@ -0,0 +1,22 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user