From 551e932b5c0feed17e58e799a47d71d97aeab009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Sun, 6 Jul 2025 12:16:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BD=91=E7=AB=99=E5=BA=95?= =?UTF-8?q?=E9=83=A8=E3=80=81=E8=A7=A3=E5=86=B3=E5=B1=85=E4=B8=AD=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/layout/index.ts | 3 +- src/app/globals.css | 1 - src/components/layout/Footer.tsx | 336 +++++++++++++++---------------- 3 files changed, 166 insertions(+), 174 deletions(-) diff --git a/src/api/layout/index.ts b/src/api/layout/index.ts index 0dcd38e..39d5f8b 100644 --- a/src/api/layout/index.ts +++ b/src/api/layout/index.ts @@ -43,7 +43,8 @@ export async function getNavigations(position?: number): Promise { - const { siteInfo, bottomNavs } = useSiteInfoValue(); - const currentYear = new Date().getFullYear(); + const {siteInfo, bottomNavs} = useSiteInfoValue(); + const currentYear = new Date().getFullYear(); - // 按父级分组底部导航 - const groupedNavs = bottomNavs.reduce((groups: Record, nav: CmsNavigation) => { - if (nav.parentId === 0) { - // 顶级菜单作为分组标题 - groups[nav.title || 'default'] = bottomNavs.filter((child: CmsNavigation) => child.parentId === nav.navigationId); - } - return groups; - }, {}); + // 按父级分组底部导航 + const groupedNavs = bottomNavs.reduce((groups: Record, nav: CmsNavigation) => { + if (nav.parentId === 0) { + // 顶级菜单作为分组标题 + groups[nav.title || 'default'] = bottomNavs.filter((child: CmsNavigation) => child.parentId === nav.navigationId); + } + return groups; + }, {}); - // 如果没有底部导航数据,显示默认的静态菜单 - const defaultFooterLinks = { - '产品服务': [ - { title: '网站建设', path: '/products/website' }, - { title: '移动应用', path: '/products/mobile' }, - { title: '系统开发', path: '/products/system' }, - { title: '电商平台', path: '/products/ecommerce' }, - ], - '解决方案': [ - { title: '企业数字化', path: '/solutions/digital' }, - { title: '教育信息化', path: '/solutions/education' }, - { title: '智慧城市', path: '/solutions/smart-city' }, - { title: '工业互联网', path: '/solutions/industry' }, - ], - '技术支持': [ - { title: '技术文档', path: '/docs' }, - { title: '开发指南', path: '/guide' }, - { title: 'API参考', path: '/api' }, - { title: '常见问题', path: '/faq' }, - ], - '关于我们': [ - { title: '公司介绍', path: '/about' }, - { title: '新闻动态', path: '/news' }, - { title: '招聘信息', path: '/careers' }, - { title: '联系我们', path: '/contact' }, - ], - }; + // 如果没有底部导航数据,显示默认的静态菜单 + const defaultFooterLinks = { + '产品服务': [ + {title: '网站建设', path: '/products/website'}, + {title: '移动应用', path: '/products/mobile'}, + {title: '系统开发', path: '/products/system'}, + {title: '电商平台', path: '/products/ecommerce'}, + ], + '解决方案': [ + {title: '企业数字化', path: '/solutions/digital'}, + {title: '教育信息化', path: '/solutions/education'}, + {title: '智慧城市', path: '/solutions/smart-city'}, + {title: '工业互联网', path: '/solutions/industry'}, + ], + '技术支持': [ + {title: '技术文档', path: '/docs'}, + {title: '开发指南', path: '/guide'}, + {title: 'API参考', path: '/api'}, + {title: '常见问题', path: '/faq'}, + ], + '关于我们': [ + {title: '公司介绍', path: '/about'}, + {title: '新闻动态', path: '/news'}, + {title: '招聘信息', path: '/careers'}, + {title: '联系我们', path: '/contact'}, + ], + }; - // 使用接口数据或默认数据 - const footerLinks = Object.keys(groupedNavs).length > 0 ? groupedNavs : defaultFooterLinks; - console.log(footerLinks,'footerLinks') + // 使用接口数据或默认数据 + const footerLinks = Object.keys(groupedNavs).length > 0 ? groupedNavs : defaultFooterLinks; - return ( -
- -
- {/* 网站信息 */} -
-
- {siteInfo?.websiteLogo && ( - {siteInfo.websiteName - )} - {/**/} - {/* {siteInfo?.websiteName || '网站名称'}*/} - {/**/} -
+ return ( +
+ +
+
+ {/* 网站信息 */} +
+
+ {siteInfo?.websiteLogo && ( + {siteInfo.websiteName + )} +
- {siteInfo?.comments && ( -

- {siteInfo.comments} -

- )} +
+ {siteInfo?.phone && ( +
+ + + + {siteInfo.phone} +
+ )} -
- {siteInfo?.phone && ( -
- - - - {siteInfo.phone} -
- )} + {siteInfo?.email && ( +
+ + + + + {siteInfo.email} +
+ )} - {siteInfo?.email && ( -
- - - - - {siteInfo.email} -
- )} + {siteInfo?.address && ( +
+ + + + {siteInfo.address} +
+ )} +
+
- {siteInfo?.address && ( -
- - - - {siteInfo.address} + {/* 动态底部导航菜单 */} + {Object.entries(footerLinks).map(([groupTitle, links]) => ( +
+

{groupTitle}

+
    + {links.map((link: CmsNavigation | { title: string; path: string }, index: number) => ( +
  • + + {link.title} + +
  • + ))} +
+
+ ))}
- )} -
-
- - {/* 动态底部导航菜单 */} - {Object.entries(footerLinks).map(([groupTitle, links]) => ( -
-

{groupTitle}

-
    - {links.map((link: CmsNavigation | { title: string; path: string }, index: number) => ( -
  • - - {link.title} - -
  • - ))} -
-
- ))} -
+ {/* 底部版权信息 */} +
+
+
+

+ © {currentYear} {siteInfo?.websiteName || '网站名称'} 保留所有权利 +

+ {siteInfo?.icpNo && ( +

+ + {siteInfo.icpNo} + +

+ )} + {siteInfo?.policeNo && ( +

+ + {siteInfo.policeNo} + +

+ )} +
- {/* 底部版权信息 */} -
-
-
-

- © {currentYear} {siteInfo?.websiteName || '网站名称'}. 保留所有权利. -

- {siteInfo?.icpNo && ( -

- - {siteInfo.icpNo} - -

- )} - {siteInfo?.policeNo && ( -

- - {siteInfo.policeNo} - -

- )} -
- - {/* 社交媒体链接 */} - -
-
- -
- ); + {/* 社交媒体链接 */} +
+ + + + + + + + + + +
+ + +
+ + + ); }; export default Footer;