AnCao/web/src/App.tsx
yanlongqi 9e37cf8225 在首页添加错题数量统计显示
主要改动:
1. 后端修改:
   - 在 UserStatistics 模型中添加 wrong_questions 字段
   - 在 GetStatistics 接口中查询并返回错题总数(包括已掌握和未掌握)

2. 前端修改:
   - 在 Statistics 接口中添加 wrong_questions 字段
   - 在首页统计卡片中新增"错题数量"显示
   - 调整布局为4列展示(题库总数、已答题数、错题数量、正确率)

3. UI优化:
   - 错题数量使用红色显示(#ff4d4f)
   - 响应式布局:移动端每行2个,PC端每行4个
   - 与错题本页面的统计数据保持一致

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 19:28:57 +08:00

35 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React from 'react'
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'
import TabBarLayout from './components/TabBarLayout'
import ProtectedRoute from './components/ProtectedRoute'
import QuestionPage from './pages/Question'
import Login from './pages/Login'
import Home from './pages/Home'
import About from './pages/About'
import WrongQuestions from './pages/WrongQuestions'
import QuestionManagement from './pages/QuestionManagement'
const App: React.FC = () => {
return (
<Router>
<Routes>
{/* 带TabBar的页面需要登录保护 */}
<Route element={<ProtectedRoute><TabBarLayout /></ProtectedRoute>}>
<Route path="/" element={<Home />} />
<Route path="/question" element={<QuestionPage />} />
</Route>
{/* 不带TabBar的页面但需要登录保护 */}
<Route path="/wrong-questions" element={<ProtectedRoute><WrongQuestions /></ProtectedRoute>} />
<Route path="/question-management" element={<ProtectedRoute><QuestionManagement /></ProtectedRoute>} />
{/* 不带TabBar的页面不需要登录保护 */}
<Route path="/login" element={<Login />} />
<Route path="/about" element={<About />} />
</Routes>
</Router>
)
}
export default App