|
|
@ -3,17 +3,17 @@ import Link from 'next/link'; |
|
|
|
import Image from 'next/image'; |
|
|
|
import { useSiteInfoValue } from '@/hooks/useSiteInfo'; |
|
|
|
import { CmsNavigation } from '@/api/cms/cmsNavigation/model'; |
|
|
|
import Container from '@/components/layout/Container'; |
|
|
|
|
|
|
|
const Footer = () => { |
|
|
|
const { siteInfo, bottomNavs, isLoaded, isNavsLoaded } = useSiteInfoValue(); |
|
|
|
const { siteInfo, bottomNavs } = useSiteInfoValue(); |
|
|
|
const currentYear = new Date().getFullYear(); |
|
|
|
console.log(bottomNavs,'bottomNavs') |
|
|
|
|
|
|
|
// 按父级分组底部导航
|
|
|
|
const groupedNavs = bottomNavs.reduce((groups: Record<string, CmsNavigation[]>, nav) => { |
|
|
|
const groupedNavs = bottomNavs.reduce((groups: Record<string, CmsNavigation[]>, nav: CmsNavigation) => { |
|
|
|
if (nav.parentId === 0) { |
|
|
|
// 顶级菜单作为分组标题
|
|
|
|
groups[nav.title || 'default'] = bottomNavs.filter(child => child.parentId === nav.navigationId); |
|
|
|
groups[nav.title || 'default'] = bottomNavs.filter((child: CmsNavigation) => child.parentId === nav.navigationId); |
|
|
|
} |
|
|
|
return groups; |
|
|
|
}, {}); |
|
|
@ -52,7 +52,7 @@ const Footer = () => { |
|
|
|
|
|
|
|
return ( |
|
|
|
<footer className="bg-gray-900 text-white"> |
|
|
|
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12"> |
|
|
|
<Container className="py-12"> |
|
|
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-8"> |
|
|
|
{/* 网站信息 */} |
|
|
|
<div className="lg:col-span-1"> |
|
|
@ -113,15 +113,15 @@ const Footer = () => { |
|
|
|
<div key={groupTitle}> |
|
|
|
<h3 className="text-lg font-semibold mb-4">{groupTitle}</h3> |
|
|
|
<ul className="space-y-2"> |
|
|
|
{links.map((link: any, index: number) => ( |
|
|
|
{links.map((link: CmsNavigation | { title: string; path: string }, index: number) => ( |
|
|
|
<li key={index}> |
|
|
|
<Link |
|
|
|
href={link.path || link.href || '#'} |
|
|
|
href={link.path || '#'} |
|
|
|
className="text-gray-400 hover:text-white transition-colors duration-200 text-sm" |
|
|
|
target={link.target === '_blank' ? '_blank' : undefined} |
|
|
|
rel={link.target === '_blank' ? 'noopener noreferrer' : undefined} |
|
|
|
target={'target' in link && link.target === '_blank' ? '_blank' : undefined} |
|
|
|
rel={'target' in link && link.target === '_blank' ? 'noopener noreferrer' : undefined} |
|
|
|
> |
|
|
|
{link.title || link.name} |
|
|
|
{link.title} |
|
|
|
</Link> |
|
|
|
</li> |
|
|
|
))} |
|
|
@ -183,7 +183,7 @@ const Footer = () => { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</Container> |
|
|
|
</footer> |
|
|
|
); |
|
|
|
}; |
|
|
|