머지
This commit is contained in:
parent
922b7e0904
commit
2c28645488
@ -13,13 +13,21 @@
|
|||||||
class="vacation-item"
|
class="vacation-item"
|
||||||
>
|
>
|
||||||
<span v-if="vacation.type === 'used'" class="vacation-index">
|
<span v-if="vacation.type === 'used'" class="vacation-index">
|
||||||
{{ totalUsedVacationCount - usedVacations.findIndex(v => v.date === vacation.date) }} )
|
{{ totalUsedVacationCount - usedVacations.findIndex(v => v.date === vacation.date) }})
|
||||||
</span>
|
</span>
|
||||||
<span :class="vacation.type === 'used' ? 'minus-symbol' : 'plus-symbol'">
|
<span :class="vacation.type === 'used' ? 'minus-symbol' : 'plus-symbol'">
|
||||||
{{ vacation.type === 'used' ? '-' : '+' }}
|
{{ vacation.type === 'used' ? '-' : '+' }}
|
||||||
</span>
|
</span>
|
||||||
<span :style="{ color: userColors[vacation.senderId || vacation.receiverId] || '#000' }"
|
<span
|
||||||
class="vacation-date">{{ formatDate(vacation.date) }}</span>
|
:style="{ color: userColors[vacation.senderId || vacation.receiverId] || '#000' }"
|
||||||
|
class="vacation-date"
|
||||||
|
>
|
||||||
|
{{ formatDate(vacation.date) }}
|
||||||
|
<span class="vacation-type">
|
||||||
|
({{ vacation.halfDay ? '반차' : '풀 연차' }})
|
||||||
|
<span v-if="vacation.senderId"> (보낸 연차)</span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
@ -57,113 +65,123 @@
|
|||||||
const totalUsedVacationCount = computed(() => props.myVacations.length);
|
const totalUsedVacationCount = computed(() => props.myVacations.length);
|
||||||
|
|
||||||
// ✅ 사용한 연차 + 받은 연차 통합 후 내림차순 정렬
|
// ✅ 사용한 연차 + 받은 연차 통합 후 내림차순 정렬
|
||||||
const usedVacations = computed(() => props.myVacations.map(v => ({ ...v, type: "used" })));
|
const usedVacations = computed(() =>
|
||||||
const receivedVacations = computed(() => props.receivedVacations
|
props.myVacations.map(v => ({ ...v, type: "used" }))
|
||||||
.filter(v => !v.senderId) // ✅ 보낸 사람이 있는 경우 리스트에서 제외
|
|
||||||
.map(v => ({ ...v, type: "received" }))
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const mergedVacations = computed(() => {
|
const receivedVacations = computed(() =>
|
||||||
return [...usedVacations.value, ...receivedVacations.value].sort(
|
props.receivedVacations.map(v => ({ ...v, type: "received" }))
|
||||||
(a, b) => new Date(b.date) - new Date(a.date)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// ✅ 정확한 정렬 및 리스트 병합
|
||||||
|
const mergedVacations = computed(() => {
|
||||||
|
return [...usedVacations.value, ...receivedVacations.value].sort(
|
||||||
|
(a, b) => new Date(b.date) - new Date(a.date)
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// ✅ 날짜 형식 변환 (YYYY-MM-DD)
|
// ✅ 날짜 형식 변환 (YYYY-MM-DD)
|
||||||
const formatDate = (dateString) => {
|
const formatDate = (dateString) => {
|
||||||
const date = new Date(dateString);
|
const date = new Date(dateString);
|
||||||
return date.toISOString().split("T")[0]; // YYYY-MM-DD 형식
|
return date.toISOString().split("T")[0]; // YYYY-MM-DD 형식
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeModal = () => {
|
const closeModal = () => {
|
||||||
emit("close");
|
emit("close");
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* 모달 스타일 */
|
||||||
|
.modal-dialog {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
<style scoped>
|
/* 스크롤 가능한 모달 */
|
||||||
/* 모달 스타일 */
|
.modal-content {
|
||||||
.modal-dialog {
|
max-height: 60vh;
|
||||||
display: flex;
|
overflow-y: auto;
|
||||||
justify-content: center;
|
padding: 20px;
|
||||||
align-items: center;
|
width: 75%;
|
||||||
}
|
background: white;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
/* 스크롤 가능한 모달 */
|
/* 닫기 버튼 */
|
||||||
.modal-content {
|
.close-btn {
|
||||||
max-height: 60vh;
|
position: absolute;
|
||||||
overflow-y: auto;
|
top: 10px;
|
||||||
padding: 20px;
|
right: 10px;
|
||||||
width: 75%;
|
background: none;
|
||||||
background: white;
|
border: none;
|
||||||
border-radius: 8px;
|
font-size: 18px;
|
||||||
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
|
cursor: pointer;
|
||||||
}
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
/* 닫기 버튼 */
|
/* 리스트 기본 스타일 */
|
||||||
.close-btn {
|
.vacation-list {
|
||||||
position: absolute;
|
list-style-type: none;
|
||||||
top: 10px;
|
padding-left: 0;
|
||||||
right: 10px;
|
margin-top: 15px;
|
||||||
background: none;
|
}
|
||||||
border: none;
|
|
||||||
font-size: 18px;
|
|
||||||
cursor: pointer;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 리스트 기본 스타일 */
|
/* 리스트 아이템 */
|
||||||
.vacation-list {
|
.vacation-item {
|
||||||
list-style-type: none;
|
display: flex;
|
||||||
padding-left: 0;
|
align-items: center;
|
||||||
margin-top: 15px;
|
font-size: 16px;
|
||||||
}
|
font-weight: bold;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
padding: 5px 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
background: #f9f9f9;
|
||||||
|
}
|
||||||
|
|
||||||
/* 리스트 아이템 */
|
/* 인덱스 (연차 사용 개수) */
|
||||||
.vacation-item {
|
.vacation-index {
|
||||||
display: flex;
|
font-weight: bold;
|
||||||
align-items: center;
|
font-size: 16px;
|
||||||
font-size: 16px;
|
margin-right: 8px;
|
||||||
font-weight: bold;
|
color: #333;
|
||||||
margin-bottom: 8px;
|
}
|
||||||
padding: 5px 10px;
|
|
||||||
border-radius: 5px;
|
|
||||||
background: #f9f9f9;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 인덱스 (연차 사용 개수) */
|
/* "-" 빨간색 */
|
||||||
.vacation-index {
|
.minus-symbol {
|
||||||
font-weight: bold;
|
color: red;
|
||||||
font-size: 16px;
|
font-weight: bold;
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
color: #333;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* "-" 빨간색 */
|
/* "+" 파란색 */
|
||||||
.minus-symbol {
|
plus-symbol {
|
||||||
color: red;
|
color: blue;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "+" 파란색 */
|
/* 날짜 스타일 */
|
||||||
.plus-symbol {
|
.vacation-date {
|
||||||
color: blue;
|
font-size: 16px;
|
||||||
font-weight: bold;
|
color: #333;
|
||||||
margin-right: 8px;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* 날짜 스타일 */
|
/* 연차 유형 스타일 */
|
||||||
.vacation-date {
|
.vacation-type {
|
||||||
font-size: 16px;
|
font-size: 14px;
|
||||||
color: #333;
|
font-weight: normal;
|
||||||
}
|
color: gray;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
/* 연차 데이터 없음 */
|
/* 연차 데이터 없음 */
|
||||||
.no-data {
|
.no-data {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: gray;
|
color: gray;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -190,6 +190,8 @@ const fetchGeneralPosts = async (page = 1) => {
|
|||||||
console.log(data)
|
console.log(data)
|
||||||
const totalPosts = data.data.total; // 전체 게시물 개수 받아오기
|
const totalPosts = data.data.total; // 전체 게시물 개수 받아오기
|
||||||
|
|
||||||
|
console.log('📌 API 응답 데이터:', data.data);
|
||||||
|
|
||||||
generalList.value = data.data.list.map((post, index) => ({
|
generalList.value = data.data.list.map((post, index) => ({
|
||||||
realId: post.id,
|
realId: post.id,
|
||||||
id: totalPosts - ((page - 1) * selectedSize.value) - index,
|
id: totalPosts - ((page - 1) * selectedSize.value) - index,
|
||||||
|
|||||||
@ -94,7 +94,11 @@
|
|||||||
@updateReaction="handleUpdateReaction"
|
@updateReaction="handleUpdateReaction"
|
||||||
@submitComment="handleCommentReply"
|
@submitComment="handleCommentReply"
|
||||||
/>
|
/>
|
||||||
<Pagination/>
|
<Pagination
|
||||||
|
v-if="pagination.pages"
|
||||||
|
v-bind="pagination"
|
||||||
|
@update:currentPage="handlePageChange"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -103,7 +107,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import BoardCommentArea from '@c/board/BoardCommentArea.vue';
|
import BoardCommentArea from '@/components/board/BoardCommentArea.vue';
|
||||||
import BoardProfile from '@c/board/BoardProfile.vue';
|
import BoardProfile from '@c/board/BoardProfile.vue';
|
||||||
import BoardCommentList from '@c/board/BoardCommentList.vue';
|
import BoardCommentList from '@c/board/BoardCommentList.vue';
|
||||||
import BoardRecommendBtn from '@c/button/BoardRecommendBtn.vue';
|
import BoardRecommendBtn from '@c/button/BoardRecommendBtn.vue';
|
||||||
@ -141,6 +145,21 @@ const passwordAlert = ref("");
|
|||||||
const isPassword = ref(false);
|
const isPassword = ref(false);
|
||||||
const lastClickedButton = ref("");
|
const lastClickedButton = ref("");
|
||||||
|
|
||||||
|
const pagination = ref({
|
||||||
|
currentPage: 1,
|
||||||
|
pages: 1,
|
||||||
|
prePage: 0,
|
||||||
|
nextPage: 1,
|
||||||
|
isFirstPage: true,
|
||||||
|
isLastPage: false,
|
||||||
|
hasPreviousPage: false,
|
||||||
|
hasNextPage: false,
|
||||||
|
navigatePages: 10,
|
||||||
|
navigatepageNums: [1],
|
||||||
|
navigateFirstPage: 1,
|
||||||
|
navigateLastPage: 1
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// 게시물 상세 데이터 불러오기
|
// 게시물 상세 데이터 불러오기
|
||||||
const fetchBoardDetails = async () => {
|
const fetchBoardDetails = async () => {
|
||||||
@ -202,10 +221,13 @@ const handleUpdateReaction = async ({ boardId, commentId, isLike, isDislike }) =
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 댓글 목록 조회
|
// 댓글 목록 조회
|
||||||
const fetchComments = async () => {
|
const fetchComments = async (pageNum = 1) => {
|
||||||
try {
|
try {
|
||||||
const response = await axios.get(`board/${currentBoardId.value}/comments`, {
|
const response = await axios.get(`board/${currentBoardId.value}/comments`, {
|
||||||
params: { LOCBRDSEQ: currentBoardId.value }
|
params: {
|
||||||
|
LOCBRDSEQ: currentBoardId.value,
|
||||||
|
pageNum: pageNum
|
||||||
|
}
|
||||||
});
|
});
|
||||||
console.log("목록 API 응답 데이터:", response.data);
|
console.log("목록 API 응답 데이터:", response.data);
|
||||||
|
|
||||||
@ -240,6 +262,22 @@ const fetchComments = async () => {
|
|||||||
|
|
||||||
// console.log("변환된 comments 데이터:", comments.value);
|
// console.log("변환된 comments 데이터:", comments.value);
|
||||||
|
|
||||||
|
pagination.value = {
|
||||||
|
...pagination.value,
|
||||||
|
currentPage: response.data.data.pageNum, // 현재 페이지 번호
|
||||||
|
pages: response.data.data.pages, // 전체 페이지 수
|
||||||
|
prePage: response.data.data.prePage, // 이전 페이지
|
||||||
|
nextPage: response.data.data.nextPage, // 다음 페이지
|
||||||
|
isFirstPage: response.data.data.isFirstPage, // 첫 페이지 여부
|
||||||
|
isLastPage: response.data.data.isLastPage, // 마지막 페이지 여부
|
||||||
|
hasPreviousPage: response.data.data.hasPreviousPage, // 이전 페이지 존재 여부
|
||||||
|
hasNextPage: response.data.data.hasNextPage, // 다음 페이지 존재 여부
|
||||||
|
navigatePages: response.data.data.navigatePages, // 몇 개의 페이지 버튼을 보여줄 것인지
|
||||||
|
navigatepageNums: response.data.data.navigatepageNums, // 실제 페이지 번호 목록
|
||||||
|
navigateFirstPage: response.data.data.navigateFirstPage, // 페이지네이션에서 첫 페이지 번호
|
||||||
|
navigateLastPage: response.data.data.navigateLastPage // 페이지네이션에서 마지막 페이지 번호
|
||||||
|
};
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('댓글 목록 불러오기 오류:', error);
|
console.error('댓글 목록 불러오기 오류:', error);
|
||||||
}
|
}
|
||||||
@ -372,6 +410,14 @@ const deletePost = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 페이지 변경
|
||||||
|
const handlePageChange = (page) => {
|
||||||
|
if (page !== pagination.value.currentPage) {
|
||||||
|
pagination.value.currentPage = page;
|
||||||
|
fetchComments(page);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 날짜
|
// 날짜
|
||||||
const formattedDate = (dateString) => {
|
const formattedDate = (dateString) => {
|
||||||
if (!dateString) return "날짜 없음";
|
if (!dateString) return "날짜 없음";
|
||||||
|
|||||||
@ -99,6 +99,7 @@ const handleProfileClick = async (user) => {
|
|||||||
if (user.MEMBERSEQ === userStore.user.id) {
|
if (user.MEMBERSEQ === userStore.user.id) {
|
||||||
// 내 프로필을 클릭한 경우
|
// 내 프로필을 클릭한 경우
|
||||||
const response = await axios.get(`vacation/history`);
|
const response = await axios.get(`vacation/history`);
|
||||||
|
console.log(response)
|
||||||
|
|
||||||
if (response.status === 200 && response.data) {
|
if (response.status === 200 && response.data) {
|
||||||
myVacations.value = response.data.data.usedVacations || [];
|
myVacations.value = response.data.data.usedVacations || [];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user