Compare commits
8 Commits
main
...
board-sele
| Author | SHA1 | Date | |
|---|---|---|---|
| 9902be659e | |||
| ec6a3c6dc9 | |||
| 0274183e2e | |||
| ccd9f3f4d9 | |||
| 50ee4a7ec9 | |||
| 4e31041a07 | |||
| aef28a3887 | |||
| a7ef7c9599 |
@ -18,7 +18,12 @@
|
||||
{{ category }}
|
||||
</h6>
|
||||
<!-- 제목 -->
|
||||
<h5 class="card-title">{{ title }}</h5>
|
||||
<h5 class="card-title">
|
||||
{{ title }}
|
||||
<span class="text-muted me-3" v-if="attachment">
|
||||
<i class="fa-solid fa-paperclip"></i>
|
||||
</span>
|
||||
</h5>
|
||||
<!-- 본문 -->
|
||||
<p class="card-text str_wrap">{{ content }}</p>
|
||||
<!-- 날짜 -->
|
||||
@ -81,6 +86,10 @@ const props = defineProps({
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
attachment: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
}
|
||||
});
|
||||
|
||||
// computed 속성
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
:views="post.views"
|
||||
:likes="post.likes"
|
||||
:comments="post.comments"
|
||||
:attachment="post.attachment"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -11,10 +11,9 @@
|
||||
<div class="row">
|
||||
<!-- 정렬 셀렉트 박스 -->
|
||||
<div class="col-md-3 mb-4">
|
||||
<select class="form-select" @change="handleSortChange">
|
||||
<option value="">정렬 선택</option>
|
||||
<option value="view">조회수</option>
|
||||
<option value="date">날짜</option>
|
||||
<select class="form-select" v-model="selectedOrder" @change="handleSortChange">
|
||||
<option value="date">최신날짜</option>
|
||||
<option value="views">조회수</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@ -27,7 +26,7 @@
|
||||
</div>
|
||||
|
||||
<!-- 공지사항 게시물 리스트 -->
|
||||
<div class="row g-3 mt-8">
|
||||
<div class="row g-3 mt-2 mt-md-8">
|
||||
<h3>공지사항</h3>
|
||||
<board-card :posts="noticeList" @click="goDetail" />
|
||||
</div>
|
||||
@ -73,7 +72,7 @@ import axios from '@api';
|
||||
const generalList = ref([]);
|
||||
const noticeList = ref([]);
|
||||
const searchText = ref('');
|
||||
const selectedOrder = ref('');
|
||||
const selectedOrder = ref('date');
|
||||
const sortDirection = ref('desc');
|
||||
const pagination = ref({
|
||||
currentPage: 1,
|
||||
@ -104,17 +103,6 @@ const search = (e) => {
|
||||
|
||||
// 정렬 변경 핸들러
|
||||
const handleSortChange = (event) => {
|
||||
const value = event.target.value;
|
||||
if (value === 'view') {
|
||||
selectedOrder.value = 'view';
|
||||
sortDirection.value = 'desc';
|
||||
} else if (value === 'date') {
|
||||
selectedOrder.value = 'date';
|
||||
sortDirection.value = 'desc';
|
||||
} else {
|
||||
selectedOrder.value = '';
|
||||
sortDirection.value = 'desc';
|
||||
};
|
||||
fetchGeneralPosts(1);
|
||||
};
|
||||
|
||||
@ -139,6 +127,7 @@ const fetchGeneralPosts = async (page = 1) => {
|
||||
views: post.cnt || 0,
|
||||
likes: post.likeCount || 0,
|
||||
comments: post.commentCount || 0,
|
||||
attachment: post.hasAttachment || false,
|
||||
}));
|
||||
|
||||
// 페이지네이션 정보 업데이트
|
||||
@ -177,6 +166,7 @@ const fetchNoticePosts = async () => {
|
||||
views: post.cnt || 0,
|
||||
likes: post.likeCount || 0,
|
||||
comments: post.commentCount || 0,
|
||||
attachment: post.hasAttachment || false,
|
||||
}));
|
||||
} else {
|
||||
console.error("데이터 오류:", response.data);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user