修改首页默认经纬度

This commit is contained in:
lcc
2025-10-14 19:26:58 +08:00
parent d14dd9fef9
commit 56d502a396
+7 -1
View File
@@ -314,10 +314,16 @@ const getCurrentLocation = async () => {
// 获取当前位置
// const location = localStorage.getItem('userLocation')?JSON.parse(localStorage.getItem('userLocation')):await WechatLocation.getLocation('gcj02');
// 修改为从 cookie 获取位置信息
const location = getCookie('userLocation') || await WechatLocation.getLocation('gcj02');
let location = getCookie('userLocation') || await WechatLocation.getLocation('gcj02');
console.log('当前位置:', location);
const userStore = useUserStore();
// 解析位置获取城市信息
if (!location || !location.latitude || !location.longitude) {
location = {
latitude: '24.479627',
longitude: '118.08891'
};
}
if (location && location.latitude && location.longitude) {
// if(localStorage.getItem('cityInfo')){
// 修改为从 cookie 获取城市信息