From 4ccb3c1af05a64749b2aaba0129c72ce79c8aa42 Mon Sep 17 00:00:00 2001 From: guonan <guonan201020@163.com> Date: 星期四, 10 七月 2025 17:01:47 +0800 Subject: [PATCH] type报错问题 --- src/api/hpApi.js | 24 +++++++++++++++++++++++- 1 files changed, 23 insertions(+), 1 deletions(-) diff --git a/src/api/hpApi.js b/src/api/hpApi.js index ce801f0..b18a094 100644 --- a/src/api/hpApi.js +++ b/src/api/hpApi.js @@ -248,7 +248,7 @@ } // 鏌ヨ瀛欒儭娌熼伩闄╁満鎵� -export async function getSafePoint(data) { +export async function getSafePoint() { const response = await axios.get("/hp/safeHavenLocation/getDataSelect", { params: { divisionId: 110116110218 @@ -261,4 +261,26 @@ export async function getAllCode() { const response = await axios.get("/hp/district/getAll"); return response.data; +} + +// 鑾峰彇澶╂皵棰勬姤 +export async function getWeather() { + // 鑾峰彇褰撳墠鏃堕棿鎴� + const currentTimestamp = Date.now(); + + // 鍒涘缓Date瀵硅薄 + const currentDate = new Date(currentTimestamp); + + // 鏍煎紡鍖栦负骞�-鏈�-鏃ワ紙YYYY-MM-DD锛� + const year = currentDate.getFullYear(); + const month = String(currentDate.getMonth() + 1).padStart(2, '0'); // 鏈堜唤浠�0寮�濮嬶紝鎵�浠ヨ+1 + const day = String(currentDate.getDate()).padStart(2, '0'); + const formattedDate = `${year}-${month}-${day}`; + + const response = await axios.get("/hp/weatherForecast/getSevenDaysWeather", { + params: { + inputDate: formattedDate + } + }); + return response.data; } \ No newline at end of file -- Gitblit v1.9.3