diff --git a/src/hooks/useLocation.ts b/src/hooks/useLocation.ts index 0ffd7c1..1672beb 100644 --- a/src/hooks/useLocation.ts +++ b/src/hooks/useLocation.ts @@ -32,7 +32,7 @@ export function handleCheckLocationCacheHooks() { export function handleSetLocationCacheHooks(lat: number, lng: number) { uni.setStorageSync(LOCATION_LAT_KEY, lat) uni.setStorageSync(LOCATION_LNG_KEY, lng) - uni.setStorageSync(LOCATION_EXPIRE_KEY, Date.now() + LOCATION_EXPIRE_MS) + // uni.setStorageSync(LOCATION_EXPIRE_KEY, Date.now() + LOCATION_EXPIRE_MS) } // TODO VERSION2: 在获取经纬度之前还有弹出是否搜索附近茶室?-初始化经纬度 @@ -290,6 +290,8 @@ export async function handleGetLocationCity(lat: number, lng: number) { longitude: res.result.location.lng, city: res.result.ad_info.city } + // 通过腾讯地图返回的经纬度重新设置缓存 + handleSetLocationCacheHooks(res.result.location.lat, res.result.location.lng) setLocationCity(params.city) uni.setStorageSync(LOCATION_CURRENT, params) // uni.$emit('locationUpdate', params) // 通知页面 diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 394b8c9..89aabcb 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -225,7 +225,6 @@ city.value = location.city latitude.value = location.latitude longitude.value = location.longitude - console.log("🚀 ~ latitude.value:", latitude.value, longitude.value) Index.handleResetSearch() })