From 16f48f9e8738c9909aab88bb351894d829785881 Mon Sep 17 00:00:00 2001 From: NakyungSong Date: Fri, 20 Sep 2024 21:29:37 +0900 Subject: [PATCH 1/7] =?UTF-8?q?[Feat]=20=EB=A1=9C=EA=B7=B8=EC=9D=B8?= =?UTF-8?q?=ED=95=9C=20=EC=82=AC=EC=9A=A9=EC=9E=90=EC=99=80=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1=EC=9E=90=EA=B0=80=20=EB=8F=99=EC=9D=BC=ED=95=98?= =?UTF-8?q?=EA=B3=A0,=20=EB=8B=B5=EB=B3=80=EB=8C=80=EA=B8=B0=20=EC=83=81?= =?UTF-8?q?=ED=83=9C=EC=9D=BC=20=EB=95=8C=EB=A7=8C=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?=EB=B0=8F=20=EC=82=AD=EC=A0=9C=20=EB=B2=84=ED=8A=BC=20=ED=91=9C?= =?UTF-8?q?=EC=8B=9C=20(#189)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../board/BoardDetailNavComponent.vue | 23 +++++++++++++++---- frontend/src/stores/useQnaStore.js | 1 + 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/board/BoardDetailNavComponent.vue b/frontend/src/components/board/BoardDetailNavComponent.vue index a3d82e8d..44fd28e0 100644 --- a/frontend/src/components/board/BoardDetailNavComponent.vue +++ b/frontend/src/components/board/BoardDetailNavComponent.vue @@ -87,12 +87,13 @@ {{ row.content }}
-
+
-
+
@@ -125,11 +126,15 @@ import { useQnaStore } from "@/stores/useQnaStore"; import QnaRegisterModalComponent from "../qna/QnaRegisterModalComponent.vue"; import { mapStores } from "pinia"; +import { useUserStore } from "@/stores/useUserStore"; export default { name: "BoardDetailNavComponent", computed: { - ...mapStores(useQnaStore), + ...mapStores(useQnaStore, useUserStore), + userEmail() { + return this.userStore.userDetail.email || "email 세팅 안 됨"; + }, }, props: { thumbnails: { @@ -164,8 +169,16 @@ export default { methods: { loadInquiries() { this.activeTab = "inquiries"; // 문의 탭 활성화 - this.qnaStore.fetchInquiries().then(() => { - this.localTableData = this.qnaStore.inquiries; + + this.userStore.getDetail().then(() => { + const userEmail = this.userStore.userDetail.email; + console.log("로그인된 사용자의 이메일:", userEmail); + + this.qnaStore.fetchInquiries().then(() => { + this.localTableData = this.qnaStore.inquiries; + console.log("문의 탭 눌렀을 때 로드되는 것들:", this.localTableData); + console.log("로그인된 사람의 email 받아오는 거:", this.userEmail); + }); }); }, formatDate(dateString) { diff --git a/frontend/src/stores/useQnaStore.js b/frontend/src/stores/useQnaStore.js index 85ce1ccc..64ca8641 100644 --- a/frontend/src/stores/useQnaStore.js +++ b/frontend/src/stores/useQnaStore.js @@ -12,6 +12,7 @@ export const useQnaStore = defineStore("qna", { const response = await axios.get('/api/qna/question/list'); // 실제 API URL if (response.data.isSuccess) { this.inquiries = response.data.result; + console.log(this.inquiries); } else { console.error('문의 목록을 불러오는 중 오류 발생:', response.data.message); } From ec1b9e6fd8773aaa26295bc77897366242df4b2f Mon Sep 17 00:00:00 2001 From: NakyungSong Date: Fri, 20 Sep 2024 23:37:48 +0900 Subject: [PATCH 2/7] =?UTF-8?q?[Feat]=20=EB=AC=B8=EC=9D=98=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20API=20=ED=94=84=EB=A1=A0=ED=8A=B8=EC=97=94=EB=93=9C?= =?UTF-8?q?=20=EC=97=B0=EB=8F=99=20(#189)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../board/BoardDetailNavComponent.vue | 13 +++++-------- .../qna/QnaRegisterModalComponent.vue | 13 +++++++++---- frontend/src/stores/useQnaStore.js | 17 ++++++++++++++--- 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/frontend/src/components/board/BoardDetailNavComponent.vue b/frontend/src/components/board/BoardDetailNavComponent.vue index 44fd28e0..82bf637f 100644 --- a/frontend/src/components/board/BoardDetailNavComponent.vue +++ b/frontend/src/components/board/BoardDetailNavComponent.vue @@ -90,7 +90,7 @@
- +
@@ -176,8 +176,6 @@ export default { this.qnaStore.fetchInquiries().then(() => { this.localTableData = this.qnaStore.inquiries; - console.log("문의 탭 눌렀을 때 로드되는 것들:", this.localTableData); - console.log("로그인된 사람의 email 받아오는 거:", this.userEmail); }); }); }, @@ -221,8 +219,7 @@ export default { el.style.maxHeight = "0px"; }, addNewInquiry(newInquiry) { - newInquiry.created_at = new Date().toISOString().split("T")[0]; - this.localTableData.push(newInquiry); + newInquiry.email = this.userEmail; // 로그인된 사용자의 이메일을 새 문의에 추가 this.closeModal(); }, updateInquiry(updatedInquiry) { @@ -237,9 +234,9 @@ export default { this.closeModal(); } }, - deleteInquiry(index) { - // 문의를 삭제할 때, 현재 토글된 인덱스를 초기화 - this.localTableData.splice(index, 1); // 해당 인덱스의 문의 삭제 + deleteInquiry(idx, index) { + this.qnaStore.deleteInquiry(idx, index); + if (this.expandedInquiryIndex === index) { // 삭제된 인덱스가 현재 토글된 인덱스라면 초기화 this.expandedInquiryIndex = null; diff --git a/frontend/src/components/qna/QnaRegisterModalComponent.vue b/frontend/src/components/qna/QnaRegisterModalComponent.vue index cbbebf46..576d9705 100644 --- a/frontend/src/components/qna/QnaRegisterModalComponent.vue +++ b/frontend/src/components/qna/QnaRegisterModalComponent.vue @@ -91,6 +91,7 @@ import axios from 'axios'; import { useQnaStore } from "@/stores/useQnaStore"; import { mapStores } from "pinia"; +import { useUserStore } from "@/stores/useUserStore"; // 사용자 스토어 가져오기 export default { name: "QnaRegisterModalComponent", @@ -111,6 +112,10 @@ export default { type: String, required: true }, + productBoardIdx: { + type: Number, + required: true, // 상품 ID가 필수 값 + }, }, data() { return { @@ -132,7 +137,7 @@ export default { isFormValid() { return this.subject.trim().length >= 2 && this.content.trim().length >= 5; }, - ...mapStores(useQnaStore), + ...mapStores(useQnaStore, useUserStore), localTableData() { return this.qnaStore.inquiries; }, @@ -145,8 +150,8 @@ export default { const newInquiry = { title: this.subject, content: this.content, - userIdx: 1, // 추후 로그인된 사용자 IDX 사용 - productBoardIdx: 1, // 추후 해당 게시글 IDX 사용 + userIdx: this.userStore.userDetail.idx, // Pinia에서 userStore로부터 userIdx 가져오기 + productBoardIdx: this.productBoardIdx, // 추후 해당 게시글 IDX 사용 }; try { @@ -154,7 +159,7 @@ export default { if (response.data.isSuccess) { const registeredInquiry = response.data.result; // 응답으로 받은 데이터를 registeredInquiry에 저장 - + this.qnaStore.addInquiry(registeredInquiry); // 등록된 문의를 스토어에 추가 // 부모 컴포넌트에 데이터 전달 this.$emit("submit", registeredInquiry); this.closeModal(); diff --git a/frontend/src/stores/useQnaStore.js b/frontend/src/stores/useQnaStore.js index 64ca8641..bebf0015 100644 --- a/frontend/src/stores/useQnaStore.js +++ b/frontend/src/stores/useQnaStore.js @@ -9,7 +9,7 @@ export const useQnaStore = defineStore("qna", { actions: { async fetchInquiries() { try { - const response = await axios.get('/api/qna/question/list'); // 실제 API URL + const response = await axios.get('/api/qna/question/list'); if (response.data.isSuccess) { this.inquiries = response.data.result; console.log(this.inquiries); @@ -26,8 +26,19 @@ export const useQnaStore = defineStore("qna", { updateInquiry(index, updatedInquiry) { this.inquiries[index] = { ...this.inquiries[index], ...updatedInquiry }; }, - deleteInquiry(index) { - this.inquiries.splice(index, 1); + async deleteInquiry(idx, index) { + try { + // console.log('삭제 요청 경로:', `/api/qna/question/delete/${idx}`); + const response = await axios.delete(`/api/qna/question/delete/${idx}`); + if (response.data.isSuccess) { + this.inquiries.splice(index, 1); + console.log('문의가 성공적으로 삭제되었습니다.'); + } else { + console.error('문의 삭제 중 오류 발생:', response.data.message); + } + } catch (error) { + console.error('문의 삭제 중 오류 발생:', error); + } }, }, }); From b5b918b967ef9debe4f202090ceeff0bef42a269 Mon Sep 17 00:00:00 2001 From: NakyungSong Date: Sat, 21 Sep 2024 16:03:20 +0900 Subject: [PATCH 3/7] =?UTF-8?q?[Feat]=20=EB=AC=B8=EC=9D=98=20=ED=83=AD?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EA=B0=81=20=EB=AC=B8=EC=9D=98=EC=97=90=20?= =?UTF-8?q?=EB=8C=80=ED=95=9C=20=EB=8B=B5=EB=B3=80=20=EB=A6=AC=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=ED=99=94=EB=A9=B4=EC=97=90=20=ED=91=9C=EC=8B=9C=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=20(#189)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../board/BoardDetailNavComponent.vue | 67 +++++++++++-------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/frontend/src/components/board/BoardDetailNavComponent.vue b/frontend/src/components/board/BoardDetailNavComponent.vue index 82bf637f..0bd1437d 100644 --- a/frontend/src/components/board/BoardDetailNavComponent.vue +++ b/frontend/src/components/board/BoardDetailNavComponent.vue @@ -3,19 +3,19 @@
-
+
-
+
-
{{ row.answer_content }}
+
{{ answer.content }}
+
+
+ {{ answer.createdAt ? formatDate(answer.createdAt) : '작성 시간 없음' }}
-
-
- {{ row.answer_modified_at || row.answer_created_at }}
@@ -127,6 +126,7 @@ import { useQnaStore } from "@/stores/useQnaStore"; import QnaRegisterModalComponent from "../qna/QnaRegisterModalComponent.vue"; import { mapStores } from "pinia"; import { useUserStore } from "@/stores/useUserStore"; +import axios from "axios"; export default { name: "BoardDetailNavComponent", @@ -170,14 +170,26 @@ export default { loadInquiries() { this.activeTab = "inquiries"; // 문의 탭 활성화 - this.userStore.getDetail().then(() => { - const userEmail = this.userStore.userDetail.email; - console.log("로그인된 사용자의 이메일:", userEmail); - - this.qnaStore.fetchInquiries().then(() => { - this.localTableData = this.qnaStore.inquiries; + axios.get('/api/user/detail', { withCredentials: true }) + .then((response) => { + if (response.data.code === 1000) { + const userEmail = response.data.result.email; + console.log("로그인된 사용자의 이메일:", userEmail); + this.userStore.userDetail = response.data.result; + } else { + console.log("회원 정보를 가져오는 데 실패했습니다."); + } + }) + .catch((error) => { + // 에러가 발생해도 alert 대신 로그만 출력 + console.error("회원 정보 조회 중 오류 발생:", error); + }) + .finally(() => { + // 회원정보 조회에 성공하든 실패하든 문의 목록은 조회하도록 + this.qnaStore.fetchInquiries().then(() => { + this.localTableData = this.qnaStore.inquiries; + }); }); - }); }, formatDate(dateString) { const date = new Date(dateString); @@ -439,8 +451,7 @@ table { display: block; width: 14px; height: 14px; - background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTQiIHZpZXdCb3g9IjAgMCAxMiAxNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgIDxnIGZpbGw9IiNCNUI1QjUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPHBhdGggZD0iTTExLjA0MyAxMi41NzVhLjI1OS4yNTkgMCAwIDEtLjI1OC4yNTdIMS4yMTRhLjI1OS4yNTkgMCAwIDEtLjI1OC0uMjU3VjUuNDJjMC0uMTQyLjExNy0uMjU4LjI1OC0uMjU4aDkuNTdjLjE0NCAwIC4yNi4xMTYuMjYuMjU4djcuMTU1ek0zLjY4NSAzLjIzN0EyLjI4MyAyLjI4MyAwIDAgMSA1Ljk2Ni45NTdhMi4yODIgMi4yODIgMCAwIDEgMi4yODEgMi4yOHYuOTY4SDMuNjg1di0uOTY4em03LjEuOTY4aC0xLjU4di0uOTY4QTMuMjQxIDMuMjQxIDAgMCAwIDUuOTY1IDAgMy4yNCAzLjI0IDAgMCAwIDIuNzMgMy4yMzd2Ljk2OEgxLjIxNEMuNTQ0IDQuMjA1IDAgNC43NSAwIDUuNDJ2Ny4xNTVjMCAuNjY5LjU0NSAxLjIxNCAxLjIxNCAxLjIxNGg5LjU3Yy42NzEgMCAxLjIxNi0uNTQ1IDEuMjE2LTEuMjE0VjUuNDJjMC0uNjctLjU0NS0xLjIxNS0xLjIxNS0xLjIxNXoiLz4KICAgICAgICA8cGF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OTg2IDAgMCAwIDcgOC4yYTEgMSAwIDAgMC0yIDB6Ii8+CiAgICA8L2c+Cjwvc3ZnPgo=) no-repeat; margin-left: 6px; } @@ -492,7 +503,7 @@ table { cursor: default; } -.css-sxxs1g button + button { +.css-sxxs1g button+button { margin-left: 12px; } @@ -601,7 +612,7 @@ div { .css-1n83etr { display: flex; - padding: 22px 20px 10px; + padding: 22px 20px 25px; align-items: flex-start; } From 31bc358624c9626b2ca1c25d7790c4c68937b991 Mon Sep 17 00:00:00 2001 From: NakyungSong Date: Sun, 22 Sep 2024 10:57:28 +0900 Subject: [PATCH 4/7] =?UTF-8?q?[Feat]=20=EB=8B=B5=EB=B3=80=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=20=EB=AA=A8=EB=8B=AC=EC=B0=BD=EC=97=90=20=EB=8B=B5?= =?UTF-8?q?=EB=B3=80=20=EB=93=B1=EB=A1=9DAPI=20=EC=97=B0=EB=8F=99=20(#79)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../company/CompanyQnAManageComponent.vue | 150 +++++++++++------- .../company/CompanyQnAModalComponent.vue | 96 +++++++---- 2 files changed, 156 insertions(+), 90 deletions(-) diff --git a/frontend/src/components/company/CompanyQnAManageComponent.vue b/frontend/src/components/company/CompanyQnAManageComponent.vue index 655788d1..a3e23254 100644 --- a/frontend/src/components/company/CompanyQnAManageComponent.vue +++ b/frontend/src/components/company/CompanyQnAManageComponent.vue @@ -6,7 +6,6 @@ 번호 제목 작성자 - 상태 작성일 답변확인 @@ -14,103 +13,142 @@ - - - - - - 이벤트 문의 드립니다. - - - 심키즈 - - - - 답변 대기 - - - - 2024-09-05 - - - -
- -
- - - - - - - + - 상품 수량이 얼마나 남았나요? + {{ inquiry.title }} - 김키즈 + {{ maskAuthorName(inquiry.userName) }} - 답변 완료 + {{ inquiry.answerStatus }} - 2024-09-04 + {{ formatDate(inquiry.createdAt) }} - - +
diff --git a/frontend/src/components/company/CompanyQnAModalComponent.vue b/frontend/src/components/company/CompanyQnAModalComponent.vue index e5dbe3c9..78a50529 100644 --- a/frontend/src/components/company/CompanyQnAModalComponent.vue +++ b/frontend/src/components/company/CompanyQnAModalComponent.vue @@ -1,7 +1,7 @@ + + diff --git a/frontend/src/components/company/CompanyQnAManageComponent.vue b/frontend/src/components/company/CompanyQnAManageComponent.vue index a3e23254..9785fc8f 100644 --- a/frontend/src/components/company/CompanyQnAManageComponent.vue +++ b/frontend/src/components/company/CompanyQnAManageComponent.vue @@ -7,9 +7,9 @@ 제목 작성자 상태 - 작성일 - 답변확인 - 삭제 + 문의 등록일 + 답변등록 + 답변확인 @@ -40,44 +40,53 @@ - + + + :questionIdx="selectedInquiry.idx" @closeModal="closeModal" @registerAnswer="onAnswerRegistered" /> + + +
+ + From 0ec911a598dcb8def921367fadf1047c337648e8 Mon Sep 17 00:00:00 2001 From: NakyungSong Date: Mon, 23 Sep 2024 14:40:52 +0900 Subject: [PATCH 7/7] =?UTF-8?q?[Refactor]=20=ED=95=84=EC=9A=94=EC=97=86?= =?UTF-8?q?=EB=8A=94=20CSS=20=EC=A0=9C=EA=B1=B0=20(#91)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/mypage/MypageQnAComponent.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/mypage/MypageQnAComponent.vue b/frontend/src/components/mypage/MypageQnAComponent.vue index 601c004f..c5814b90 100644 --- a/frontend/src/components/mypage/MypageQnAComponent.vue +++ b/frontend/src/components/mypage/MypageQnAComponent.vue @@ -20,7 +20,7 @@ - +
@@ -52,7 +52,7 @@
-
+