From f06bb063b44cfc63dc523dfc9df66d85387e20af Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Tue, 3 Nov 2026 09:36:41 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=A1=B6=E6=A0=8F):=20=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E6=9C=80=E5=B7=A6=E8=BE=B9=E5=8A=A0=E3=80=8C=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E3=80=8D=EF=BC=8C=E5=92=8C=E7=82=B9=E7=AB=99=E5=90=8D=E4=B8=80?= =?UTF-8?q?=E6=A0=B7=E5=9B=9E=E5=88=B0=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 没登录时不显示:那时首页就是题目列表,和「题目」是同一页。 Co-Authored-By: Claude Opus 5.5 --- apps/web/src/shared/components/Header.vue | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/web/src/shared/components/Header.vue b/apps/web/src/shared/components/Header.vue index 7910f84..5e63917 100644 --- a/apps/web/src/shared/components/Header.vue +++ b/apps/web/src/shared/components/Header.vue @@ -53,8 +53,8 @@ const envVersion = computed(() => { }) // 一级路径就是菜单 key,对不上的页面(/user、/achievement 等) -// 自然没有一项亮着。根路径没登录时就是题目列表,登录了是个人首页,不亮任何一项 -const active = computed(() => route.path.split('/')[1] || (userStore.isAuthed ? '' : 'problem')) +// 自然没有一项亮着。根路径没登录时就是题目列表(亮「题目」),登录了是个人首页(亮「首页」) +const active = computed(() => route.path.split('/')[1] || (userStore.isAuthed ? 'home' : 'problem')) async function handleLogout() { await userStore.signOut() @@ -80,7 +80,8 @@ function renderIcon(icon: string) { * 顶栏导航的唯一一张表:桌面端渲染成一排纯文字,窄屏收进「菜单」下拉。 * `key` 就是一级路径,用来判定高亮(见上面的 active)。 * - * 顺序是 自学 / 题目 / 提交 / 专题 / 比赛 / 排名 / 公告。「自学」进自学首页(/learn), + * 顺序是 首页 / 自学 / 题目 / 提交 / 专题 / 比赛 / 排名 / 公告。「首页」只给登录了的:没登录时根路径 + * 就是题目列表,和「题目」是同一页(2026-11-03 用户要的,原来只能点左上角的站名回首页)。「自学」进自学首页(/learn), * 两门课、接着学哪一课都在那儿挑,不再是下拉。提交留在一级:学生天天回来看自己交的结果,老师课上翻全班代码也走它。 * 公告 2026-10-13 回到顶栏(用户要的):首页只放置顶那条了,别的公告得有个地方点得到。 * 不用 n-menu:它横排每项固定占 100px,1280 宽的机房屏上会把顶栏挤成两行。 @@ -94,6 +95,7 @@ interface NavLink { const navLinks = computed(() => [ + { key: 'home', label: '首页', to: '/', show: userStore.isAuthed }, { key: 'learn', label: '自学', to: '/learn' }, { key: 'problem', label: '题目', to: '/problem' }, { key: 'submission', label: '提交', to: '/submission', show: userStore.showSubmissions },