익명 댓글 수정 수정중
This commit is contained in:
parent
b02d99e4b1
commit
e30dd8f7b0
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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 : '',
|
||||
|
||||
@ -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}`, {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user