From b9376dfeecf510fc009e9364b945629a47d2cffc Mon Sep 17 00:00:00 2001 From: Rei Date: Wed, 9 Sep 2026 12:46:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E6=9C=BA=E7=AB=AF=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E7=B3=BB=E7=BB=9F=E5=AF=BC=E8=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cms/server/src/seed.js | 2 +- src/components/Layout/Footer.tsx | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/cms/server/src/seed.js b/cms/server/src/seed.js index 679a585..48c1be0 100644 --- a/cms/server/src/seed.js +++ b/cms/server/src/seed.js @@ -118,7 +118,7 @@ const siteTexts = [ ['footer.action_title', '页脚行动入口标题', '行动入口'], ['footer.copyright', '页脚版权信息', '© 2026 成都阿美巴企业管理咨询有限公司 | aiameiba.com · ameiba.cn'], ['footer.address_title', '页脚地址标题', '公司地址'], - ['footer.navigate_label', '页脚导航链接文案', '打开高德地图导航'], + ['footer.navigate_label', '页脚导航链接文案', '打开地图导航'], ['footer.qr_title', '页脚二维码区域标题', '关注我们'], ['footer.xcx_qr_label', '页脚微信小程序二维码标签', '微信小程序'], ['footer.fwh_qr_label', '页脚微信服务号二维码标签', '微信服务号'], diff --git a/src/components/Layout/Footer.tsx b/src/components/Layout/Footer.tsx index 6544498..4021e0a 100644 --- a/src/components/Layout/Footer.tsx +++ b/src/components/Layout/Footer.tsx @@ -1,4 +1,5 @@ import { Link } from 'react-router-dom' +import type { MouseEvent } from 'react' import { PRIMARY_NAV } from '@/data/nav' import { getCMSConfig, useCMS, useCMSTexts } from '@/services/cms' @@ -9,7 +10,20 @@ export default function Footer() { const phoneLink = hotline.replace(/[^\d+]/g, '') const companyName = texts['footer.company'] || '成都阿美巴企业管理咨询有限公司' const address = String(config?.contact_address || '四川省成都市双流区正兴街道湖畔路北段366号1栋3楼1号').trim() - const amapLink = `https://uri.amap.com/search?keyword=${encodeURIComponent(`${companyName} ${address}`)}&city=${encodeURIComponent('成都')}&view=map&callnative=1&src=ameiba` + // Desktop falls back to AMap's web search. On phones use the operating system's + // map-navigation scheme so the user's installed/default map app handles the route. + const amapLink = `https://uri.amap.com/search?keyword=${encodeURIComponent(address)}&city=${encodeURIComponent('成都')}&view=map&src=ameiba` + const openNavigation = (event: MouseEvent) => { + const ua = window.navigator.userAgent + const destination = encodeURIComponent(address) + if (/Android/i.test(ua)) { + event.preventDefault() + window.location.href = `geo:0,0?q=${destination}` + } else if (/iPhone|iPad|iPod/i.test(ua)) { + event.preventDefault() + window.location.href = `maps://?q=${destination}` + } + } return (