+
定位
@@ -113,6 +113,32 @@ export default {
})
}
},
+ async reloadHome(){
+ console.log('城市信息:', this.city_info);
+ if(this.city_info){
+ this.$emit('cityItem',{
+ cityName: this.city_info.cityName,
+ cityId: this.city_info.cityId
+ })
+ }
+ },
+ async resetCityName() {
+ const location = await WechatLocation.getLocation('gcj02');
+ const result = await api.wechatAPI.getLocationCity(location.latitude, location.longitude);
+ console.log('刷新定位:', result);
+ console.log('刷新定位location:', location);
+ if (result.code === 200 && result.data) {
+ const userStore = useUserStore();
+ // this.list = result.data;
+ this.city_info = {
+ cityName: result.data.cityName,
+ cityId: result.data.cityId
+ };
+ // localStorage.setItem('cityInfo', JSON.stringify(result.data));
+ // localStorage.setItem('userLocation', JSON.stringify({ ...location, time: new Date().getTime() }));
+ userStore.setCity(result.data);
+ }
+ },
handleClickItem(item){
this.city_info = {
cityName: item.city_name,