layout update

This commit is contained in:
2025-05-10 00:04:53 +08:00
parent 52a2fd6625
commit b4c7238c8a
10 changed files with 73 additions and 49 deletions

View File

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

View File

@@ -69,7 +69,7 @@ watch(query, listAnnouncements, { deep: true })
</script> </script>
<template> <template>
<n-data-table <n-data-table
striped :bordered="false"
:data="announcements" :data="announcements"
:columns="columns" :columns="columns"
:row-props="rowProps" :row-props="rowProps"

View File

@@ -175,7 +175,7 @@ function rowProps(row: Contest) {
</n-form> </n-form>
</n-space> </n-space>
<n-data-table <n-data-table
striped :bordered="false"
:columns="columns" :columns="columns"
:data="data" :data="data"
:row-props="rowProps" :row-props="rowProps"

View File

@@ -268,7 +268,7 @@ function rowProps(row: ProblemFiltered) {
</n-flex> </n-flex>
</n-collapse-transition> </n-collapse-transition>
<n-data-table <n-data-table
striped :bordered="false"
:data="problems" :data="problems"
:columns="columns" :columns="columns"
:row-props="rowProps" :row-props="rowProps"

View File

@@ -166,7 +166,7 @@ onMounted(async () => {
<n-flex justify="center"> <n-flex justify="center">
<n-h2>全校前100名</n-h2> <n-h2>全校前100名</n-h2>
</n-flex> </n-flex>
<n-data-table striped :data="data" :columns="columns" /> <n-data-table :data="data" :columns="columns" />
<Pagination <Pagination
:total="total" :total="total"
v-model:page="query.page" v-model:page="query.page"

View File

@@ -1,12 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { NButton, NH2, NText } from "naive-ui" import { NButton, NH2, NText } from "naive-ui"
import { adminRejudge, getSubmissions, getTodaySubmissionCount } from "oj/api" import { adminRejudge, getSubmissions, getTodaySubmissionCount } from "oj/api"
import { import { filterEmptyValue, parseTime } from "utils/functions"
filterEmptyValue,
parseTime,
submissionMemoryFormat,
submissionTimeFormat,
} from "utils/functions"
import { Submission } from "utils/types" import { Submission } from "utils/types"
import Pagination from "~/shared/components/Pagination.vue" import Pagination from "~/shared/components/Pagination.vue"
import SubmissionResultTag from "~/shared/components/SubmissionResultTag.vue" import SubmissionResultTag from "~/shared/components/SubmissionResultTag.vue"
@@ -203,20 +198,6 @@ const columns = computed(() => {
() => row.problem, () => 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( title: renderTableTitle(
"语言", "语言",
@@ -318,7 +299,7 @@ const columns = computed(() => {
</n-form-item> </n-form-item>
</n-form> </n-form>
</n-space> </n-space>
<n-data-table striped :columns="columns" :data="submissions" /> <n-data-table :bordered="false" :columns="columns" :data="submissions" />
</n-flex> </n-flex>
<Pagination <Pagination
:total="total" :total="total"

View File

@@ -1,18 +1,40 @@
import { RouteRecordRaw } from "vue-router" import { RouteRecordRaw } from "vue-router"
import { loadChart } from "./shared/composables/chart" 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 = { export const ojs: RouteRecordRaw = {
path: "/", path: "/",
component: () => import("~/shared/layout/default.vue"), component: () => import("~/shared/layout/default.vue"),
children: [ children: [
{ path: "", component: () => import("oj/problem/list.vue") }, { path: "", component: () => import("oj/problem/list.vue") },
{
path: "problem/:problemID",
component: () => import("oj/problem/detail.vue"),
props: true,
name: "problem",
beforeEnter: loadChart,
},
{ {
path: "submission", path: "submission",
component: () => import("oj/submission/list.vue"), 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", path: "rank",
component: () => import("oj/rank/list.vue"), component: () => import("oj/rank/list.vue"),
@@ -89,8 +103,15 @@ export const ojs: RouteRecordRaw = {
component: () => import("oj/user/message.vue"), component: () => import("oj/user/message.vue"),
meta: { requiresAuth: true }, 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"), component: () => import("learn/index.vue"),
name: "learn", name: "learn",
}, },

View File

@@ -89,6 +89,7 @@ const options: Array<DropdownOption | DropdownDividerOption> = [
{ {
label: "我的消息", label: "我的消息",
key: "message", key: "message",
show: false,
icon: renderIcon("streamline-emojis:herb"), icon: renderIcon("streamline-emojis:herb"),
props: { props: {
onClick: () => router.push("/message"), onClick: () => router.push("/message"),

View File

@@ -7,11 +7,11 @@ import Signup from "../components/Signup.vue"
<template> <template>
<n-layout position="absolute"> <n-layout position="absolute">
<n-layout-header bordered class="header"> <n-layout-header bordered style="padding: 8px;">
<Header /> <Header class="header" />
</n-layout-header> </n-layout-header>
<n-layout-content <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> <router-view></router-view>
</n-layout-content> </n-layout-content>
@@ -22,9 +22,8 @@ import Signup from "../components/Signup.vue"
</template> </template>
<style scoped> <style scoped>
.header { .header {
padding: 8px; max-width: 1600px;
max-width: 2000px;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
} }

View 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>