From 8d6ae54a9bb3cb9c0aa262cb82b9e5dc2929da3c Mon Sep 17 00:00:00 2001 From: kimdaae328 Date: Fri, 21 Feb 2025 14:18:08 +0900 Subject: [PATCH 01/10] =?UTF-8?q?=EC=9D=B5=EB=AA=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/board/BoardProfile.vue | 2 +- src/views/board/BoardView.vue | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/board/BoardProfile.vue b/src/components/board/BoardProfile.vue index 796ab40..766bc31 100644 --- a/src/components/board/BoardProfile.vue +++ b/src/components/board/BoardProfile.vue @@ -61,7 +61,7 @@ const props = defineProps({ }, profileName: { type: String, - default: null, + default: '익명', }, unknown: { type: Boolean, diff --git a/src/views/board/BoardView.vue b/src/views/board/BoardView.vue index e52e404..a0e0824 100644 --- a/src/views/board/BoardView.vue +++ b/src/views/board/BoardView.vue @@ -149,7 +149,7 @@ const comments = ref([]); const route = useRoute(); const router = useRouter(); const currentBoardId = ref(Number(route.params.id)); -const unknown = computed(() => profileName.value === null); +const unknown = computed(() => profileName.value === '익명'); const currentUserId = ref('김자바'); // 현재 로그인한 사용자 id const authorId = ref(null); // 작성자 id @@ -190,7 +190,7 @@ const fetchBoardDetails = async () => { // API 응답 데이터 반영 // const boardDetail = data.boardDetail || {}; - profileName.value = data.author || null; + profileName.value = data.author || '익명'; // 익명확인하고 싶을때 // profileName.value = 'null; @@ -277,7 +277,7 @@ const fetchComments = async (page = 1) => { commentId: comment.LOCCMTSEQ, // 댓글 ID boardId: comment.LOCBRDSEQ, parentId: comment.LOCCMTPNT, // 부모 ID - author: comment.author || null, + author: comment.author || '익명', content: comment.LOCCMTRPY, likeCount: comment.likeCount || 0, dislikeCount: comment.dislikeCount || 0, From 9bc34a02fced3dd2a66b5be64feb3a142118faed Mon Sep 17 00:00:00 2001 From: kimdaae328 Date: Fri, 21 Feb 2025 16:03:21 +0900 Subject: [PATCH 02/10] =?UTF-8?q?=EC=97=90=EB=9F=AC=EB=A9=94=EC=84=B8?= =?UTF-8?q?=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/board/BoardView.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/views/board/BoardView.vue b/src/views/board/BoardView.vue index a0e0824..8c50fe6 100644 --- a/src/views/board/BoardView.vue +++ b/src/views/board/BoardView.vue @@ -531,7 +531,7 @@ const submitPassword = async () => { } lastClickedButton.value = null; } else { - passwordAlert.value = "비밀번호가 일치하지 않습니다.????"; + passwordAlert.value = "비밀번호가 일치하지 않습니다."; } } catch (error) { // console.log("📌 전체 오류:", error); @@ -552,6 +552,7 @@ const submitPassword = async () => { // 댓글 삭제 (비밀번호 확인 후) const submitCommentPassword = async (comment, password) => { + if (!password) { passwordCommentAlert.value = "비밀번호를 입력해주세요."; return; @@ -564,12 +565,16 @@ const submitCommentPassword = async (comment, password) => { }); if (response.data.code === 200 && response.data.data === true) { + passwordCommentAlert.value = ""; comment.isCommentPassword = false; if (lastCommentClickedButton.value === "edit") { comment.isEditTextarea = true; + passwordCommentAlert.value = ""; + // handleSubmitEdit(comment, comment.content); } else if (lastCommentClickedButton.value === "delete") { + passwordCommentAlert.value = ""; deleteReplyComment(comment) } From 334aa3e22ad1fd01ce1e26bc983ccf427cea03a8 Mon Sep 17 00:00:00 2001 From: nevermoregb Date: Mon, 24 Feb 2025 12:47:31 +0900 Subject: [PATCH 03/10] =?UTF-8?q?menu,=20main=20=EB=A1=9C=EB=94=A9=20?= =?UTF-8?q?=EC=BD=98=EC=86=94=20=EC=A3=BC=EC=84=9D=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/NormalLayout.vue | 49 ++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/src/layouts/NormalLayout.vue b/src/layouts/NormalLayout.vue index e6af2d8..4d4d0f1 100644 --- a/src/layouts/NormalLayout.vue +++ b/src/layouts/NormalLayout.vue @@ -24,32 +24,31 @@ - + From 0b0c948725b9287fc14370a99140d16507e2ea02 Mon Sep 17 00:00:00 2001 From: nevermoregb Date: Mon, 24 Feb 2025 13:33:54 +0900 Subject: [PATCH 04/10] =?UTF-8?q?main.js=20=EC=8A=A4=ED=81=AC=EB=A6=BD?= =?UTF-8?q?=ED=8A=B8=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/main.js | 196 +++++++++++++++++++++++----------------------- 1 file changed, 97 insertions(+), 99 deletions(-) diff --git a/public/js/main.js b/public/js/main.js index 7937823..047566f 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -2,116 +2,114 @@ * Main */ -'use strict' +(function () { + // Initialize menu + //----------------- + let menu, animate; -let menu, animate -;(function () { - // Initialize menu - //----------------- + let layoutMenuEl = document.querySelectorAll('#layout-menu'); + layoutMenuEl.forEach(function (element) { + menu = new Menu(element, { + orientation: 'vertical', + closeChildren: false, + }); + // Change parameter to true if you want scroll animation + window.Helpers.scrollToActive((animate = false)); + window.Helpers.mainMenu = menu; + }); - let layoutMenuEl = document.querySelectorAll('#layout-menu') - layoutMenuEl.forEach(function (element) { - menu = new Menu(element, { - orientation: 'vertical', - closeChildren: false, - }) - // Change parameter to true if you want scroll animation - window.Helpers.scrollToActive((animate = false)) - window.Helpers.mainMenu = menu - }) + // Initialize menu togglers and bind click on each + let menuToggler = document.querySelectorAll('.layout-menu-toggle'); + menuToggler.forEach(item => { + item.addEventListener('click', event => { + event.preventDefault(); + window.Helpers.toggleCollapsed(); + }); + }); - // Initialize menu togglers and bind click on each - let menuToggler = document.querySelectorAll('.layout-menu-toggle') - menuToggler.forEach((item) => { - item.addEventListener('click', (event) => { - event.preventDefault() - window.Helpers.toggleCollapsed() - }) - }) + // Display menu toggle (layout-menu-toggle) on hover with delay + let delay = function (elem, callback) { + let timeout = null; + elem.onmouseenter = function () { + // Set timeout to be a timer which will invoke callback after 300ms (not for small screen) + if (!Helpers.isSmallScreen()) { + timeout = setTimeout(callback, 300); + } else { + timeout = setTimeout(callback, 0); + } + }; - // Display menu toggle (layout-menu-toggle) on hover with delay - let delay = function (elem, callback) { - let timeout = null - elem.onmouseenter = function () { - // Set timeout to be a timer which will invoke callback after 300ms (not for small screen) - if (!Helpers.isSmallScreen()) { - timeout = setTimeout(callback, 300) - } else { - timeout = setTimeout(callback, 0) - } + elem.onmouseleave = function () { + // Clear any timers set to timeout + document.querySelector('.layout-menu-toggle').classList.remove('d-block'); + clearTimeout(timeout); + }; + }; + if (document.getElementById('layout-menu')) { + delay(document.getElementById('layout-menu'), function () { + // not for small screen + if (!Helpers.isSmallScreen()) { + document.querySelector('.layout-menu-toggle').classList.add('d-block'); + } + }); } - elem.onmouseleave = function () { - // Clear any timers set to timeout - document.querySelector('.layout-menu-toggle').classList.remove('d-block') - clearTimeout(timeout) + // Display in main menu when menu scrolls + let menuInnerContainer = document.getElementsByClassName('menu-inner'), + menuInnerShadow = document.getElementsByClassName('menu-inner-shadow')[0]; + if (menuInnerContainer.length > 0 && menuInnerShadow) { + menuInnerContainer[0].addEventListener('ps-scroll-y', function () { + if (this.querySelector('.ps__thumb-y').offsetTop) { + menuInnerShadow.style.display = 'block'; + } else { + menuInnerShadow.style.display = 'none'; + } + }); } - } - if (document.getElementById('layout-menu')) { - delay(document.getElementById('layout-menu'), function () { - // not for small screen - if (!Helpers.isSmallScreen()) { - document.querySelector('.layout-menu-toggle').classList.add('d-block') - } - }) - } - // Display in main menu when menu scrolls - let menuInnerContainer = document.getElementsByClassName('menu-inner'), - menuInnerShadow = document.getElementsByClassName('menu-inner-shadow')[0] - if (menuInnerContainer.length > 0 && menuInnerShadow) { - menuInnerContainer[0].addEventListener('ps-scroll-y', function () { - if (this.querySelector('.ps__thumb-y').offsetTop) { - menuInnerShadow.style.display = 'block' - } else { - menuInnerShadow.style.display = 'none' - } - }) - } + // Init helpers & misc + // -------------------- - // Init helpers & misc - // -------------------- + // Init BS Tooltip + const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')); + tooltipTriggerList.map(function (tooltipTriggerEl) { + return new bootstrap.Tooltip(tooltipTriggerEl); + }); - // Init BS Tooltip - const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')) - tooltipTriggerList.map(function (tooltipTriggerEl) { - return new bootstrap.Tooltip(tooltipTriggerEl) - }) + // Accordion active class + const accordionActiveFunction = function (e) { + if (e.type == 'show.bs.collapse' || e.type == 'show.bs.collapse') { + e.target.closest('.accordion-item').classList.add('active'); + } else { + e.target.closest('.accordion-item').classList.remove('active'); + } + }; - // Accordion active class - const accordionActiveFunction = function (e) { - if (e.type == 'show.bs.collapse' || e.type == 'show.bs.collapse') { - e.target.closest('.accordion-item').classList.add('active') - } else { - e.target.closest('.accordion-item').classList.remove('active') + const accordionTriggerList = [].slice.call(document.querySelectorAll('.accordion')); + const accordionList = accordionTriggerList.map(function (accordionTriggerEl) { + accordionTriggerEl.addEventListener('show.bs.collapse', accordionActiveFunction); + accordionTriggerEl.addEventListener('hide.bs.collapse', accordionActiveFunction); + }); + + // Auto update layout based on screen size + window.Helpers.setAutoUpdate(true); + + // Toggle Password Visibility + window.Helpers.initPasswordToggle(); + + // Speech To Text + window.Helpers.initSpeechToText(); + + // Manage menu expanded/collapsed with templateCustomizer & local storage + //------------------------------------------------------------------ + + // If current layout is horizontal OR current window screen is small (overlay menu) than return from here + if (window.Helpers.isSmallScreen()) { + return; } - } - const accordionTriggerList = [].slice.call(document.querySelectorAll('.accordion')) - const accordionList = accordionTriggerList.map(function (accordionTriggerEl) { - accordionTriggerEl.addEventListener('show.bs.collapse', accordionActiveFunction) - accordionTriggerEl.addEventListener('hide.bs.collapse', accordionActiveFunction) - }) + // If current layout is vertical and current window screen is > small - // Auto update layout based on screen size - window.Helpers.setAutoUpdate(true) - - // Toggle Password Visibility - window.Helpers.initPasswordToggle() - - // Speech To Text - window.Helpers.initSpeechToText() - - // Manage menu expanded/collapsed with templateCustomizer & local storage - //------------------------------------------------------------------ - - // If current layout is horizontal OR current window screen is small (overlay menu) than return from here - if (window.Helpers.isSmallScreen()) { - return - } - - // If current layout is vertical and current window screen is > small - - // Auto update menu collapsed/expanded based on the themeConfig - window.Helpers.setCollapsed(true, false) -})() + // Auto update menu collapsed/expanded based on the themeConfig + window.Helpers.setCollapsed(true, false); +})(); From a935bcf4d5922283ad015c66de6241e776d43bd9 Mon Sep 17 00:00:00 2001 From: kimdaae328 Date: Mon, 24 Feb 2025 14:04:17 +0900 Subject: [PATCH 05/10] =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=9D=B5?= =?UTF-8?q?=EB=AA=85=20=EC=A7=84=ED=96=89=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/board/BoardComment.vue | 16 ++++-- src/components/board/BoardCommentArea.vue | 6 +- src/components/board/BoardCommentList.vue | 7 ++- src/components/board/BoardProfile.vue | 9 ++- src/views/board/BoardView.vue | 68 +++++++++++++++-------- 5 files changed, 73 insertions(+), 33 deletions(-) diff --git a/src/components/board/BoardComment.vue b/src/components/board/BoardComment.vue index 932c36f..2bcdc10 100644 --- a/src/components/board/BoardComment.vue +++ b/src/components/board/BoardComment.vue @@ -2,6 +2,7 @@
{{ passwordCommentAlert }}
- +

authorId:{{ comment.authorId }}

+

코멘트 비교: {{comment.isCommentAuthor}}

+
diff --git a/src/views/board/BoardView.vue b/src/views/board/BoardView.vue index c7a5dcc..1c8b6b2 100644 --- a/src/views/board/BoardView.vue +++ b/src/views/board/BoardView.vue @@ -366,17 +366,26 @@ const fetchComments = async (page = 1) => { // const isSubmitting = ref(false); // 댓글 작성 -const handleCommentSubmit = async (data) => { - const { comment, password } = data; - const LOCBRDTYP = data.LOCBRDTYP || null; // undefined 방지 +const handleCommentSubmit = async ({ comment, password }) => { + console.log('댓글') + //비밀번호 입력 안했을시 + // if (!password) { + // passwordAlert.value = "비밀번호를 입력해야 합니다."; + // return; + // } + + // console.log('비밀번호 눌렀음') + + // 중복 실행 방지 + // if (isSubmitting.value) return; + // isSubmitting.value = true; try { const response = await axios.post(`board/${currentBoardId.value}/comment`, { LOCBRDSEQ: currentBoardId.value, LOCCMTRPY: comment, LOCCMTPWD: password, - LOCCMTPNT: 1, - LOCBRDTYP // 익명 여부 전달 + LOCCMTPNT: 1 }); if (response.status === 200) { @@ -390,121 +399,48 @@ const handleCommentSubmit = async (data) => { } }; -// const handleCommentSubmit = async ({ comment, password, LOCBRDTYP }) => { -// console.log('댓글') -// //비밀번호 입력 안했을시 -// // if (!password) { -// // passwordAlert.value = "비밀번호를 입력해야 합니다."; -// // return; -// // } - -// // console.log('비밀번호 눌렀음') - -// // 중복 실행 방지 -// // if (isSubmitting.value) return; -// // isSubmitting.value = true; - -// try { -// // const response = await axios.post(`board/${currentBoardId.value}/comment`, { -// // LOCBRDSEQ: currentBoardId.value, -// // LOCCMTRPY: comment, -// // LOCCMTPWD: password, -// // LOCCMTPNT: 1 -// // }); - -// if (response.status === 200) { -// console.log('댓글 작성 성공:', response.data.message); -// await fetchComments(); -// } else { -// console.log('댓글 작성 실패:', response.data.message); -// } -// } catch (error) { -// console.log('댓글 작성 중 오류 발생:', error); -// } -// }; - // 대댓글 추가 (부모 `BoardCommentList`로부터 이벤트 받아서 처리) const handleCommentReply = async (reply) => { try { - // 익명 여부 체크 (체크박스가 체크되었을 경우 LOCBRDTYP을 300102로 설정) + // console.log('대댓글 작성 요청 데이터:', { + // LOCBRDSEQ: currentBoardId.value, + // LOCCMTRPY: reply.comment, + // LOCCMTPWD: reply.password || null, + // LOCCMTPNT: reply.parentId + // }); - const requestBody = { + const response = await axios.post(`board/${currentBoardId.value}/comment`, { LOCBRDSEQ: currentBoardId.value, LOCCMTRPY: reply.comment, LOCCMTPWD: reply.password || null, - LOCCMTPNT: reply.parentId, - LOCBRDTYP: reply.isCheck ? "300102" : null - }; - console.log(requestBody) - const response = await axios.post(`board/${currentBoardId.value}/comment`, requestBody); + LOCCMTPNT: reply.parentId + }); + + // 응답 데이터를 자세히 로그로 확인 + // console.log('대댓글 작성 응답:', { + // status: response.status, + // data: response.data, + // headers: response.headers + // }); if (response.status === 200) { - if (response.data.code === 200) { - console.log('✅ 대댓글 작성 성공:', response.data); - await fetchComments(); + if (response.data.code === 200) { // 서버 응답 코드도 확인 + console.log('대댓글 작성 성공:', response.data); + await fetchComments(); // 댓글 목록 새로고침 } else { - console.log('❌ 대댓글 작성 실패 - 서버 응답:', response.data); + console.log('대댓글 작성 실패 - 서버 응답:', response.data); alert('대댓글 작성에 실패했습니다.'); } } } catch (error) { - console.error('🚨 대댓글 작성 중 오류 발생:', error); + console.error('대댓글 작성 중 오류 발생:', error); if (error.response) { - console.error('📌 서버 응답 에러:', error.response.data); + console.error('서버 응답 에러:', error.response.data); } - alert('❌ 대댓글 작성 중 오류가 발생했습니다.'); + alert('대댓글 작성 중 오류가 발생했습니다.'); } -}; - -// const handleCommentReply = async (reply) => { -// try { -// // console.log('대댓글 작성 요청 데이터:', { -// // LOCBRDSEQ: currentBoardId.value, -// // LOCCMTRPY: reply.comment, -// // LOCCMTPWD: reply.password || null, -// // LOCCMTPNT: reply.parentId -// // }); - -// // const response = await axios.post(`board/${currentBoardId.value}/comment`, { -// // LOCBRDSEQ: currentBoardId.value, -// // LOCCMTRPY: reply.comment, -// // LOCCMTPWD: reply.password || null, -// // LOCCMTPNT: reply.parentId -// // }); -// const requestBody = { -// LOCBRDSEQ: currentBoardId.value, -// LOCCMTRPY: reply.comment, -// LOCCMTPWD: reply.password || null, -// LOCCMTPNT: reply.parentId, -// LOCBRDTYP -// }; - -// // 응답 데이터를 자세히 로그로 확인 -// // console.log('대댓글 작성 응답:', { -// // status: response.status, -// // data: response.data, -// // headers: response.headers -// // }); - -// const response = await axios.post(`board/${currentBoardId.value}/comment`, requestBody); -// if (response.status === 200) { -// if (response.data.code === 200) { // 서버 응답 코드도 확인 -// console.log('대댓글 작성 성공:', response.data); -// await fetchComments(); // 댓글 목록 새로고침 -// } else { -// console.log('대댓글 작성 실패 - 서버 응답:', response.data); -// alert('대댓글 작성에 실패했습니다.'); -// } -// } -// } catch (error) { -// console.error('대댓글 작성 중 오류 발생:', error); -// if (error.response) { -// console.error('서버 응답 에러:', error.response.data); -// } -// alert('대댓글 작성 중 오류가 발생했습니다.'); -// } -// } +} // 게시글 수정 버튼 클릭 const editClick = (unknown) => {