From 563f2aceb48dc486f7cec3325a3bed026593cb77 Mon Sep 17 00:00:00 2001 From: Daeuni Date: Wed, 24 Sep 2025 15:02:46 +0900 Subject: [PATCH 1/3] =?UTF-8?q?fix=20=EC=A2=8B=EC=95=84=EC=9A=94=20?= =?UTF-8?q?=EA=B3=A0=EC=B9=A8..?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../community/_api/types/PostResponse.ts | 1 + .../community/_components/CommentItem.vue | 119 +++++++++++------- .../community/_components/CommentWrap.vue | 2 +- 3 files changed, 75 insertions(+), 47 deletions(-) diff --git a/app/pages/community/_api/types/PostResponse.ts b/app/pages/community/_api/types/PostResponse.ts index 984bd8e..cd40135 100644 --- a/app/pages/community/_api/types/PostResponse.ts +++ b/app/pages/community/_api/types/PostResponse.ts @@ -6,4 +6,5 @@ export interface PostResponse { userId: number; createdAt: string; modifiedAt: string; + likeByUser: boolean; } diff --git a/app/pages/community/_components/CommentItem.vue b/app/pages/community/_components/CommentItem.vue index ca4e2f5..c04ece2 100644 --- a/app/pages/community/_components/CommentItem.vue +++ b/app/pages/community/_components/CommentItem.vue @@ -10,7 +10,7 @@ {{ comment }}
-
+
- {{ likeCount }} + {{ currentLikeCount }}
@@ -39,24 +39,78 @@ import CommentIcon from "~/assets/icon/commentIcon.svg"; import Like from "~/assets/icon/like.svg"; import FilledLike from "~/assets/icon/filledHeart.svg"; import dayjs from "dayjs"; -import { useMutation, useQueryClient } from "@tanstack/vue-query"; +import { useMutation } from "@tanstack/vue-query"; import { apiInstance } from "~/utils/api"; -const isLike = ref(false); +const props = defineProps({ + writer: { + type: String, + default: "작성자", + }, + date: { + type: String, + default: "", + }, + comment: { + type: String, + default: "", + }, + commentCount: { + type: Number, + default: 1, + }, + likeCount: { + type: Number, + default: 1, + }, + userId: { + type: Number, + default: 1, + }, + postId: { + type: Number, + required: true, + }, + likeByUser: { + type: Boolean, + default: false, + }, +}); + +// props.likeByUser로 초기값 설정 +const isLike = ref(props.likeByUser); +const currentLikeCount = ref(props.likeCount); + +// props가 변경될 때 isLike 상태도 업데이트 +watch( + () => props.likeByUser, + (newValue) => { + isLike.value = newValue; + } +); + +// likeCount props가 변경될 때 currentLikeCount도 업데이트 +watch( + () => props.likeCount, + (newValue) => { + currentLikeCount.value = newValue; + } +); const handleClickLike = () => { - isLike.value = !isLike.value; - if (isLike.value === true) { + if (isLike.value) { + // 현재 좋아요 상태라면 취소 + handleDelete(); + } else { + // 현재 좋아요가 아니라면 좋아요 추가 clickLike({ userId: props.userId, postId: props.postId, }); - } else { - handleDelete(); } }; -const queryClient = useQueryClient(); +// const queryClient = useQueryClient(); const { mutate: clickLike } = useMutation({ mutationFn: async (postData: { userId: number; postId: number }) => { @@ -69,9 +123,11 @@ const { mutate: clickLike } = useMutation({ }, onSuccess: (data) => { console.log("좋아요 생성 성공:", data); - queryClient.invalidateQueries({ - queryKey: ["post", props.postId], - }); + isLike.value = true; + currentLikeCount.value += 1; + // queryClient.invalidateQueries({ + // queryKey: ["post", props.postId], + // }); }, onError: (error) => { console.error("좋아요 생성 실패:", error); @@ -91,9 +147,11 @@ const { mutate: cancelLike } = useMutation({ }, onSuccess: () => { console.log("좋아요 삭제 성공"); - queryClient.invalidateQueries({ - queryKey: ["replies", props.postId], - }); + isLike.value = false; + currentLikeCount.value = Math.max(0, currentLikeCount.value - 1); + // queryClient.invalidateQueries({ + // queryKey: ["replies", props.postId], + // }); }, onError: (error) => { console.error(`좋아요 삭제 실패했습니다: ${error.message}`); @@ -103,35 +161,4 @@ const { mutate: cancelLike } = useMutation({ const handleDelete = () => { cancelLike(props.postId); }; - -const props = defineProps({ - writer: { - type: String, - default: "작성자", - }, - date: { - type: String, - default: "", - }, - comment: { - type: String, - default: "", - }, - commentCount: { - type: Number, - default: 1, - }, - likeCount: { - type: Number, - default: 1, - }, - userId: { - type: Number, - default: 1, - }, - postId: { - type: Number, - required: true, - }, -}); diff --git a/app/pages/community/_components/CommentWrap.vue b/app/pages/community/_components/CommentWrap.vue index c0f8880..7bbd23d 100644 --- a/app/pages/community/_components/CommentWrap.vue +++ b/app/pages/community/_components/CommentWrap.vue @@ -78,7 +78,7 @@ :comment="post.content" :comment-count="post.commentCount" :like-count="post.likeCount" - :like-by-user="true" + :like-by-user="post.likeByUser" :user-id="1" :post-id="post.postId" @click="handlePostClick(post.postId)" From f65c0477ad0cff3181496a8557991652d52d503e Mon Sep 17 00:00:00 2001 From: Daeuni Date: Wed, 24 Sep 2025 15:20:03 +0900 Subject: [PATCH 2/3] =?UTF-8?q?style:=20=EC=B2=B4=ED=81=AC=EB=A6=AC?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=ED=8F=B0=ED=8A=B8=ED=81=AC=EA=B8=B0=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/pages/checklist/index.vue | 50 +++++++++++-------- .../community/_components/CommentItem.vue | 10 ---- .../community/_components/CommentWrap.vue | 1 - 3 files changed, 30 insertions(+), 31 deletions(-) diff --git a/app/pages/checklist/index.vue b/app/pages/checklist/index.vue index 8324862..5f59fe0 100644 --- a/app/pages/checklist/index.vue +++ b/app/pages/checklist/index.vue @@ -29,7 +29,7 @@
-
+
보증보험 가입 가능 여부 확인
@@ -40,12 +40,12 @@
-
+
중개업자 신원 확인
- + 국토부 중개사 조회 사이트 @@ -58,14 +58,14 @@
-
+
등기부등본 확인
- 등기부등본은 부동산 또는 - 대법원 인터넷등기소 - + 등기부등본은 부동산 또는 + 대법원 인터넷등기소 + 를 통해 반드시 확인해야할 정보입니다.
실제 집주인이 누구인지 확인하고 근저당이나 압류 여부를 확인할 수 있습니다. @@ -85,8 +85,12 @@
- 확정일자 및 전입신고 - 가능 여부 확인 + + 확정일자 및 전입신고 + + + 가능 여부 확인 +
확정일자와 전입신고가 가능해야지만 보증금을 법적으로 보호할 수 있습니다. @@ -102,12 +106,14 @@
- 선순위 계약자 - 확인 +
+ 선순위 계약자 + 확인 +
입주하기 전 반드시 - + 주민센터나 정부24에서 전세입자의 전출 여부를 확인 @@ -132,16 +138,20 @@
-
+
등기부등본은 말소된 내역이 포함된
- 등기사항 전부 증명서 유형 - 으로 발급 받아야합니다. + + 등기사항 전부 증명서 유형 + + + 으로 발급 받아야합니다. +
-
+
가압류, 가처분, 가등기, 근저당권 등에 대해 말소된
내역을 찾아야 합니다. @@ -150,7 +160,7 @@
-
+
말소된 이력에 대해 임대인에게 채권자로부터 채권변제
확인서 발급을 꼭 요청해야합니다. @@ -161,11 +171,11 @@
- 요청을 거부한다면, - + 요청을 거부한다면, + 해당 매물은 피하는 것이 안전 - 합니다. + 합니다.
diff --git a/app/pages/community/_components/CommentItem.vue b/app/pages/community/_components/CommentItem.vue index c04ece2..e118e36 100644 --- a/app/pages/community/_components/CommentItem.vue +++ b/app/pages/community/_components/CommentItem.vue @@ -99,10 +99,8 @@ watch( const handleClickLike = () => { if (isLike.value) { - // 현재 좋아요 상태라면 취소 handleDelete(); } else { - // 현재 좋아요가 아니라면 좋아요 추가 clickLike({ userId: props.userId, postId: props.postId, @@ -110,8 +108,6 @@ const handleClickLike = () => { } }; -// const queryClient = useQueryClient(); - const { mutate: clickLike } = useMutation({ mutationFn: async (postData: { userId: number; postId: number }) => { console.log("게시글 좋아요 누른 데이터:", postData); @@ -125,9 +121,6 @@ const { mutate: clickLike } = useMutation({ console.log("좋아요 생성 성공:", data); isLike.value = true; currentLikeCount.value += 1; - // queryClient.invalidateQueries({ - // queryKey: ["post", props.postId], - // }); }, onError: (error) => { console.error("좋아요 생성 실패:", error); @@ -149,9 +142,6 @@ const { mutate: cancelLike } = useMutation({ console.log("좋아요 삭제 성공"); isLike.value = false; currentLikeCount.value = Math.max(0, currentLikeCount.value - 1); - // queryClient.invalidateQueries({ - // queryKey: ["replies", props.postId], - // }); }, onError: (error) => { console.error(`좋아요 삭제 실패했습니다: ${error.message}`); diff --git a/app/pages/community/_components/CommentWrap.vue b/app/pages/community/_components/CommentWrap.vue index 7bbd23d..361258a 100644 --- a/app/pages/community/_components/CommentWrap.vue +++ b/app/pages/community/_components/CommentWrap.vue @@ -138,7 +138,6 @@ import PostReply from "./PostReply.vue"; import type { ReplyResponse } from "../_api/types/ReplyResponse"; import type { PostResponse } from "../_api/types/PostResponse"; -// Props 정의 const props = defineProps({ posts: { type: Array, From 3f4161ba7031b8ae14643df26a059c52da0c8f08 Mon Sep 17 00:00:00 2001 From: Daeuni Date: Thu, 25 Sep 2025 17:26:19 +0900 Subject: [PATCH 3/3] =?UTF-8?q?style:=20w,h=20=EC=A0=9C=EA=B1=B0,=20?= =?UTF-8?q?=EC=83=89=EC=83=81=EB=B3=80=EC=88=98=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../checklist/_components/CheckTipBox.vue | 4 +-- app/pages/checklist/index.vue | 24 +++++++-------- .../community/_components/CommentItem.vue | 14 ++++----- .../community/_components/CommentWrap.vue | 30 +++++++++---------- app/pages/community/_components/PostReply.vue | 6 ++-- app/pages/community/_components/ReplyItem.vue | 10 +++---- app/pages/community/_modals/PostComment.vue | 6 ++-- app/pages/community/index.vue | 7 +---- app/pages/credit/_components/StoreItem.vue | 8 ++--- app/pages/credit/_modals/Barcode.vue | 12 ++++---- app/pages/credit/creditStore.vue | 20 ++++++------- app/pages/credit/index.vue | 4 +-- app/pages/pricing/_components/PriceBox.vue | 2 +- app/pages/pricing/index.vue | 28 +++++++++-------- app/pages/quiz/Correct.vue | 4 +-- app/pages/quiz/False.vue | 4 +-- app/pages/quiz/_components/Explain.vue | 16 +++++----- app/pages/quiz/_modals/CompleteQuiz.vue | 16 +++++----- app/pages/quiz/index.vue | 2 +- app/pages/report/_components/Upload.vue | 14 ++++----- app/pages/report/_modals/UploadComplete.vue | 6 ++-- app/pages/report/index.vue | 8 ++--- 22 files changed, 116 insertions(+), 129 deletions(-) diff --git a/app/pages/checklist/_components/CheckTipBox.vue b/app/pages/checklist/_components/CheckTipBox.vue index 3a7b49f..1d213f5 100644 --- a/app/pages/checklist/_components/CheckTipBox.vue +++ b/app/pages/checklist/_components/CheckTipBox.vue @@ -1,9 +1,9 @@