From 882284bbb490c0d0368cca19add78562e8ab91ae Mon Sep 17 00:00:00 2001 From: dyhj625 Date: Mon, 20 Jan 2025 16:23:30 +0900 Subject: [PATCH 01/11] =?UTF-8?q?board-0117=EB=A8=B8=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/list/BoardCard.vue | 102 +++++++----- src/components/list/BoardCardList.vue | 1 + src/components/pagination/Pagination.vue | 139 +++++++++++++--- src/views/board/BoardList.vue | 201 ++++++++++++++++------- 4 files changed, 319 insertions(+), 124 deletions(-) diff --git a/src/components/list/BoardCard.vue b/src/components/list/BoardCard.vue index d47ff53..a64f91f 100644 --- a/src/components/list/BoardCard.vue +++ b/src/components/list/BoardCard.vue @@ -11,7 +11,7 @@ /> -
+
@@ -23,9 +23,12 @@

{{ content }}

- {{ formatDate(date) }} - + {{ formattedDate }} +
+ + {{ views || 0 }} + {{ likes || 0 }} @@ -40,49 +43,60 @@
- From ae1ef9aa4f1ae4636e35ab12fa399059e61eeaa9 Mon Sep 17 00:00:00 2001 From: dyhj625 Date: Tue, 21 Jan 2025 10:31:41 +0900 Subject: [PATCH 02/11] =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=95=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/pagination/Pagination.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/pagination/Pagination.vue b/src/components/pagination/Pagination.vue index 1dc6f68..8eb7234 100644 --- a/src/components/pagination/Pagination.vue +++ b/src/components/pagination/Pagination.vue @@ -4,7 +4,7 @@
  • @@ -15,7 +15,7 @@
  • From 1d441b662feb091536bd16d39a66410e57ba0eab Mon Sep 17 00:00:00 2001 From: dyhj625 Date: Tue, 21 Jan 2025 10:32:19 +0900 Subject: [PATCH 03/11] =?UTF-8?q?=ED=94=84=EB=A1=AD=EC=8A=A4=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/list/BoardCard.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/list/BoardCard.vue b/src/components/list/BoardCard.vue index a64f91f..f15061b 100644 --- a/src/components/list/BoardCard.vue +++ b/src/components/list/BoardCard.vue @@ -55,7 +55,7 @@ const props = defineProps({ }, category: { type: String, - required: true, + required: false, }, title: { type: String, From 61fe8ace7c67bd24770b2455b3d351c1dcec1f25 Mon Sep 17 00:00:00 2001 From: dyhj625 Date: Tue, 21 Jan 2025 13:02:47 +0900 Subject: [PATCH 04/11] =?UTF-8?q?=EA=B2=8C=EC=8B=9C=ED=8C=90=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1=ED=95=98=EA=B8=B0,=EC=83=81=EC=84=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/board/BoardView.vue | 41 +++++++----- src/views/board/BoardWrite.vue | 111 +++++++++++++-------------------- 2 files changed, 71 insertions(+), 81 deletions(-) diff --git a/src/views/board/BoardView.vue b/src/views/board/BoardView.vue index d848449..c06c5fc 100644 --- a/src/views/board/BoardView.vue +++ b/src/views/board/BoardView.vue @@ -5,28 +5,25 @@
    - +
    @@ -42,11 +39,14 @@ import BoardProfile from '@c/board/BoardProfile.vue'; import { ref, onMounted } from 'vue'; import { useRoute, useRouter } from 'vue-router'; import axios from '@api'; +import Quill from 'quill'; +import DOMPurify from 'dompurify'; // 게시물 데이터 상태 const profileName = ref('익명 사용자'); const boardTitle = ref('제목 없음'); -const boardContent = ref('내용 없음'); +const boardContent = ref(''); +const convertedContent = ref('내용 없음'); const comments = ref([]); const attachments = ref([]); @@ -54,7 +54,6 @@ const attachments = ref([]); const route = useRoute(); const router = useRouter(); const currentBoardId = ref(Number(route.params.id)); -console.log(currentBoardId.value) // 글 수정 페이지로 이동 const goToEditPage = () => { @@ -71,7 +70,22 @@ const fetchBoardDetails = async () => { const boardDetail = data.boardDetail || {}; profileName.value = boardDetail.author || '익명 사용자'; boardTitle.value = boardDetail.title || '제목 없음'; - boardContent.value = boardDetail.content || '내용 없음'; + boardContent.value = boardDetail.content || ''; + + // Quill을 사용하여 Delta 데이터를 HTML로 변환 + if (boardContent.value) { + try { + const quillContainer = document.createElement('div'); + const quillInstance = new Quill(quillContainer); + quillInstance.setContents(JSON.parse(boardContent.value)); + convertedContent.value = DOMPurify.sanitize(quillContainer.innerHTML); + } catch (parseError) { + console.error('Delta 데이터 변환 오류:', parseError); + convertedContent.value = '내용을 표시할 수 없습니다.'; + } + } else { + convertedContent.value = '내용 없음'; + } attachments.value = data.attachments || []; comments.value = data.comments || []; @@ -83,7 +97,6 @@ const fetchBoardDetails = async () => { // 컴포넌트 마운트 시 데이터 로드 onMounted(() => { - console.log('Route Params:', route.params); fetchBoardDetails(); }); diff --git a/src/views/board/BoardWrite.vue b/src/views/board/BoardWrite.vue index 2ff95ec..a091174 100644 --- a/src/views/board/BoardWrite.vue +++ b/src/views/board/BoardWrite.vue @@ -9,36 +9,52 @@
    - + - + - +
    -
    - +
    @@ -49,114 +65,75 @@ - From 795f740ee944cb46647735f5ca34456485ab69b9 Mon Sep 17 00:00:00 2001 From: dyhj625 Date: Tue, 21 Jan 2025 13:02:57 +0900 Subject: [PATCH 05/11] =?UTF-8?q?=E3=85=81=E3=85=81=E3=85=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/board/BoardView.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/board/BoardView.vue b/src/views/board/BoardView.vue index c06c5fc..f655bfc 100644 --- a/src/views/board/BoardView.vue +++ b/src/views/board/BoardView.vue @@ -19,7 +19,7 @@
  • - +
    -
    {{ title }}
    +
    + {{ title }} + + + +

    {{ content }}

    @@ -81,6 +86,10 @@ const props = defineProps({ type: Number, default: 0, }, + attachment: { + type: Boolean, + default: false, + } }); // computed 속성 diff --git a/src/components/list/BoardCardList.vue b/src/components/list/BoardCardList.vue index 3c66287..23f55ca 100644 --- a/src/components/list/BoardCardList.vue +++ b/src/components/list/BoardCardList.vue @@ -13,6 +13,7 @@ :views="post.views" :likes="post.likes" :comments="post.comments" + :attachment="post.attachment" />
    diff --git a/src/views/board/BoardList.vue b/src/views/board/BoardList.vue index a3af0b9..2f5d056 100644 --- a/src/views/board/BoardList.vue +++ b/src/views/board/BoardList.vue @@ -11,10 +11,9 @@
    - + +
    @@ -27,7 +26,7 @@
    -
    +

    공지사항

    @@ -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); From 10e48404db3e8bc273e2e6d5b20edbee33265cff Mon Sep 17 00:00:00 2001 From: dyhj625 Date: Tue, 21 Jan 2025 13:40:37 +0900 Subject: [PATCH 08/11] =?UTF-8?q?khj=20=EB=A8=B8=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/input/FormInput.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/input/FormInput.vue b/src/components/input/FormInput.vue index 12a8e79..7f005e6 100644 --- a/src/components/input/FormInput.vue +++ b/src/components/input/FormInput.vue @@ -1,6 +1,6 @@