비밀번호 입력창 초기화
This commit is contained in:
parent
3678b40e1c
commit
785df5c51f
@ -43,7 +43,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<PlusButton v-if="isPlusButton" @click="toggleComment" class="mt-6"/>
|
<PlusButton v-if="isPlusButton" @click="toggleComment" class="mt-6"/>
|
||||||
<BoardCommentArea v-if="isComment" :unknown="unknown" :commentAlert="commentAlert" :passwordAlert="passwordAlert" @submitComment="submitComment"/>
|
<BoardCommentArea v-if="isComment" :unknown="unknown" @submitComment="submitComment"/>
|
||||||
|
|
||||||
<!-- 대댓글 -->
|
<!-- 대댓글 -->
|
||||||
<ul v-if="comment.children && comment.children.length" class="list-unstyled">
|
<ul v-if="comment.children && comment.children.length" class="list-unstyled">
|
||||||
@ -63,8 +63,6 @@
|
|||||||
:currentPasswordCommentId="currentPasswordCommentId"
|
:currentPasswordCommentId="currentPasswordCommentId"
|
||||||
:passwordCommentAlert="passwordCommentAlert"
|
:passwordCommentAlert="passwordCommentAlert"
|
||||||
:password="password"
|
:password="password"
|
||||||
:commentAlert="commentAlert"
|
|
||||||
:passwordAlert="passwordAlert"
|
|
||||||
@editClick="handleReplyEditClick"
|
@editClick="handleReplyEditClick"
|
||||||
@deleteClick="$emit('deleteClick', child)"
|
@deleteClick="$emit('deleteClick', child)"
|
||||||
@submitEdit="(comment, editedContent) => $emit('submitEdit', comment, editedContent)"
|
@submitEdit="(comment, editedContent) => $emit('submitEdit', comment, editedContent)"
|
||||||
@ -125,12 +123,6 @@ const props = defineProps({
|
|||||||
password:{
|
password:{
|
||||||
type: String
|
type: String
|
||||||
},
|
},
|
||||||
commentAlert: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
passwordAlert: {
|
|
||||||
type: String,
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// emits 정의
|
// emits 정의
|
||||||
|
|||||||
@ -14,8 +14,6 @@
|
|||||||
:passwordCommentAlert="passwordCommentAlert || ''"
|
:passwordCommentAlert="passwordCommentAlert || ''"
|
||||||
:currentPasswordCommentId="currentPasswordCommentId"
|
:currentPasswordCommentId="currentPasswordCommentId"
|
||||||
:password="password"
|
:password="password"
|
||||||
:commentAlert="commentAlert"
|
|
||||||
:passwordAlert="passwordAlert"
|
|
||||||
@editClick="handleEditClick"
|
@editClick="handleEditClick"
|
||||||
@deleteClick="handleDeleteClick"
|
@deleteClick="handleDeleteClick"
|
||||||
@submitPassword="submitPassword"
|
@submitPassword="submitPassword"
|
||||||
@ -65,12 +63,6 @@ const props = defineProps({
|
|||||||
password:{
|
password:{
|
||||||
type: String
|
type: String
|
||||||
},
|
},
|
||||||
commentAlert: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
passwordAlert: {
|
|
||||||
type: String,
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['submitComment', 'updateReaction', 'editClick', 'deleteClick', 'submitPassword', 'clearPassword','submitEdit', 'update:password']);
|
const emit = defineEmits(['submitComment', 'updateReaction', 'editClick', 'deleteClick', 'submitPassword', 'clearPassword','submitEdit', 'update:password']);
|
||||||
|
|||||||
@ -105,8 +105,6 @@
|
|||||||
:passwordCommentAlert="passwordCommentAlert"
|
:passwordCommentAlert="passwordCommentAlert"
|
||||||
:currentPasswordCommentId="currentPasswordCommentId"
|
:currentPasswordCommentId="currentPasswordCommentId"
|
||||||
:password="password"
|
:password="password"
|
||||||
:commentAlert="commentAlert"
|
|
||||||
:passwordAlert="passwordAlert"
|
|
||||||
@editClick="editComment"
|
@editClick="editComment"
|
||||||
@deleteClick="deleteComment"
|
@deleteClick="deleteComment"
|
||||||
@updateReaction="handleCommentReaction"
|
@updateReaction="handleCommentReaction"
|
||||||
@ -412,7 +410,7 @@ const handleCommentReply = async (reply) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
if (response.data.code === 200) {
|
if (response.data.code === 200) {
|
||||||
await fetchComments();
|
await fetchComments();
|
||||||
} else {
|
} else {
|
||||||
alert('대댓글 작성을 실패했습니다.');
|
alert('대댓글 작성을 실패했습니다.');
|
||||||
@ -459,8 +457,12 @@ const findCommentById = (commentId, commentsList) => {
|
|||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 댓글 수정 버튼 클릭
|
// 댓글 수정(대댓글 포함)
|
||||||
const editComment = (comment) => {
|
const editComment = (comment) => {
|
||||||
|
password.value = '';
|
||||||
|
passwordCommentAlert.value = '';
|
||||||
|
currentPasswordCommentId.value = null;
|
||||||
|
|
||||||
const targetComment = findCommentById(comment.commentId, comments.value);
|
const targetComment = findCommentById(comment.commentId, comments.value);
|
||||||
|
|
||||||
if (!targetComment) {
|
if (!targetComment) {
|
||||||
@ -496,12 +498,16 @@ const deleteComment = async (comment) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 익명 비밀번호 창 토글
|
// 익명 댓글 비밀번호 창 토글
|
||||||
const toggleCommentPassword = (comment, button) => {
|
const toggleCommentPassword = (comment, button) => {
|
||||||
if (lastCommentClickedButton.value === button && currentPasswordCommentId.value === comment.commentId) {
|
if (lastCommentClickedButton.value === button && currentPasswordCommentId.value === comment.commentId) {
|
||||||
currentPasswordCommentId.value = null; // 비밀번호 창 닫기
|
currentPasswordCommentId.value = null; // 비밀번호 창 닫기
|
||||||
|
password.value = '';
|
||||||
|
passwordCommentAlert.value = '';
|
||||||
} else {
|
} else {
|
||||||
currentPasswordCommentId.value = comment.commentId; // 비밀번호 창 열기
|
currentPasswordCommentId.value = comment.commentId; // 비밀번호 창 열기
|
||||||
|
password.value = '';
|
||||||
|
passwordCommentAlert.value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
lastCommentClickedButton.value = button;
|
lastCommentClickedButton.value = button;
|
||||||
@ -557,7 +563,7 @@ const submitPassword = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 댓글 삭제 (비밀번호 확인 후)
|
// 댓글 (비밀번호 확인 후)
|
||||||
const submitCommentPassword = async (comment, password) => {
|
const submitCommentPassword = async (comment, password) => {
|
||||||
if (!password) {
|
if (!password) {
|
||||||
passwordCommentAlert.value = "비밀번호를 입력해주세요.";
|
passwordCommentAlert.value = "비밀번호를 입력해주세요.";
|
||||||
@ -573,20 +579,25 @@ const submitCommentPassword = async (comment, password) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (response.data.code === 200 && response.data.data === true) {
|
if (response.data.code === 200 && response.data.data === true) {
|
||||||
passwordCommentAlert.value = "";
|
passwordCommentAlert.value = '';
|
||||||
comment.isCommentPassword = false;
|
comment.isCommentPassword = false;
|
||||||
|
|
||||||
|
// 수정
|
||||||
if (lastCommentClickedButton.value === "edit") {
|
if (lastCommentClickedButton.value === "edit") {
|
||||||
|
|
||||||
if (targetComment) {
|
if (targetComment) {
|
||||||
|
currentPasswordCommentId.value = null;
|
||||||
|
password.value = '';
|
||||||
|
passwordCommentAlert.value = '';
|
||||||
|
|
||||||
targetComment.isEditTextarea = true;
|
targetComment.isEditTextarea = true;
|
||||||
passwordCommentAlert.value = "";
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
alert("수정 취소를 실패했습니다.");
|
alert("수정 취소를 실패했습니다.");
|
||||||
}
|
}
|
||||||
|
//삭제
|
||||||
} else if (lastCommentClickedButton.value === "delete") {
|
} else if (lastCommentClickedButton.value === "delete") {
|
||||||
passwordCommentAlert.value = "";
|
passwordCommentAlert.value = '';
|
||||||
|
|
||||||
deleteReplyComment(comment)
|
deleteReplyComment(comment)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user