From f8138c7ffb600ce8eec896b083efd2f75142ef26 Mon Sep 17 00:00:00 2001 From: Li1304553726 <1304553726@qq.com> Date: Mon, 17 Nov 2025 19:53:38 +0800 Subject: [PATCH 1/2] 1 --- app/routes/weather.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/routes/weather.tsx b/app/routes/weather.tsx index c8ce90a..8b26a6b 100644 --- a/app/routes/weather.tsx +++ b/app/routes/weather.tsx @@ -2,7 +2,7 @@ import React, {useEffect} from 'react'; import { Loader2 } from 'lucide-react'; -import { WeatherCard } from '@/components/weather/WeatherCard'; +import { WeatherCard } from '@/components/WeatherCard'; import { useWeatherStore } from '@/store/weatherStore'; import {toast} from "sonner"; From a4e4e2a1ce9d6f52059be0eec5288fb65ed3fa8a Mon Sep 17 00:00:00 2001 From: jinsir <874871581@qq.com> Date: Mon, 17 Nov 2025 19:57:08 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/WeatherSearchForm.tsx | 18 ++++-------------- app/routes/weather.tsx | 2 +- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/app/components/WeatherSearchForm.tsx b/app/components/WeatherSearchForm.tsx index 7b7b746..dcd6ec3 100644 --- a/app/components/WeatherSearchForm.tsx +++ b/app/components/WeatherSearchForm.tsx @@ -24,26 +24,16 @@ export function WeatherSearchForm() { setInputError('请输入城市名称'); return; } - if (trimmedCity.length < 2) { + if (trimmedCity.length <2) { setInputError('请输入至少2个字符'); return; } - if (!/^[a-zA-Z\s]+$/.test(trimmedCity)) { - setInputError('请输入字母和空格'); + if (!/^[\u4e00-\u9fa5a-zA-Z\s-]+$/.test(trimmedCity)) { + setInputError('请输入有效的城市名称'); return; } await searchWeather(trimmedCity); - - if (trimmedCity.length < 2) { - setInputError('请输入至少2个字符'); - return; - } - - if (!/^[a-zA-Z\s]+$/.test(trimmedCity)) { - setInputError('请输入字母和空格'); - return; - } - await searchWeather(trimmedCity); + } return ( diff --git a/app/routes/weather.tsx b/app/routes/weather.tsx index c8ce90a..8b26a6b 100644 --- a/app/routes/weather.tsx +++ b/app/routes/weather.tsx @@ -2,7 +2,7 @@ import React, {useEffect} from 'react'; import { Loader2 } from 'lucide-react'; -import { WeatherCard } from '@/components/weather/WeatherCard'; +import { WeatherCard } from '@/components/WeatherCard'; import { useWeatherStore } from '@/store/weatherStore'; import {toast} from "sonner";