익명 댓글 수정 수정중

This commit is contained in:
kimdaae328 2025-02-27 16:35:20 +09:00
parent b02d99e4b1
commit e30dd8f7b0
3 changed files with 6 additions and 30 deletions

View File

@ -11,12 +11,10 @@
:isLike="!isLike"
:isCommentPassword="isCommentPassword"
:isCommentProfile="true"
@editClick="aaaa"
@editClick="handleEditClick"
@deleteClick="$emit('deleteClick', comment)"
@updateReaction="handleUpdateReaction"
/>
<!-- <P>Commentpassssss: {{isCommentPassword}}</P> -->
<!-- :author="true" -->
<!-- 댓글 비밀번호 입력창 (익명일 경우) -->
<div v-if="isCommentPassword === comment.commentId && unknown" class="mt-3 w-25 ms-auto">
<div class="input-group">
@ -30,16 +28,11 @@
</div>
<span v-if="passwordCommentAlert" class="invalid-feedback d-block text-start">{{ passwordCommentAlert }}</span>
</div>
<!-- <p>authorId:{{ comment.authorId }}</p>
<p>코멘트 비교: {{comment.isCommentAuthor}}</p> -->
<div class="mt-6">
<template v-if="comment.isEditTextarea">
<textarea v-model="localEditedContent" class="form-control"></textarea>
<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-primary" @click="submitEdit">수정</button> -->
<SaveBtn class="btn btn-primary" @click="submitEdit"></SaveBtn>
</div>
</template>
@ -58,10 +51,6 @@
:key="child.commentId"
class="mt-8 pt-6 ps-10 border-top"
>
<!-- <p>대댓글 데이터(JSON): {{ JSON.stringify(child, null, 2) }}</p> -->
<!-- <p>comment child: {{ comment.children }}</p> -->
<!-- :unknown="child.author === '익명'" -->
<p>child.isCommentPassword: {{ child.isCommentPassword }}</p>
<BoardComment
:comment="child"
:unknown="child.author === '익명'"
@ -169,7 +158,7 @@ const submitEdit = () => {
emit('submitEdit', props.comment, localEditedContent.value);
};
const aaaa = () => {
const handleEditClick = () => {
emit('editClick', props.comment);
}

View File

@ -88,7 +88,6 @@ const isCheck = ref(props.unknown);
const emit = defineEmits(['submitComment']);
const LOCBRDTYP = isCheck.value ? '300102' : null;
function handleCommentSubmit() {
console.log(isCheck.value)
emit('submitComment', {
comment: comment.value,
password: isCheck.value ? password.value : '',

View File

@ -372,7 +372,6 @@ const fetchComments = async (page = 1) => {
// console.log("📌 :", comments.value);
} catch (error) {
alert('오류가 발생했습니다.');
// alert(' :', error);
@ -410,21 +409,18 @@ const handleCommentSubmit = async (data) => {
});
if (response.status === 200) {
// console.log(' :', response.data.message);
passwordAlert.value = '';
commentAlert.value = '';
await fetchComments();
} else {
// console.error(' :', response.data.message);
alert("댓글 작성을 실패했습니다.")
}
} catch (error) {
// console.error(' :', error);
alert("오류가 발생했습니다.")
}
};
// ( `BoardCommentList` )
//
const handleCommentReply = async (reply) => {
try {
const response = await axios.post(`board/${currentBoardId.value}/comment`, {
@ -437,17 +433,13 @@ const handleCommentReply = async (reply) => {
if (response.status === 200) {
if (response.data.code === 200) { //
// console.log(' :', response.data);
await fetchComments(); //
} else {
// console.log(' - :', response.data);
alert('대댓글 작성을 실패했습니다.');
}
}
} catch (error) {
// console.error(' :', error);
if (error.response) {
// console.error(' :', error.response.data);
alert("오류가 발생했습니다.");
}
alert("오류가 발생했습니다.");
@ -504,11 +496,10 @@ const editComment = (comment) => {
if (isMyComment) {
//
targetComment.isEditTextarea = true;
targetComment.isEditTextarea = !targetComment.isEditTextarea;
} else if (isAnonymous) {
//
toggleCommentPassword(comment, "edit");
} else {
// console.log(" - ");
alert("수정이 불가능합니다");
@ -545,8 +536,6 @@ const toggleCommentPassword = (comment, button) => {
lastCommentClickedButton.value = button;
};
const togglePassword = (button) => {
if (lastClickedButton.value === button) {
isPassword.value = !isPassword.value;
@ -562,7 +551,6 @@ const submitPassword = async () => {
passwordAlert.value = "비밀번호를 입력해주세요.";
return;
}
// console.log("📌 : submitPassword ");
try {
const response = await axios.post(`board/${currentBoardId.value}/password`, {
@ -674,7 +662,7 @@ const deletePost = async () => {
// ( )
const deleteReplyComment = async (comment) => {
if (!confirm("정말 이 댓글을 삭제하시겠습니까?")) return;
// console.log(" ID:", comment);
console.log("댓글 수정, 대댓글도?");
try {
const response = await axios.delete(`board/comment/${comment.commentId}`, {