board-select 머지
This commit is contained in:
parent
888eaba2e9
commit
3cef681449
@ -18,7 +18,12 @@
|
|||||||
{{ category }}
|
{{ category }}
|
||||||
</h6>
|
</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>
|
<p class="card-text str_wrap">{{ content }}</p>
|
||||||
<!-- 날짜 -->
|
<!-- 날짜 -->
|
||||||
@ -81,6 +86,10 @@ const props = defineProps({
|
|||||||
type: Number,
|
type: Number,
|
||||||
default: 0,
|
default: 0,
|
||||||
},
|
},
|
||||||
|
attachment: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// computed 속성
|
// computed 속성
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
:views="post.views"
|
:views="post.views"
|
||||||
:likes="post.likes"
|
:likes="post.likes"
|
||||||
:comments="post.comments"
|
:comments="post.comments"
|
||||||
|
:attachment="post.attachment"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,10 +11,9 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<!-- 정렬 셀렉트 박스 -->
|
<!-- 정렬 셀렉트 박스 -->
|
||||||
<div class="col-md-3 mb-4">
|
<div class="col-md-3 mb-4">
|
||||||
<select class="form-select" @change="handleSortChange">
|
<select class="form-select" v-model="selectedOrder" @change="handleSortChange">
|
||||||
<option value="">정렬 선택</option>
|
<option value="date">최신날짜</option>
|
||||||
<option value="view">조회수</option>
|
<option value="views">조회수</option>
|
||||||
<option value="date">날짜</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -27,7 +26,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 공지사항 게시물 리스트 -->
|
<!-- 공지사항 게시물 리스트 -->
|
||||||
<div class="row g-3 mt-8">
|
<div class="row g-3 mt-2 mt-md-8">
|
||||||
<h3>공지사항</h3>
|
<h3>공지사항</h3>
|
||||||
<board-card :posts="noticeList" @click="goDetail" />
|
<board-card :posts="noticeList" @click="goDetail" />
|
||||||
</div>
|
</div>
|
||||||
@ -73,7 +72,7 @@ import axios from '@api';
|
|||||||
const generalList = ref([]);
|
const generalList = ref([]);
|
||||||
const noticeList = ref([]);
|
const noticeList = ref([]);
|
||||||
const searchText = ref('');
|
const searchText = ref('');
|
||||||
const selectedOrder = ref('');
|
const selectedOrder = ref('date');
|
||||||
const sortDirection = ref('desc');
|
const sortDirection = ref('desc');
|
||||||
const pagination = ref({
|
const pagination = ref({
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
@ -104,17 +103,6 @@ const search = (e) => {
|
|||||||
|
|
||||||
// 정렬 변경 핸들러
|
// 정렬 변경 핸들러
|
||||||
const handleSortChange = (event) => {
|
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);
|
fetchGeneralPosts(1);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -139,6 +127,7 @@ const fetchGeneralPosts = async (page = 1) => {
|
|||||||
views: post.cnt || 0,
|
views: post.cnt || 0,
|
||||||
likes: post.likeCount || 0,
|
likes: post.likeCount || 0,
|
||||||
comments: post.commentCount || 0,
|
comments: post.commentCount || 0,
|
||||||
|
attachment: post.hasAttachment || false,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 페이지네이션 정보 업데이트
|
// 페이지네이션 정보 업데이트
|
||||||
@ -177,6 +166,7 @@ const fetchNoticePosts = async () => {
|
|||||||
views: post.cnt || 0,
|
views: post.cnt || 0,
|
||||||
likes: post.likeCount || 0,
|
likes: post.likeCount || 0,
|
||||||
comments: post.commentCount || 0,
|
comments: post.commentCount || 0,
|
||||||
|
attachment: post.hasAttachment || false,
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
console.error("데이터 오류:", response.data);
|
console.error("데이터 오류:", response.data);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user