diff --git a/public/css/custom.css b/public/css/custom.css index 7bcee0a..73d624e 100644 --- a/public/css/custom.css +++ b/public/css/custom.css @@ -428,8 +428,8 @@ /* 작은 화면에서 버튼 크기 조정 */ @media (max-width: 1700px) { .count-btn { - width: 28px; - height: 28px; + width: 26px; + height: 26px; font-size: 15px; } .count-container { @@ -440,7 +440,7 @@ margin-bottom: 8px; } .count-value { - font-size: 20px; + font-size: 15px; } .custom-button { width: 45px; @@ -451,10 +451,10 @@ font-size: 18px; } .vac-modal-text { - font-size: 13px; + font-size: 12px; } .vac-modal-title { - font-size: 17px; + font-size: 15px; margin-bottom: 10px; } .vacation-item { @@ -463,8 +463,8 @@ margin-bottom: 5px; } .vac-btn { - width: 50px; - height: 50px; + width: 40px; + height: 40px; font-size: 18px; } .vac-btn-success { @@ -495,12 +495,12 @@ margin-bottom: 5px; } .vac-btn { - width: 40px; - height: 40px; - font-size: 18px; + width: 10px; + height: 10px; + font-size: 12px; } .vac-btn-success { - font-size: 20px; + font-size: 15px; width: 40px; height: 40px; } diff --git a/src/stores/useWeatherStore.js b/src/stores/useWeatherStore.js index a863d76..862f687 100644 --- a/src/stores/useWeatherStore.js +++ b/src/stores/useWeatherStore.js @@ -3,7 +3,7 @@ 작성일 : 2025-04-04 수정자 : 수정일 : - 설명 : + 설명 : 위치 기반으로 날씨를 조회하고, 오늘의 최저/최고 기온과 현재 날씨 아이콘/설명을 저장합니다. */ import { ref } from 'vue'; import { defineStore } from 'pinia'; @@ -35,28 +35,43 @@ export const useWeatherStore = defineStore('weather', () => { const resData = res.data.data; const raw = resData.weatherInfo; const data = JSON.parse(raw); - + console.log(data.list) if (!data || !Array.isArray(data.list) || data.list.length === 0) { console.error('날씨 데이터 형식 오류 또는 없음:', data); return; } + // 주간 예보 리스트 저장 dailyWeatherList.value = resData.dailyWeatherList; const now = new Date(); + const nowTime = now.getTime(); + const todayStr = now.toISOString().split('T')[0]; + + // 오늘의 데이터만 필터링 + const todayList = data.list.filter(item => item.dt_txt.startsWith(todayStr)); + + if (todayList.length > 0) { + // 오늘의 최저 / 최고 기온 계산 + const minTemp = Math.min(...todayList.map(i => i.main.temp_min)); + const maxTemp = Math.max(...todayList.map(i => i.main.temp_max)); + weather.value.tempMin = Math.round(minTemp); + weather.value.tempMax = Math.round(maxTemp); + } else { + weather.value.tempMin = null; + weather.value.tempMax = null; + } + + // 현재 시간과 가장 가까운 시간대 데이터 추출 (아이콘 및 설명용) const closest = data.list.reduce((prev, curr) => { - const prevTime = new Date(prev.dt_txt).getTime(); - const currTime = new Date(curr.dt_txt).getTime(); - const nowTime = now.getTime(); - const prevDiff = Math.abs(prevTime - nowTime); - const currDiff = Math.abs(currTime - nowTime); - return prevDiff < currDiff ? prev : curr; + const prevDiff = Math.abs(new Date(prev.dt_txt).getTime() - nowTime); + const currDiff = Math.abs(new Date(curr.dt_txt).getTime() - nowTime); + return currDiff < prevDiff ? curr : prev; }); weather.value.icon = closest.weather[0].icon.replace(/n$/, 'd'); weather.value.description = closest.weather[0].description; - weather.value.tempMin = Math.round(closest.main.temp_min); - weather.value.tempMax = Math.round(closest.main.temp_max); + } catch (e) { console.error('날씨 정보 가져오기 실패:', e); } diff --git a/src/views/mypage/MyPage.vue b/src/views/mypage/MyPage.vue index b908b7d..0e27ae8 100644 --- a/src/views/mypage/MyPage.vue +++ b/src/views/mypage/MyPage.vue @@ -103,7 +103,7 @@
@@ -211,17 +211,26 @@ const onlyNumber = (e) => { }; const checkPhoneDuplicateAndFormat = async () => { - const phone = form.value.phone.trim(); + const currentPhone = form.value.phone.trim(); - // 전화번호 정규식 + // 형식 검사 (010으로 시작 + 숫자 8자리) const phoneRegex = /^010\d{8}$/; - phoneFormatError.value = !phoneRegex.test(phone); + const isFormatValid = phoneRegex.test(currentPhone); - if (!phoneFormatError.value) { - phoneDuplicated.value = phone !== originalData.value.phone && - !(await $api.get('/user/checkPhone', { - params: { memberTel: currentPhone }, - })).data.data; + phoneFormatError.value = !isFormatValid; + + // 중복 체크는 형식이 맞을 때만 수행 + if (isFormatValid) { + const response = await $api.get('/user/checkPhone', { + params: { memberTel: currentPhone }, + }); + + // true면 사용 가능하다는 의미니까 → 중복 아님 + // false면 중복된 번호라는 의미니까 → 중복됨 + phoneDuplicated.value = currentPhone !== originalData.value.phone && !response.data.data; + } else { + // 형식이 맞지 않으면 중복 여부는 무시 (false로 초기화) + phoneDuplicated.value = false; } };