버그 수정
This commit is contained in:
@@ -99,6 +99,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, watch, toRefs, computed } from 'vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
const statusOptions = [
|
||||
{ name: '준비', value: '준비' },
|
||||
@@ -145,9 +146,7 @@ const eventModel = ref({ ...props.event });
|
||||
// 날짜 형식 변환
|
||||
const formatDate = (date) => {
|
||||
if (!date) return null;
|
||||
const d = new Date(date);
|
||||
d.setHours(d.getHours() + 9); // UTC to KST
|
||||
return d;
|
||||
return dayjs(date).toDate();
|
||||
};
|
||||
|
||||
// props 변경 시 이벤트 모델 업데이트
|
||||
@@ -161,23 +160,17 @@ watch(() => props.event, (newValue) => {
|
||||
eventModel.value = formattedEvent;
|
||||
}, { deep: true });
|
||||
|
||||
// 이벤트 저장 시 UTC로 변환
|
||||
// 이벤트 저장
|
||||
const saveEvent = () => {
|
||||
const eventData = { ...eventModel.value };
|
||||
if (eventData.startDate) {
|
||||
const d = new Date(eventData.startDate);
|
||||
d.setHours(d.getHours() - 9); // KST to UTC
|
||||
eventData.startDate = d;
|
||||
eventData.startDate = dayjs(eventData.startDate).toDate();
|
||||
}
|
||||
if (eventData.endDate) {
|
||||
const d = new Date(eventData.endDate);
|
||||
d.setHours(d.getHours() - 9); // KST to UTC
|
||||
eventData.endDate = d;
|
||||
eventData.endDate = dayjs(eventData.endDate).toDate();
|
||||
}
|
||||
if (eventData.registrationDeadline) {
|
||||
const d = new Date(eventData.registrationDeadline);
|
||||
d.setHours(d.getHours() - 9); // KST to UTC
|
||||
eventData.registrationDeadline = d;
|
||||
eventData.registrationDeadline = dayjs(eventData.registrationDeadline).toDate();
|
||||
}
|
||||
emit('save', eventData);
|
||||
};
|
||||
|
||||
@@ -114,7 +114,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted, defineEmits } from 'vue';
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
import { useToast } from 'primevue/usetoast';
|
||||
import eventService from '@/services/eventService';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
@@ -3,6 +3,15 @@ import { createPinia } from 'pinia'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
|
||||
// dayjs configuration
|
||||
import dayjs from 'dayjs'
|
||||
import timezone from 'dayjs/plugin/timezone'
|
||||
import utc from 'dayjs/plugin/utc'
|
||||
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(timezone)
|
||||
dayjs.tz.setDefault('Asia/Seoul')
|
||||
|
||||
// PrimeVue
|
||||
import PrimeVue from 'primevue/config'
|
||||
import 'primevue/resources/themes/lara-light-blue/theme.css'
|
||||
|
||||
@@ -29,6 +29,15 @@ const adminService = {
|
||||
return apiClient.get(`/api/admin/clubs/${id}`);
|
||||
},
|
||||
|
||||
/**
|
||||
* 새 클럽 생성
|
||||
* @param {Object} clubData - 클럽 정보
|
||||
* @returns {Promise} - 생성된 클럽 정보
|
||||
*/
|
||||
createClub(clubData) {
|
||||
return apiClient.post('/api/admin/clubs', clubData);
|
||||
},
|
||||
|
||||
/**
|
||||
* 클럽 정보 업데이트
|
||||
* @param {Number} id - 클럽 ID
|
||||
|
||||
@@ -60,8 +60,8 @@ export default {
|
||||
try {
|
||||
const formattedEvent = {
|
||||
...event,
|
||||
startDate: dayjs(event.startDate).format('YYYY-MM-DD'),
|
||||
endDate: event.endDate ? dayjs(event.endDate).format('YYYY-MM-DD') : null
|
||||
startDate: dayjs(event.startDate).format('YYYY-MM-DDTHH:mm:ssZ'),
|
||||
endDate: event.endDate ? dayjs(event.endDate).format('YYYY-MM-DDTHH:mm:ssZ') : null
|
||||
};
|
||||
|
||||
const response = await apiClient.post('/api/club/events/create', formattedEvent);
|
||||
@@ -87,8 +87,8 @@ export default {
|
||||
try {
|
||||
const formattedEvent = {
|
||||
...event,
|
||||
startDate: dayjs(event.startDate).format('YYYY-MM-DD'),
|
||||
endDate: dayjs(event.endDate).format('YYYY-MM-DD')
|
||||
startDate: dayjs(event.startDate).format('YYYY-MM-DDTHH:mm:ssZ'),
|
||||
endDate: event.endDate ? dayjs(event.endDate).format('YYYY-MM-DDTHH:mm:ssZ') : null
|
||||
};
|
||||
|
||||
const response = await apiClient.put(`/api/club/events/${event.id}`, formattedEvent);
|
||||
|
||||
@@ -114,6 +114,7 @@ import { useToast } from 'primevue/usetoast';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useClubStore } from '@/stores/clubStore';
|
||||
import eventService from '@/services/eventService';
|
||||
import dayjs from 'dayjs';
|
||||
import clubService from '@/services/clubService';
|
||||
import ScoreManagement from '@/components/event/ScoreManagement.vue';
|
||||
import ParticipantManagement from '@/components/event/ParticipantManagement.vue';
|
||||
@@ -214,14 +215,7 @@ onMounted(async () => {
|
||||
// 날짜 포맷 함수
|
||||
const formatDate = (date) => {
|
||||
if (!date) return '';
|
||||
const d = new Date(date);
|
||||
return d.toLocaleString('ko-KR', {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit'
|
||||
});
|
||||
return dayjs(date).format('YYYY. MM. DD. HH:mm');
|
||||
};
|
||||
|
||||
// 이벤트 유형에 따른 Badge 스타일
|
||||
@@ -336,18 +330,14 @@ const saveEvent = async (eventData) => {
|
||||
...eventData,
|
||||
clubId: clubId.value
|
||||
});
|
||||
const updatedEvent = response;
|
||||
const index = events.value.findIndex(e => e.id === updatedEvent.id);
|
||||
if (index !== -1) {
|
||||
events.value[index] = updatedEvent;
|
||||
}
|
||||
await fetchEvents(); // 목록 갱신
|
||||
} else {
|
||||
// 이벤트 생성
|
||||
const response = await eventService.createEvent({
|
||||
...eventData,
|
||||
clubId: clubId.value
|
||||
});
|
||||
events.value.push(response);
|
||||
await fetchEvents(); // 목록 갱신
|
||||
}
|
||||
toast.add({
|
||||
severity: 'success',
|
||||
|
||||
Reference in New Issue
Block a user