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('')