import { useEffect, useState } from 'react' import { useLocation } from 'react-router' const PAGE_META: Record = { '/': { title: '发现商机', sub: '检索招投标项目,浏览事实与简要分析' }, '/watch': { title: '重点关注', sub: '记录跟进情况,回看公告与继续分析' }, '/research': { title: '对话调研', sub: '研究客户、竞争对手与区域市场' }, '/profile': { title: '公司档案', sub: '让建议贴合公司实际能力' }, } export default function Topbar() { const { pathname } = useLocation() const meta = PAGE_META[pathname] ?? PAGE_META['/'] const [now, setNow] = useState(new Date()) useEffect(() => { const t = window.setInterval(() => setNow(new Date()), 30000) return () => window.clearInterval(t) }, []) // 页面标注北京时间,不能直接使用访问者设备的本地时区。 const clock = new Intl.DateTimeFormat('sv-SE', { timeZone: 'Asia/Shanghai', year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', hour12: false }).format(now) return (

{meta.title}

{meta.sub}

北京时间 {clock}
) }