수정사항
This commit is contained in:
parent
1f9f9bd1ff
commit
25c691338d
@ -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;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@
|
||||
|
||||
<div class="d-flex mt-5">
|
||||
<button type="submit" class="btn btn-primary w-100"
|
||||
:disabled="!isChanged || phoneDuplicated || colorDuplicated">
|
||||
:disabled="!isChanged || phoneDuplicated || phoneFormatError || colorDuplicated">
|
||||
정보 수정
|
||||
</button>
|
||||
</div>
|
||||
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user