댓글 익명 체크 수정 완료

This commit is contained in:
kimdaae328 2025-02-27 16:23:45 +09:00
parent ffabb284fa
commit b02d99e4b1
2 changed files with 9 additions and 8 deletions

View File

@ -51,10 +51,7 @@
<!-- 답변 쓰기 버튼 --> <!-- 답변 쓰기 버튼 -->
<div class="ms-auto mt-3 mt-md-0"> <div class="ms-auto mt-3 mt-md-0">
<button class="btn btn-primary" @click="handleCommentSubmit"> <SaveBtn class="btn btn-primary" @click="handleCommentSubmit"></SaveBtn>
<!-- <i class="icon-base bx bx-check"></i> -->
확인
</button>
</div> </div>
</div> </div>
</div> </div>
@ -63,6 +60,7 @@
<script setup> <script setup>
import { ref, defineEmits, defineProps, computed, watch } from 'vue'; import { ref, defineEmits, defineProps, computed, watch } from 'vue';
import SaveBtn from '../button/SaveBtn.vue';
const props = defineProps({ const props = defineProps({
unknown: { unknown: {
@ -90,6 +88,7 @@ const isCheck = ref(props.unknown);
const emit = defineEmits(['submitComment']); const emit = defineEmits(['submitComment']);
const LOCBRDTYP = isCheck.value ? '300102' : null; const LOCBRDTYP = isCheck.value ? '300102' : null;
function handleCommentSubmit() { function handleCommentSubmit() {
console.log(isCheck.value)
emit('submitComment', { emit('submitComment', {
comment: comment.value, comment: comment.value,
password: isCheck.value ? password.value : '', password: isCheck.value ? password.value : '',

View File

@ -106,7 +106,7 @@
<BoardCommentList <BoardCommentList
:unknown="unknown" :unknown="unknown"
:comments="commentsWithAuthStatus" :comments="commentsWithAuthStatus"
:isCommentPassword="Boolean(isCommentPassword)" :isCommentPassword="isCommentPassword"
:isEditTextarea="isEditTextarea" :isEditTextarea="isEditTextarea"
:passwordCommentAlert="passwordCommentAlert" :passwordCommentAlert="passwordCommentAlert"
@editClick="editComment" @editClick="editComment"
@ -320,6 +320,8 @@ const fetchComments = async (page = 1) => {
children: [], // children: [], //
})); }));
commentsList.sort((a, b) => b.createdAtRaw - a.createdAtRaw);
for (const comment of commentsList) { for (const comment of commentsList) {
if (!comment.commentId) continue; if (!comment.commentId) continue;
@ -378,13 +380,13 @@ const fetchComments = async (page = 1) => {
}; };
// //
const handleCommentSubmit = async (data, isCheck) => { const handleCommentSubmit = async (data) => {
if (!data) { if (!data) {
console.error("handleCommentSubmit: data가 undefined입니다."); console.error("handleCommentSubmit: data가 undefined입니다.");
return; return;
} }
const { comment, password } = data; const { comment, password, isCheck } = data;
if (!comment || comment.trim() === "") { if (!comment || comment.trim() === "") {
commentAlert.value = '댓글을 입력해주세요.'; commentAlert.value = '댓글을 입력해주세요.';
@ -404,7 +406,7 @@ const handleCommentSubmit = async (data, isCheck) => {
LOCCMTRPY: comment, LOCCMTRPY: comment,
LOCCMTPWD: isCheck ? password : '', LOCCMTPWD: isCheck ? password : '',
LOCCMTPNT: 1, LOCCMTPNT: 1,
LOCBRDTYP: unknown.value ? "300102" : null LOCBRDTYP: isCheck ? "300102" : null
}); });
if (response.status === 200) { if (response.status === 200) {