From 08af61d0091bd65e0c6d9eeab05b26dcd97d09b8 Mon Sep 17 00:00:00 2001 From: zhangjing1 Date: Fri, 27 Mar 2026 10:17:47 +0800 Subject: [PATCH] =?UTF-8?q?fix(home):=20=E5=AF=BC=E8=88=AA=E6=A0=8F?= =?UTF-8?q?=E5=9F=8E=E5=B8=82=E4=BC=98=E5=85=88=E5=B1=95=E7=A4=BA=20LBS=20?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - nearbyText 改为先取 location 市/省,再退回收货地址城市,避免默认北京盖住当前定位 - home-header 去掉硬编码昌平默认文案,改为详细地址或省市区拼接 Made-with: Cursor --- src/pages/custom/custom-page.js | 3 ++- src/pages/home/wgts/home-header.js | 6 +++++- src/pages/index.js | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/pages/custom/custom-page.js b/src/pages/custom/custom-page.js index 210e41c18..b983804f9 100644 --- a/src/pages/custom/custom-page.js +++ b/src/pages/custom/custom-page.js @@ -43,7 +43,8 @@ function CustomPage(props) { const loginRef = useRef() const router = useRouter() const { location, address } = useSelector((state) => state.user) - const nearbyText = address?.city || location?.city || '' + const nearbyText = + location?.city || location?.province || address?.city || '' useEffect(() => { fetch() diff --git a/src/pages/home/wgts/home-header.js b/src/pages/home/wgts/home-header.js index b59386cb0..17b47ccda 100644 --- a/src/pages/home/wgts/home-header.js +++ b/src/pages/home/wgts/home-header.js @@ -46,7 +46,11 @@ function WgtHomeHeader(props) { } }} > - {location?.address || '北京市北京市昌平区'} + + {location?.address || + [location?.province, location?.city, location?.district].filter(Boolean).join('') || + '选择地区'} + )} diff --git a/src/pages/index.js b/src/pages/index.js index 4c13d983e..0bc85c5ce 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -90,7 +90,9 @@ function Home() { const showAdv = useSelector((member) => member.user.showAdv) const { location, address } = useSelector((state) => state.user) - const nearbyText = address?.city || location?.city || '' + /** 导航栏城市:优先跟随 LBS 定位,与「选择商家」页一致;勿用收货地址盖住当前定位 */ + const nearbyText = + location?.city || location?.province || address?.city || '' const { setNavigationBarTitle } = useNavigation() const { updateAddress } = useLocation() const locationKeyRef = useRef('')