Merge branch 'main' into login

This commit is contained in:
yoon 2025-01-21 20:48:49 +09:00
commit aeecd3836d

View File

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