비밀번호 입력창 초기화

This commit is contained in:
kimdaae328 2025-02-28 12:18:09 +09:00
parent 3678b40e1c
commit 785df5c51f
3 changed files with 21 additions and 26 deletions

View File

@ -43,7 +43,7 @@
</div>
<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">
@ -63,8 +63,6 @@
:currentPasswordCommentId="currentPasswordCommentId"
:passwordCommentAlert="passwordCommentAlert"
:password="password"
:commentAlert="commentAlert"
:passwordAlert="passwordAlert"
@editClick="handleReplyEditClick"
@deleteClick="$emit('deleteClick', child)"
@submitEdit="(comment, editedContent) => $emit('submitEdit', comment, editedContent)"
@ -125,12 +123,6 @@ const props = defineProps({
password:{
type: String
},
commentAlert: {
type: String,
},
passwordAlert: {
type: String,
}
});
// emits

View File

@ -14,8 +14,6 @@
:passwordCommentAlert="passwordCommentAlert || ''"
:currentPasswordCommentId="currentPasswordCommentId"
:password="password"
:commentAlert="commentAlert"
:passwordAlert="passwordAlert"
@editClick="handleEditClick"
@deleteClick="handleDeleteClick"
@submitPassword="submitPassword"
@ -65,12 +63,6 @@ const props = defineProps({
password:{
type: String
},
commentAlert: {
type: String,
},
passwordAlert: {
type: String,
}
});
const emit = defineEmits(['submitComment', 'updateReaction', 'editClick', 'deleteClick', 'submitPassword', 'clearPassword','submitEdit', 'update:password']);

View File

@ -105,8 +105,6 @@
:passwordCommentAlert="passwordCommentAlert"
:currentPasswordCommentId="currentPasswordCommentId"
:password="password"
:commentAlert="commentAlert"
:passwordAlert="passwordAlert"
@editClick="editComment"
@deleteClick="deleteComment"
@updateReaction="handleCommentReaction"
@ -459,8 +457,12 @@ const findCommentById = (commentId, commentsList) => {
return null;
};
//
// ( )
const editComment = (comment) => {
password.value = '';
passwordCommentAlert.value = '';
currentPasswordCommentId.value = null;
const targetComment = findCommentById(comment.commentId, comments.value);
if (!targetComment) {
@ -496,12 +498,16 @@ const deleteComment = async (comment) => {
}
};
//
//
const toggleCommentPassword = (comment, button) => {
if (lastCommentClickedButton.value === button && currentPasswordCommentId.value === comment.commentId) {
currentPasswordCommentId.value = null; //
password.value = '';
passwordCommentAlert.value = '';
} else {
currentPasswordCommentId.value = comment.commentId; //
password.value = '';
passwordCommentAlert.value = '';
}
lastCommentClickedButton.value = button;
@ -557,7 +563,7 @@ const submitPassword = async () => {
}
};
// ( )
// ( )
const submitCommentPassword = async (comment, password) => {
if (!password) {
passwordCommentAlert.value = "비밀번호를 입력해주세요.";
@ -573,20 +579,25 @@ const submitCommentPassword = async (comment, password) => {
});
if (response.data.code === 200 && response.data.data === true) {
passwordCommentAlert.value = "";
passwordCommentAlert.value = '';
comment.isCommentPassword = false;
//
if (lastCommentClickedButton.value === "edit") {
if (targetComment) {
currentPasswordCommentId.value = null;
password.value = '';
passwordCommentAlert.value = '';
targetComment.isEditTextarea = true;
passwordCommentAlert.value = "";
} else {
alert("수정 취소를 실패했습니다.");
}
//
} else if (lastCommentClickedButton.value === "delete") {
passwordCommentAlert.value = "";
passwordCommentAlert.value = '';
deleteReplyComment(comment)
}