isDeleted 수정중
This commit is contained in:
parent
86a6e5b27b
commit
e63f9498bd
@ -37,6 +37,11 @@
|
|||||||
<SaveBtn class="btn btn-primary" @click="submitEdit"></SaveBtn>
|
<SaveBtn class="btn btn-primary" @click="submitEdit"></SaveBtn>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template v-else-if="comment.isDeleted">
|
||||||
|
<p class="m-0 text-muted">댓글이 삭제되었습니다.</p>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<p class="m-0">{{ comment.content }}</p>
|
<p class="m-0">{{ comment.content }}</p>
|
||||||
</template>
|
</template>
|
||||||
@ -109,6 +114,10 @@ const props = defineProps({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
|
isDeleted: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
isCommentPassword: {
|
isCommentPassword: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
@ -154,7 +163,6 @@ const handleUpdateReaction = (reactionData) => {
|
|||||||
|
|
||||||
// 비밀번호 확인
|
// 비밀번호 확인
|
||||||
const logPasswordAndEmit = () => {
|
const logPasswordAndEmit = () => {
|
||||||
console.log('비밀번호 확인',props.password)
|
|
||||||
emit('submitPassword', props.comment, props.password);
|
emit('submitPassword', props.comment, props.password);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -164,6 +172,13 @@ watch(() => props.comment.isEditTextarea, (newVal) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(() => props.comment.isDeleted, () => {
|
||||||
|
if (newVal) {
|
||||||
|
localEditedContent.value = "댓글이 삭제되었습니다."; // UI 반영
|
||||||
|
props.comment.isEditTextarea = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// 수정버튼
|
// 수정버튼
|
||||||
const submitEdit = () => {
|
const submitEdit = () => {
|
||||||
emit('submitEdit', props.comment, localEditedContent.value);
|
emit('submitEdit', props.comment, localEditedContent.value);
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
:comment="comment"
|
:comment="comment"
|
||||||
:isCommentAuthor="comment.isCommentAuthor"
|
:isCommentAuthor="comment.isCommentAuthor"
|
||||||
:isEditTextarea="comment.isEditTextarea"
|
:isEditTextarea="comment.isEditTextarea"
|
||||||
|
:isDeleted="comment.isDeleted"
|
||||||
:isCommentPassword="isCommentPassword"
|
:isCommentPassword="isCommentPassword"
|
||||||
:passwordCommentAlert="passwordCommentAlert || ''"
|
:passwordCommentAlert="passwordCommentAlert || ''"
|
||||||
:currentPasswordCommentId="currentPasswordCommentId"
|
:currentPasswordCommentId="currentPasswordCommentId"
|
||||||
@ -53,6 +54,10 @@ const props = defineProps({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
isDeleted: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
passwordCommentAlert: {
|
passwordCommentAlert: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
|
|||||||
@ -102,6 +102,7 @@
|
|||||||
:comments="commentsWithAuthStatus"
|
:comments="commentsWithAuthStatus"
|
||||||
:isCommentPassword="isCommentPassword"
|
:isCommentPassword="isCommentPassword"
|
||||||
:isEditTextarea="isEditTextarea"
|
:isEditTextarea="isEditTextarea"
|
||||||
|
:isDeleted="isDeleted"
|
||||||
:passwordCommentAlert="passwordCommentAlert"
|
:passwordCommentAlert="passwordCommentAlert"
|
||||||
:currentPasswordCommentId="currentPasswordCommentId"
|
:currentPasswordCommentId="currentPasswordCommentId"
|
||||||
:password="password"
|
:password="password"
|
||||||
@ -183,6 +184,7 @@ const currentPasswordCommentId = ref(null);
|
|||||||
const lastClickedButton = ref("");
|
const lastClickedButton = ref("");
|
||||||
const lastCommentClickedButton = ref("");
|
const lastCommentClickedButton = ref("");
|
||||||
const isEditTextarea = ref(false);
|
const isEditTextarea = ref(false);
|
||||||
|
const isDeleted = ref(true);
|
||||||
const commentAlert = ref('');
|
const commentAlert = ref('');
|
||||||
|
|
||||||
const updatePassword = (newPassword) => {
|
const updatePassword = (newPassword) => {
|
||||||
@ -671,6 +673,10 @@ const deletePost = async () => {
|
|||||||
const deleteReplyComment = async (comment) => {
|
const deleteReplyComment = async (comment) => {
|
||||||
if (!confirm("정말 이 댓글을 삭제하시겠습니까?")) return;
|
if (!confirm("정말 이 댓글을 삭제하시겠습니까?")) return;
|
||||||
|
|
||||||
|
const targetComment = findCommentById(comment.commentId, comments.value);
|
||||||
|
|
||||||
|
console.log('잘되니?',comment)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await axios.delete(`board/comment/${comment.commentId}`, {
|
const response = await axios.delete(`board/comment/${comment.commentId}`, {
|
||||||
data: { LOCCMTSEQ: comment.commentId }
|
data: { LOCCMTSEQ: comment.commentId }
|
||||||
@ -678,6 +684,14 @@ const deleteReplyComment = async (comment) => {
|
|||||||
|
|
||||||
if (response.data.code === 200) {
|
if (response.data.code === 200) {
|
||||||
await fetchComments();
|
await fetchComments();
|
||||||
|
|
||||||
|
if (targetComment) {
|
||||||
|
console.log('타겟',targetComment)
|
||||||
|
// ✅ 댓글 내용만 "삭제된 댓글입니다."로 변경하고, 구조는 유지
|
||||||
|
targetComment.content = "댓글이 삭제되었습니다.";
|
||||||
|
targetComment.author = "알 수 없음"; // 익명 처리
|
||||||
|
targetComment.isDeleted = true; // ✅ 삭제 상태를 추가
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
alert("댓글 삭제에 실패했습니다.");
|
alert("댓글 삭제에 실패했습니다.");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user