댓글 비밀번호 진행중

This commit is contained in:
kimdaae328 2025-02-21 09:52:10 +09:00
parent 62361b7ae9
commit 3f4743cac2
2 changed files with 17 additions and 13 deletions

View File

@ -31,7 +31,7 @@
<div class="mt-6"> <div class="mt-6">
<template v-if="comment.isEditTextarea"> <template v-if="comment.isEditTextarea">
<textarea v-model="editedContent" class="form-control"></textarea> <textarea v-model="localEditedContent" class="form-control"></textarea>
<div class="mt-2 d-flex justify-content-end"> <div class="mt-2 d-flex justify-content-end">
<button class="btn btn-secondary me-2" @click="$emit('cancelEdit', comment)">취소</button> <button class="btn btn-secondary me-2" @click="$emit('cancelEdit', comment)">취소</button>
<button class="btn btn-primary" @click="$emit('submitEdit', comment, editedContent)">수정</button> <button class="btn btn-primary" @click="$emit('submitEdit', comment, editedContent)">수정</button>
@ -110,7 +110,7 @@ const props = defineProps({
const emit = defineEmits(['submitComment', 'updateReaction', 'editClick', 'deleteClick', 'submitPassword', 'submitEdit', 'cancelEdit']); const emit = defineEmits(['submitComment', 'updateReaction', 'editClick', 'deleteClick', 'submitPassword', 'submitEdit', 'cancelEdit']);
const password = ref(''); const password = ref('');
const localEditedContent = ref(props.editedContent);
// //
const isComment = ref(false); const isComment = ref(false);
@ -142,16 +142,20 @@ const logPasswordAndEmit = () => {
emit('submitPassword', props.comment, password.value); emit('submitPassword', props.comment, password.value);
}; };
watch(() => props.editedContent, (newValue) => {
localEditedContent.value = newValue;
});
// //
// const cancelEdit = () => { // const cancelEdit = () => {
// isEditTextarea.value = false; // isEditTextarea.value = false;
// }; // };
// //
// const submitEdit = () => { const submitEdit = () => {
// emit('submitComment', { commentId: props.comment.commentId, content: editedContent.value }); emit('submitComment', { commentId: props.comment.commentId, content: editedContent.value });
// isEditTextarea.value = false; // isEditTextarea.value = false; //
// }; };
</script> </script>

View File

@ -543,8 +543,8 @@ const submitCommentPassword = async (comment, password) => {
return; return;
} }
console.log('코멘트아이디:', comment.commentId, '비번:', password) // console.log(':', comment.commentId, ':', password)
comment.isEditTextarea = true; // comment.isEditTextarea = true;
// //
try { try {
@ -553,15 +553,15 @@ const submitCommentPassword = async (comment, password) => {
LOCCMTSEQ: comment.commentId, LOCCMTSEQ: comment.commentId,
}); });
console.log("응답!!!!!!!!", response); // // console.log("!!!!!!!!", response); //
console.log("응답 데이터:", response.data); // console.log(" :", response.data);
if (response.data.code === 200 && response.data.data === true) { if (response.data.code === 200 && response.data.data === true) {
console.log('되는거니') console.log('되는거니')
// deleteComment() // deleteComment()
// // password.value = ''; password.value = '';
// // isPassword.value = false; isPassword.value = false;
// // isEditTextarea.value = true; comment.isEditTextarea.value = true;
} else { } else {
passwordAlert.value = "비밀번호가 일치하지 않습니다."; passwordAlert.value = "비밀번호가 일치하지 않습니다.";
} }