1) 版本对齐分支 - package.json / tauri.conf.json / Cargo.toml / Cargo.lock: 0.1.0 -> 0.2.0, OTA 包版本变为 0.2.0-ota - 新增 scripts/ci/check-version.mjs: 分支 dev-x.y 与 package.json 版本不一致时 CI 直接失败 - docker-build.yml / ota-build.yml: min_binary_version 与前端版本解耦, 固定 0.1.0 (现有 APK 原生层仍是 0.1.0, 抬高会导致旧 APK 收不到更新) 2) 我的页 OTA「开发版本」开关 (默认关, 持久化 localStorage.iboard_ota_dev_mode) - 关: 按版本号逐字段比较 (src/utils/version.js), 服务端 version 更高才算新 - 开: 按 build sequence 判新 (hotswap checkUpdate), 每次构建都能推到设备 - Web 端: 开发口径退化为版本不同即算新; 生产口径严格比较大小 3) 打卡 Tab 移到最左并默认选中, 移除特效开关 - BottomNav: 打卡/宏观/监控/我; 删除 home 图标 - App: / 与 404 均重定向到 /checkin - RingProgress/Celebrate: 删除 effectsEnabled/setEffectsEnabled, 特效恒开 - HabitView: 去掉头部「特效开/关」按钮 4) 取消首页 Tab, 报警/新闻并入宏观 - 新增 pages/macro/AlertsView.jsx、NewsView.jsx; 删除 HomePage.jsx - MacroPage: 6 个子 Tab (油价/经济数据/策略研究/经济文章/报警/新闻), 报警角标保留 - 新闻详情 /news/:id -> /macro/news/:id (宏观 Tab 保持高亮) 5) 文档: 需求文档补 F-OT 需求点与已决策项; 设计文档新增 §10 变更记录与判新设计; 界面设计.html 11 屏 (Tab 4 项/去掉特效开关/宏观合并/我的 OTA 开关 关+开 两态)
90 lines
3.5 KiB
React
90 lines
3.5 KiB
React
import { useState } from 'react'
|
|
import { useNavigate, useLocation, Routes, Route } from 'react-router-dom'
|
|
import { Badge, NavBar } from 'antd-mobile'
|
|
import SwipeTabs from '../components/SwipeTabs.jsx'
|
|
import DataView from './macro/DataView.jsx'
|
|
import StrategyView from './macro/StrategyView.jsx'
|
|
import ArticlesView from './macro/ArticlesView.jsx'
|
|
import ArticleDetail from './macro/ArticleDetail.jsx'
|
|
import OilPage from './macro/OilPage.jsx'
|
|
import AlertsView from './macro/AlertsView.jsx'
|
|
import NewsView from './macro/NewsView.jsx'
|
|
import NewsDetail from './news/NewsDetail.jsx'
|
|
|
|
// 宏观: 顶栏 6 tab, 默认 油价
|
|
// /macro → 显示 oil tab (本组件 activeFromPath 决定)
|
|
// /macro/oil → 油价
|
|
// /macro/data → 经济数据
|
|
// /macro/strategy → 策略研究
|
|
// /macro/articles → 经济文章
|
|
// /macro/alerts → 报警 (V0.2: 原「首页」tab 合并进来)
|
|
// /macro/news → 新闻 (V0.2: 原「首页」tab 合并进来)
|
|
// 详情: /macro/data/:name · /macro/strategy/:name · /macro/articles/:slug · /macro/news/:id
|
|
const TABS = [
|
|
{ key: 'oil', label: '油价', path: '/macro/oil' },
|
|
{ key: 'data', label: '经济数据', path: '/macro/data' },
|
|
{ key: 'strategy', label: '策略研究', path: '/macro/strategy' },
|
|
{ key: 'articles', label: '经济文章', path: '/macro/articles' },
|
|
{ key: 'alerts', label: '报警', path: '/macro/alerts' },
|
|
{ key: 'news', label: '新闻', path: '/macro/news' },
|
|
]
|
|
|
|
function activeFromPath(pathname) {
|
|
if (pathname.startsWith('/macro/oil')) return 'oil'
|
|
if (pathname.startsWith('/macro/articles')) return 'articles'
|
|
if (pathname.startsWith('/macro/strategy')) return 'strategy'
|
|
if (pathname.startsWith('/macro/data')) return 'data'
|
|
if (pathname.startsWith('/macro/alerts')) return 'alerts'
|
|
if (pathname.startsWith('/macro/news')) return 'news'
|
|
// 父路由 /macro 走 Tab 列表第一个 (油价)
|
|
return 'oil'
|
|
}
|
|
|
|
export default function MacroPage() {
|
|
const location = useLocation()
|
|
const navigate = useNavigate()
|
|
const active = activeFromPath(location.pathname)
|
|
// 报警角标: 由 AlertsView 回传总数
|
|
const [alertCount, setAlertCount] = useState(0)
|
|
|
|
const tabs = TABS.map((t) => ({
|
|
key: t.key,
|
|
label: t.key === 'alerts'
|
|
? <span className="tab-label">报警{alertCount > 0 && <Badge content={alertCount} />}</span>
|
|
: t.label,
|
|
render: () => {
|
|
if (t.key === 'oil') return <OilPage />
|
|
if (t.key === 'data') return <DataView />
|
|
if (t.key === 'strategy') return <StrategyView />
|
|
if (t.key === 'articles') return <ArticlesView />
|
|
if (t.key === 'alerts') return <AlertsView onCount={setAlertCount} />
|
|
if (t.key === 'news') return <NewsView />
|
|
return null
|
|
},
|
|
}))
|
|
|
|
function onChange(key) {
|
|
const next = TABS.find((t) => t.key === key)
|
|
if (next) navigate(next.path)
|
|
}
|
|
|
|
// 详情页单独走 React Router 渲染, 不参与滑屏
|
|
if (location.pathname.match(/^\/macro\/(articles|data|strategy|news)\/[^/]+$/)) {
|
|
return (
|
|
<Routes>
|
|
<Route path="data/:name" element={<DataView />} />
|
|
<Route path="strategy/:name" element={<StrategyView />} />
|
|
<Route path="articles/:slug" element={<ArticleDetail />} />
|
|
<Route path="news/:id" element={<NewsDetail />} />
|
|
</Routes>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<div className="page-with-navbar">
|
|
<NavBar back={null} />
|
|
<SwipeTabs tabs={tabs} active={active} onChange={onChange} />
|
|
</div>
|
|
)
|
|
}
|