Merge branch 'main' into board-view-content
This commit is contained in:
commit
4329d9febd
@ -51,7 +51,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- 공지사항 (첫 페이지에서만 표시, showNotices가 false일 때만 보임) -->
|
||||
<!-- 공지사항 -->
|
||||
<template v-if="pagination.currentPage === 1 && !showNotices">
|
||||
<tr v-for="(notice, index) in noticeList"
|
||||
:key="'notice-' + index"
|
||||
@ -60,6 +60,7 @@
|
||||
<td>공지</td>
|
||||
<td>
|
||||
📌 {{ notice.title }}
|
||||
<i v-if="notice.img" class="bi bi-image me-1"></i>
|
||||
<i v-if="notice.hasAttachment" class="bi bi-paperclip"></i>
|
||||
<span v-if="isNewPost(notice.date)" class="badge bg-danger text-white ms-2 new-badge">N</span>
|
||||
</td>
|
||||
@ -76,6 +77,7 @@
|
||||
<td>{{ post.id }}</td>
|
||||
<td>
|
||||
{{ post.title }}
|
||||
<i v-if="post.img" class="bi bi-image me-1"></i>
|
||||
<i v-if="post.hasAttachment" class="bi bi-paperclip"></i>
|
||||
<span v-if="isNewPost(post.date)" class="badge bg-danger text-white ms-2 new-badge">N</span>
|
||||
</td>
|
||||
@ -112,7 +114,7 @@ import isYesterday from 'dayjs/plugin/isYesterday';
|
||||
import 'bootstrap-icons/font/bootstrap-icons.css';
|
||||
|
||||
|
||||
dayjs.extend(isToday); // 오늘 날짜 판별 플러그인 추가
|
||||
dayjs.extend(isToday);
|
||||
dayjs.extend(isYesterday);
|
||||
|
||||
// 데이터 초기화
|
||||
@ -155,13 +157,13 @@ const isNewPost = (dateString) => {
|
||||
return date.isToday() || date.isYesterday();
|
||||
};
|
||||
|
||||
// 검색 처리 (검색 시 첫 페이지부터 조회)
|
||||
// 검색 처리
|
||||
const search = (e) => {
|
||||
searchText.value = e.trim();
|
||||
fetchGeneralPosts(1);
|
||||
};
|
||||
|
||||
// 정렬 변경 핸들러 (첫 페이지부터 정렬)
|
||||
// 정렬 변경 핸들러
|
||||
const handleSortChange = () => {
|
||||
fetchGeneralPosts(1);
|
||||
};
|
||||
@ -184,13 +186,17 @@ const fetchGeneralPosts = async (page = 1) => {
|
||||
});
|
||||
|
||||
if (data?.data) {
|
||||
generalList.value = data.data.list.map(post => ({
|
||||
id: post.id,
|
||||
console.log(data)
|
||||
const totalPosts = data.data.total; // 전체 게시물 개수 받아오기 (API가 제공해야 함)
|
||||
|
||||
generalList.value = data.data.list.map((post, index) => ({
|
||||
id: totalPosts - ((page - 1) * selectedSize.value) - index,
|
||||
title: post.title,
|
||||
author: post.author || '익명',
|
||||
date: formatDate(post.date), // 날짜 변환 적용
|
||||
views: post.cnt || 0,
|
||||
hasAttachment: post.hasAttachment || false
|
||||
hasAttachment: post.hasAttachment || false,
|
||||
img: post.firstImageUrl || null
|
||||
}));
|
||||
|
||||
pagination.value = {
|
||||
@ -226,9 +232,10 @@ const fetchNoticePosts = async () => {
|
||||
id: post.id,
|
||||
title: post.title,
|
||||
author: post.author || '관리자',
|
||||
date: formatDate(post.date), // 날짜 변환 적용
|
||||
date: formatDate(post.date),
|
||||
views: post.cnt || 0,
|
||||
hasAttachment: post.hasAttachment || false
|
||||
hasAttachment: post.hasAttachment || false,
|
||||
img: post.firstImageUrl || null
|
||||
}));
|
||||
}
|
||||
} catch (error) {
|
||||
@ -255,7 +262,6 @@ onMounted(() => {
|
||||
.notice-row {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
|
||||
.notice-row td {
|
||||
color: #DC3545 !important;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user