修改定位方式

This commit is contained in:
wangxiaowei
2026-01-07 17:34:41 +08:00
parent 381d0d430d
commit f846d59340
2 changed files with 3 additions and 2 deletions

View File

@ -32,7 +32,7 @@ export function handleCheckLocationCacheHooks() {
export function handleSetLocationCacheHooks(lat: number, lng: number) { export function handleSetLocationCacheHooks(lat: number, lng: number) {
uni.setStorageSync(LOCATION_LAT_KEY, lat) uni.setStorageSync(LOCATION_LAT_KEY, lat)
uni.setStorageSync(LOCATION_LNG_KEY, lng) 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: 在获取经纬度之前还有弹出是否搜索附近茶室?-初始化经纬度 // TODO VERSION2: 在获取经纬度之前还有弹出是否搜索附近茶室?-初始化经纬度
@ -290,6 +290,8 @@ export async function handleGetLocationCity(lat: number, lng: number) {
longitude: res.result.location.lng, longitude: res.result.location.lng,
city: res.result.ad_info.city city: res.result.ad_info.city
} }
// 通过腾讯地图返回的经纬度重新设置缓存
handleSetLocationCacheHooks(res.result.location.lat, res.result.location.lng)
setLocationCity(params.city) setLocationCity(params.city)
uni.setStorageSync(LOCATION_CURRENT, params) uni.setStorageSync(LOCATION_CURRENT, params)
// uni.$emit('locationUpdate', params) // 通知页面 // uni.$emit('locationUpdate', params) // 通知页面

View File

@ -225,7 +225,6 @@
city.value = location.city city.value = location.city
latitude.value = location.latitude latitude.value = location.latitude
longitude.value = location.longitude longitude.value = location.longitude
console.log("🚀 ~ latitude.value:", latitude.value, longitude.value)
Index.handleResetSearch() Index.handleResetSearch()
}) })