board-notice-select 머지

This commit is contained in:
dyhj625 2025-01-21 15:45:06 +09:00
parent fe73ea2c56
commit affaf916be

View File

@ -1,6 +1,5 @@
<template>
<div class="container-xxl flex-grow-1 container-p-y">
<!-- 상단 : 검색창, 정렬 셀렉트 박스, 글쓰기 버튼 -->
<div class="row mb-4">
<!-- 검색창 -->
<div class="col">
@ -9,31 +8,40 @@
</div>
<div class="row">
<!-- 정렬 셀렉트 박스 -->
<div class="col-md-3 mb-4">
<select class="form-select" v-model="selectedOrder" @change="handleSortChange">
<option value="date">최신날짜</option>
<option value="views">조회수</option>
</select>
</div>
<!-- 글쓰기 버튼 -->
<div class="col-auto ms-auto mb-4">
<!-- 글쓰기 -->
<div class="mb-4">
<router-link to="/board/write">
<WriteButton />
</router-link>
</div>
</div>
<!-- 공지사항 게시물 리스트 -->
<div class="row g-3 mt-2 mt-md-8">
<h3>공지사항</h3>
<board-card :posts="noticeList" @click="goDetail" />
<!-- 공지사항 리스트 -->
<div v-if="pagination.currentPage === 1" class="mb-8">
<div class="row g-3">
<h3>공지사항</h3>
</div>
<div class="row">
<BoardCardList :posts="noticeList" @click="goDetail" />
</div>
</div>
<!-- 일반 게시물 리스트 -->
<div class="row g-3 mt-8">
<h3>일반게시판</h3>
<board-card :posts="generalList" @click="goDetail" />
<!-- 일반 리스트 -->
<div>
<div class="row g-3">
<h3 class="col">일반게시판</h3>
<!-- 셀렉트 박스 -->
<div class="col-12 col-md-auto">
<select class="form-select" v-model="selectedOrder" @change="handleSortChange">
<option value="date">최신날짜</option>
<option value="views">조회수</option>
</select>
</div>
</div>
<div class="row">
<BoardCardList :posts="generalList" @click="goDetail" />
</div>
</div>
<!-- 페이지네이션 -->
@ -61,7 +69,7 @@
<script setup>
import { ref, computed, onMounted } from 'vue';
import BoardCard from '@/components/list/BoardCardList.vue';
import BoardCardList from '@/components/list/BoardCardList.vue';
import Pagination from '@c/pagination/Pagination.vue';
import SearchBar from '@c/search/SearchBar.vue';
import router from '@/router';
@ -102,7 +110,7 @@ const search = (e) => {
};
//
const handleSortChange = (event) => {
const handleSortChange = () => {
fetchGeneralPosts(1);
};
@ -125,8 +133,8 @@ const fetchGeneralPosts = async (page = 1) => {
id: post.id || index,
img: post.img || null,
views: post.cnt || 0,
likes: post.likeCount || 0,
comments: post.commentCount || 0,
likes: post.likeCount != null ? post.likeCount : null,
comments: post.commentCount != null ? post.commentCount : null,
attachment: post.hasAttachment || false,
}));
@ -164,8 +172,6 @@ const fetchNoticePosts = async () => {
id: post.id || index,
img: post.img || null,
views: post.cnt || 0,
likes: post.likeCount || 0,
comments: post.commentCount || 0,
attachment: post.hasAttachment || false,
}));
} else {