refactor: 优化网站页面结构和数据展示

- 增强服务数据模型,添加 challenges 和 outcomes 字段
- 简化统计数据配置,改为静态定义
- 重构多个页面组件,优化代码结构
- 新增产品、服务、解决方案相关的布局和组件
- 更新样式和动画配置
- 优化测试用例和类型定义
- 修复 ESLint 错误:移除不必要的 useEffect 和未使用的导入
This commit is contained in:
张翔
2026-04-25 08:44:23 +08:00
parent 9650e56dcf
commit 40384ec024
77 changed files with 3751 additions and 1226 deletions
+43 -8
View File
@@ -13,9 +13,28 @@ import { useFocusTrap } from '@/hooks/use-focus-trap';
function HeaderContent() {
const [isOpen, setIsOpen] = useState(false);
const [isScrolled, setIsScrolled] = useState(false);
const [headerTheme, setHeaderTheme] = useState<'light' | 'dark'>('light');
const pathname = usePathname();
const focusTrapRef = useFocusTrap<HTMLDivElement>(isOpen);
// 监听 data-header-theme 属性变化(产品落地页控制导航栏颜色)
useEffect(() => {
const handleThemeChange = () => {
const theme = document.documentElement.getAttribute('data-header-theme');
setHeaderTheme(theme === 'dark' ? 'dark' : 'light');
};
handleThemeChange();
const observer = new MutationObserver(handleThemeChange);
observer.observe(document.documentElement, {
attributes: true,
attributeFilter: ['data-header-theme'],
});
return () => observer.disconnect();
}, []);
useEffect(() => {
const handleScroll = () => {
setIsScrolled(window.scrollY > 20);
@@ -72,9 +91,13 @@ function HeaderContent() {
className={`
fixed top-0 left-0 right-0 z-50
transition-all duration-300 ease-out
${isScrolled
? 'bg-white/95 backdrop-blur-xl border-b border-[#E2E8F0] shadow-sm'
: 'bg-transparent'
${headerTheme === 'dark'
? isScrolled
? 'bg-[#0A0A0A]/90 backdrop-blur-xl border-b border-[#1A1A1A]'
: 'bg-transparent'
: isScrolled
? 'bg-white/95 backdrop-blur-xl border-b border-[#E2E8F0] shadow-sm'
: 'bg-transparent'
}
`}
>
@@ -86,7 +109,7 @@ function HeaderContent() {
aria-label="返回首页"
>
<Image
src="/logo.svg"
src={headerTheme === 'dark' ? '/logo-white.svg' : '/logo.svg'}
alt={COMPANY_INFO.name}
width={128}
height={32}
@@ -105,9 +128,13 @@ function HeaderContent() {
className={`
relative px-3 py-1.5 text-sm font-medium
transition-all duration-300
${isActive(item)
? 'text-[#1C1C1C]'
: 'text-[#3D3D3D] hover:text-[#1C1C1C]'
${headerTheme === 'dark'
? isActive(item)
? 'text-white'
: 'text-[#B0B0B0] hover:text-white'
: isActive(item)
? 'text-[#1C1C1C]'
: 'text-[#3D3D3D] hover:text-[#1C1C1C]'
}
`}
aria-current={isActive(item) ? 'page' : undefined}
@@ -130,6 +157,8 @@ function HeaderContent() {
<div className="hidden md:flex items-center gap-3">
<Button
size="sm"
variant={headerTheme === 'dark' ? 'outline' : 'default'}
className={headerTheme === 'dark' ? 'border-white/30 text-white hover:bg-white/10 hover:text-white' : ''}
asChild
>
<StaticLink href="/contact" data-testid="consult-button"></StaticLink>
@@ -137,7 +166,13 @@ function HeaderContent() {
</div>
<button
className="md:hidden p-3 -mr-3 text-[#3D3D3D] hover:text-[#1C1C1C] hover:bg-[#F5F5F5] rounded-lg transition-all duration-200 active:scale-95"
className={`
md:hidden p-3 -mr-3 rounded-lg transition-all duration-200 active:scale-95
${headerTheme === 'dark'
? 'text-white hover:bg-white/10'
: 'text-[#3D3D3D] hover:text-[#1C1C1C] hover:bg-[#F5F5F5]'
}
`}
onClick={() => setIsOpen(!isOpen)}
onKeyDown={handleKeyDown}
aria-expanded={isOpen}