게시판 리스트 번호 수정

This commit is contained in:
dyhj625 2025-02-04 16:21:07 +09:00
parent 68c096b43f
commit 67bb83277a

View File

@ -51,7 +51,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<!-- 공지사항 ( 페이지에서만 표시, showNotices가 false일 때만 보임) --> <!-- 공지사항 -->
<template v-if="pagination.currentPage === 1 && !showNotices"> <template v-if="pagination.currentPage === 1 && !showNotices">
<tr v-for="(notice, index) in noticeList" <tr v-for="(notice, index) in noticeList"
:key="'notice-' + index" :key="'notice-' + index"
@ -114,7 +114,7 @@ import isYesterday from 'dayjs/plugin/isYesterday';
import 'bootstrap-icons/font/bootstrap-icons.css'; import 'bootstrap-icons/font/bootstrap-icons.css';
dayjs.extend(isToday); // dayjs.extend(isToday);
dayjs.extend(isYesterday); dayjs.extend(isYesterday);
// //
@ -157,13 +157,13 @@ const isNewPost = (dateString) => {
return date.isToday() || date.isYesterday(); return date.isToday() || date.isYesterday();
}; };
// ( ) //
const search = (e) => { const search = (e) => {
searchText.value = e.trim(); searchText.value = e.trim();
fetchGeneralPosts(1); fetchGeneralPosts(1);
}; };
// ( ) //
const handleSortChange = () => { const handleSortChange = () => {
fetchGeneralPosts(1); fetchGeneralPosts(1);
}; };
@ -186,8 +186,11 @@ const fetchGeneralPosts = async (page = 1) => {
}); });
if (data?.data) { if (data?.data) {
generalList.value = data.data.list.map(post => ({ console.log(data)
id: post.id, const totalPosts = data.data.total; // (API )
generalList.value = data.data.list.map((post, index) => ({
id: totalPosts - ((page - 1) * selectedSize.value) - index,
title: post.title, title: post.title,
author: post.author || '익명', author: post.author || '익명',
date: formatDate(post.date), // date: formatDate(post.date), //
@ -229,7 +232,7 @@ const fetchNoticePosts = async () => {
id: post.id, id: post.id,
title: post.title, title: post.title,
author: post.author || '관리자', author: post.author || '관리자',
date: formatDate(post.date), // date: formatDate(post.date),
views: post.cnt || 0, views: post.cnt || 0,
hasAttachment: post.hasAttachment || false, hasAttachment: post.hasAttachment || false,
img: post.firstImageUrl || null img: post.firstImageUrl || null
@ -259,7 +262,6 @@ onMounted(() => {
.notice-row { .notice-row {
background-color: #f8f9fa; background-color: #f8f9fa;
} }
.notice-row td { .notice-row td {
color: #DC3545 !important; color: #DC3545 !important;
} }