From 18b92e54524468f46250a4a8cbdbe2038b32ff67 Mon Sep 17 00:00:00 2001 From: yanlongqi Date: Wed, 5 Nov 2025 11:23:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E7=AD=94=E9=A2=98=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E5=AF=BC=E8=88=AA=E5=92=8C=E8=BF=9B=E5=BA=A6=E6=9D=A1?= =?UTF-8?q?=E6=95=B4=E5=90=88=E5=B9=B6=E5=9B=BA=E5=AE=9A=E5=9C=A8=E9=A1=B6?= =?UTF-8?q?=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 主要更改: - 整合导航和进度条:将两者放在同一个卡片中,避免重复的卡片边框,提升美观性 - 固定顶栏:顶部导航和进度条固定在页面顶部,滚动时始终可见 - 移动端优化:调整返回按钮位置和布局顺序,优化小屏幕显示效果 - 进度条组件简化:移除 Card 包裹,直接渲染 Progress 组件 - 响应式布局:为固定顶栏预留合适的空间,移动端、平板、PC端各自适配 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- web/src/components/QuestionProgress.tsx | 43 ++++------- web/src/pages/Login.tsx | 7 +- web/src/pages/Question.module.less | 95 +++++++++++++++++++------ web/src/pages/Question.tsx | 68 ++++++++++-------- 4 files changed, 133 insertions(+), 80 deletions(-) diff --git a/web/src/components/QuestionProgress.tsx b/web/src/components/QuestionProgress.tsx index 2ea9232..86699c0 100644 --- a/web/src/components/QuestionProgress.tsx +++ b/web/src/components/QuestionProgress.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { Progress, Card } from 'antd' +import { Progress } from 'antd' interface QuestionProgressProps { currentIndex: number @@ -17,34 +17,21 @@ const QuestionProgress: React.FC = ({ const percent = Math.round(((currentIndex + 1) / totalQuestions) * 100) return ( - - `${currentIndex + 1} / ${totalQuestions}`} - style={{ - fontSize: '14px', - fontWeight: 600, - }} - /> - + trailColor="rgba(0, 0, 0, 0.06)" + strokeWidth={12} + format={() => `${currentIndex + 1} / ${totalQuestions}`} + style={{ + fontSize: '14px', + fontWeight: 600, + }} + /> ) } diff --git a/web/src/pages/Login.tsx b/web/src/pages/Login.tsx index e965a66..d6b58e4 100644 --- a/web/src/pages/Login.tsx +++ b/web/src/pages/Login.tsx @@ -194,11 +194,14 @@ const Login: React.FC = () => { } - placeholder="请输入昵称(可选)" + placeholder="请输入姓名" /> diff --git a/web/src/pages/Question.module.less b/web/src/pages/Question.module.less index 2a51c58..6fb50e8 100644 --- a/web/src/pages/Question.module.less +++ b/web/src/pages/Question.module.less @@ -1,20 +1,31 @@ .container { min-height: 100vh; background: #fafafa; - padding: 20px; + padding: 0; padding-bottom: 80px; } -.content { - max-width: 900px; - margin: 0 auto; +// 固定顶栏 +.fixedTopBar { + position: fixed; + top: 0; + left: 0; + right: 0; + z-index: 1000; + background: rgba(250, 250, 250, 0.85); + backdrop-filter: blur(40px) saturate(180%); + -webkit-backdrop-filter: blur(40px) saturate(180%); + box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06); + border-bottom: 0.5px solid rgba(0, 0, 0, 0.04); } -.header { - display: flex; - justify-content: space-between; - align-items: center; - margin-bottom: 20px; +.topBarContent { + max-width: 900px; + margin: 0 auto; + padding: 16px 20px; +} + +.topBarCard { background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%); @@ -25,6 +36,20 @@ 0 1px 4px rgba(0, 0, 0, 0.03), 0 0 0 1px rgba(0, 0, 0, 0.03); border: 0.5px solid rgba(0, 0, 0, 0.04); +} + +.content { + max-width: 900px; + margin: 0 auto; + padding: 0 20px; + padding-top: 200px; // 为固定顶栏留出空间 +} + +.header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 16px; .backButton { color: #007aff; @@ -74,6 +99,10 @@ } } +.progressWrapper { + // 进度条容器 +} + .questionCard { border-radius: 20px; background: rgba(255, 255, 255, 0.95); @@ -121,19 +150,33 @@ // 响应式设计 - 移动端 @media (max-width: 768px) { .container { - padding: 12px; padding-bottom: 70px; } + .topBarContent { + padding: 12px; + } + + .topBarCard { + padding: 12px 16px; + border-radius: 12px; + } + + .content { + padding: 0 12px; + padding-top: 240px; // 移动端顶栏更高 + } + .header { flex-wrap: wrap; - gap: 12px; - padding: 12px 16px; - border-radius: 12px; + gap: 10px; + margin-bottom: 12px; .backButton { order: 1; flex: 0 0 auto; + font-size: 14px; + padding: 4px 8px; } .title { @@ -141,18 +184,21 @@ flex: 1 1 100%; text-align: center; font-size: 16px !important; + margin-top: 4px !important; } .statsGroup { order: 3; flex: 1 1 100%; justify-content: center; - gap: 24px; + gap: 32px; + margin-top: 4px; } .statItem { flex-direction: row; gap: 6px; + align-items: center; } .statLabel { @@ -183,8 +229,13 @@ // 响应式设计 - 平板 @media (min-width: 769px) and (max-width: 1024px) { - .container { - padding: 24px; + .topBarContent { + padding: 14px 24px; + } + + .content { + padding: 0 24px; + padding-top: 190px; } .header { @@ -196,14 +247,16 @@ // 响应式设计 - PC端 @media (min-width: 1025px) { - .container { - padding: 32px; + .topBarContent { + padding: 18px 32px; + } + + .content { + padding: 0 32px; + padding-top: 190px; } .header { - margin-bottom: 24px; - padding: 18px 24px; - .title { font-size: 22px !important; } diff --git a/web/src/pages/Question.tsx b/web/src/pages/Question.tsx index ff99473..003c05f 100644 --- a/web/src/pages/Question.tsx +++ b/web/src/pages/Question.tsx @@ -250,40 +250,50 @@ const QuestionPage: React.FC = () => { return (
-
- {/* 头部 */} -
- - - AnKao 刷题 - -
-
- 正确 - {correctCount} + {/* 固定顶栏:包含导航和进度 */} +
+
+
+ {/* 头部导航 */} +
+ + + AnKao 刷题 + +
+
+ 正确 + {correctCount} +
+
+ 错误 + {wrongCount} +
+
-
- 错误 - {wrongCount} + + {/* 进度条 */} +
+
+
- {/* 进度条 */} - - + {/* 主内容区 */} +
{/* 题目卡片 */} {currentQuestion && (