列表页获取位置信息
This commit is contained in:
@@ -12,12 +12,13 @@ import ListContainer from "@/container/listContainer";
|
||||
import DistanceQuickFilter from "@/components/DistanceQuickFilter";
|
||||
import { withAuth } from "@/components";
|
||||
// import img from "@/config/images";
|
||||
// import ShareCardCanvas from "@/components/ShareCardCanvas/example";
|
||||
|
||||
const ListPage = () => {
|
||||
// 从 store 获取数据和方法
|
||||
const store = useListStore() || {};
|
||||
|
||||
const { statusNavbarHeightInfo, location = {} } = useGlobalState() || {};
|
||||
const { statusNavbarHeightInfo, location = {}, getCurrentLocationInfo } = useGlobalState() || {};
|
||||
const { totalHeight } = statusNavbarHeightInfo || {};
|
||||
const {
|
||||
isShowFilterPopup,
|
||||
@@ -53,13 +54,18 @@ const ListPage = () => {
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (location?.address) {
|
||||
// 保存位置
|
||||
updateState({ location });
|
||||
// 页面加载时获取数据
|
||||
getMatchesData();
|
||||
}
|
||||
}, [location]);
|
||||
getLocation()
|
||||
}, []);
|
||||
|
||||
// 获取位置信息
|
||||
const getLocation = async () => {
|
||||
const location = await getCurrentLocationInfo()
|
||||
// 保存位置
|
||||
updateState({ location });
|
||||
// 页面加载时获取数据
|
||||
getMatchesData();
|
||||
return location;
|
||||
}
|
||||
|
||||
const refreshMatches = () => {
|
||||
initialFilterSearch();
|
||||
@@ -133,6 +139,7 @@ const ListPage = () => {
|
||||
<View>
|
||||
{/* 自定义导航 */}
|
||||
<CustomerNavBar />
|
||||
{/* <ShareCardCanvas /> */}
|
||||
<View className={styles.listPage}>
|
||||
<View
|
||||
className={`${styles.listTopSearchWrapper} ${
|
||||
|
||||
Reference in New Issue
Block a user