From 5264e65d10f5dbb5f4b423f30cf7639cefe503f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=88=E6=84=BFQiii?= <2297740147@qq.com> Date: Fri, 4 Sep 2026 00:33:42 +0800 Subject: [PATCH] refactor: group site navigation by student tasks --- docs/.vitepress/config.ts | 2 +- docs/.vitepress/nav.ts | 22 +- docs/.vitepress/site-map.ts | 92 +++++ docs/.vitepress/theme/components/HomePage.vue | 233 ++--------- docs/.vitepress/theme/custom.css | 379 +++++++++++------- 5 files changed, 372 insertions(+), 356 deletions(-) create mode 100644 docs/.vitepress/site-map.ts diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index b9af48f..e66f237 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -77,7 +77,7 @@ export default defineConfig({ }, }, editLink: { - pattern: 'https://github.com/pppolf/SCSWiki/edit/main/docs/:path', + pattern: 'https://github.com/CWNU-Open-Source-Community/SCSWiki/edit/main/docs/:path', text: '在 GitHub 上编辑此页', }, footer: { diff --git a/docs/.vitepress/nav.ts b/docs/.vitepress/nav.ts index ff98e13..a62cb82 100644 --- a/docs/.vitepress/nav.ts +++ b/docs/.vitepress/nav.ts @@ -1,18 +1,8 @@ import type { DefaultTheme } from 'vitepress'; +import { siteSections } from './site-map'; -export const nav: DefaultTheme.NavItem[] = [ - { text: '首页', link: '/' }, - { text: '新生专题', link: '/start/', activeMatch: '^/start/' }, - { text: '专业学习', link: '/study/', activeMatch: '^/study/' }, - { text: '学科竞赛', link: '/competitions/', activeMatch: '^/competitions/' }, - { text: '学院组织', link: '/organization/', activeMatch: '^/organization/' }, - { text: '老师专栏', link: '/teacher/', activeMatch: '^/teacher/' }, - { text: '课程专栏', link: '/course/', activeMatch: '^/course/' }, - { text: '资料分享', link: '/materials/', activeMatch: '^/materials/' }, - { text: '党建专题', link: '/party/', activeMatch: '^/party/' }, - { text: '办事指南', link: '/services/', activeMatch: '^/services/' }, - { text: '校园生活', link: '/campus/', activeMatch: '^/campus/' }, - { text: '关于与贡献', link: '/about/', activeMatch: '^/about/' }, - { text: '常见问题', link: '/faq/', activeMatch: '^/faq/' }, - { text: '赞助', link: '/sponsor/', activeMatch: '^/sponsor/' }, -]; +export const nav: DefaultTheme.NavItem[] = siteSections.map((section) => ({ + activeMatch: section.activeMatch, + items: section.links.map((link) => ({ link: link.href, text: link.title })), + text: section.title, +})); diff --git a/docs/.vitepress/site-map.ts b/docs/.vitepress/site-map.ts new file mode 100644 index 0000000..e37ce25 --- /dev/null +++ b/docs/.vitepress/site-map.ts @@ -0,0 +1,92 @@ +export type SiteSectionLink = { + href: string; + title: string; +}; + +export type SiteSection = { + activeMatch: string; + description: string; + index: string; + links: SiteSectionLink[]; + primaryHref: string; + title: string; +}; + +export const siteSections: SiteSection[] = [ + { + activeMatch: '^/start/', + description: '从报到准备到入学适应,按新生真实任务组织信息。', + index: '01', + links: [ + { href: '/start/', title: '新生总览' }, + { href: '/start/online-registration', title: '报到与迎新' }, + { href: '/start/payment', title: '学杂费缴费' }, + { href: '/start/financial-aid', title: '学生资助' }, + { href: '/start/faq', title: '新生问答' }, + ], + primaryHref: '/start/', + title: '新生指南', + }, + { + activeMatch: '^/(study|course|materials)/', + description: '整合专业学习、培养方案、选课与课程资料。', + index: '02', + links: [ + { href: '/study/', title: '专业学习' }, + { href: '/course/', title: '培养方案与选课' }, + { href: '/materials/', title: '课程资料' }, + ], + primaryHref: '/study/', + title: '学业与课程', + }, + { + activeMatch: '^/(competitions|development|research|career)/', + description: '连接竞赛、开发、科研实践与升学就业。', + index: '03', + links: [ + { href: '/competitions/', title: '学科竞赛' }, + { href: '/development/', title: '开发与工具' }, + { href: '/research/', title: '科研与项目' }, + { href: '/career/', title: '升学与就业' }, + ], + primaryHref: '/competitions/', + title: '成长与实践', + }, + { + activeMatch: '^/(campus|services|party)/', + description: '集中校园生活、日常办事和党团事务入口。', + index: '04', + links: [ + { href: '/campus/', title: '校园生活' }, + { href: '/services/', title: '办事指南' }, + { href: '/party/', title: '党团事务' }, + ], + primaryHref: '/campus/', + title: '校园与办事', + }, + { + activeMatch: '^/(organization|teacher)/', + description: '查询学院概况、组织架构与教师课程参考。', + index: '05', + links: [ + { href: '/organization/', title: '学院概况与组织' }, + { href: '/teacher/', title: '教师专栏' }, + ], + primaryHref: '/organization/', + title: '学院信息', + }, + { + activeMatch: '^/(about|faq|sponsor)/', + description: '了解内容边界,并参与纠错、贡献和赞助。', + index: '06', + links: [ + { href: '/about/', title: '项目介绍' }, + { href: '/about/trust', title: '可信度与内容边界' }, + { href: '/about/contribute', title: '参与贡献' }, + { href: '/faq/', title: '帮助与纠错' }, + { href: '/sponsor/', title: '赞助鸣谢' }, + ], + primaryHref: '/about/', + title: '关于本站', + }, +]; diff --git a/docs/.vitepress/theme/components/HomePage.vue b/docs/.vitepress/theme/components/HomePage.vue index a62ec2f..0f2cc49 100644 --- a/docs/.vitepress/theme/components/HomePage.vue +++ b/docs/.vitepress/theme/components/HomePage.vue @@ -1,6 +1,7 @@