From c1ccf0064cdf23a6e6c44588dfeda1f2e4b53b19 Mon Sep 17 00:00:00 2001 From: Li1304553726 <1304553726@qq.com> Date: Fri, 14 Nov 2025 18:55:21 +0800 Subject: [PATCH] 1 --- .../app/components/weather/WeatherDisplay.tsx | 53 +++++++++++++------ 1114/app/store/weatherStore.ts | 4 +- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/1114/app/components/weather/WeatherDisplay.tsx b/1114/app/components/weather/WeatherDisplay.tsx index c064a93..92eb7f0 100644 --- a/1114/app/components/weather/WeatherDisplay.tsx +++ b/1114/app/components/weather/WeatherDisplay.tsx @@ -1,5 +1,6 @@ import { useWeatherStore } from "@/store/weatherStore"; -import { Cloud, CloudDrizzle, CloudFog, CloudLightning, CloudMoon, CloudRain, CloudSnow, CloudSun, MapPin, Moon, Sun } from "lucide-react"; +import { Cloud, CloudDrizzle, CloudFog, CloudLightning, CloudMoon, CloudRain, CloudSnow, CloudSun, MapPin, Moon, Sun, ThermometerSun } from "lucide-react"; +import { formatTemperature } from "../lib/utils"; interface WeatherIconProps { description: string; @@ -31,23 +32,41 @@ export function WeatherDisplay(){ if (!currentWeather) return null; return ( -
-
-
-
-
-
-

{currentWeather.location.name}

-
- -
{currentWeather.location.country}
-
-
-
- {/* */} -
-
+
+
+
+ +
+
+
+

{currentWeather.location.name}

+
+ + {currentWeather.location.country}
+
+
+ +
+ +
+ + {formatTemperature(currentWeather.current.temperature)} + + °C +
+

+ {currentWeather.current.weather_descriptions[0]} +

+
+ + 体感 {formatTemperature(currentWeather.current.feelslike)}°C +
+
+
) } \ No newline at end of file diff --git a/1114/app/store/weatherStore.ts b/1114/app/store/weatherStore.ts index a12ab9e..c827f36 100644 --- a/1114/app/store/weatherStore.ts +++ b/1114/app/store/weatherStore.ts @@ -102,7 +102,7 @@ export const useWeatherStore = create()( set({currentWeather:cachedWeather.data,isLoading:false}); return; } - const weatherData = await WeatherAPI.getWeather(city); + const weatherData = await WeatherAPI.getCurrentWeather(city); set({currentWeather:weatherData,isLoading:false}); get().cacheWeather(city,weatherData); }catch(error){ @@ -115,7 +115,7 @@ export const useWeatherStore = create()( try{ set({isLoading:true,error:null}); const city = currentWeather.location.name; - const weatherData = await WeatherAPI.getWeather(city); + const weatherData = await WeatherAPI.getCurrentWeather(city); set({currentWeather:weatherData,isLoading:false}); get().cacheWeather(currentWeather.location.name,weatherData); }catch(error){