diff --git a/src/views/board/BoardList.vue b/src/views/board/BoardList.vue
index d30734d..eda8118 100644
--- a/src/views/board/BoardList.vue
+++ b/src/views/board/BoardList.vue
@@ -26,7 +26,11 @@
-
+
+
+
+
+
@@ -56,6 +60,7 @@ import axios from '@api';
// 데이터 초기화
const list = ref([]);
+const list2 = ref([]);
const searchText = ref('');
// 상세 페이지 이동
@@ -68,16 +73,23 @@ const search = (e) => {
searchText.value = e.trim();
};
-// 검색 결과 필터링
+// 검색 결과 필터링(일반게시물)
const filteredList = computed(() =>
list.value.filter((item) =>
item.title.toLowerCase().includes(searchText.value.toLowerCase())
)
);
+// 검색 결과 필터링(공지사항)
+const filteredList2 = computed(() =>
+ list2.value.filter((item) =>
+ item.title.toLowerCase().includes(searchText.value.toLowerCase())
+ )
+);
+
// 페이지네이션 상태
const currentPage = ref(1); // 현재 페이지 번호
-const itemsPerPage = 5; // 한 페이지에 표시할 아이템 수
+const itemsPerPage = 10; // 한 페이지에 표시할 아이템 수
// 현재 페이지 데이터 계산
const paginatedList = computed(() => {
@@ -98,7 +110,7 @@ const changePage = (page) => {
}
};
-// 게시물 데이터 로드
+// 게시물 데이터 로드(일반)
const fetchPosts = async () => {
const response = await axios.get("board/general");
@@ -115,9 +127,32 @@ const fetchPosts = async () => {
}
};
+const fetchPosts2 = async () => {
+ try {
+ console.log('ㅁㄴㅇㅁㅇㅁ')
+ const response = await axios.get("board/notices");
+ console.log(response)
+
+ if (response.data && response.data.data && Array.isArray(response.data.data)) {
+ list2.value = response.data.data.map((post, index) => ({
+ ...post,
+ id: post.id || index,
+ img: post.img || null,
+ likes: post.likes || 0,
+ comments: post.comments || 0,
+ }));
+ } else {
+ console.error("데이터 오류:", response.data);
+ }
+ } catch (error) {
+ console.error("공지사항 데이터 로드 실패:", error);
+ }
+};
+
// 데이터 로드
onMounted(() => {
fetchPosts();
+ fetchPosts2();
});