댓글 노출 기본 최신순, 수정시 수정됨 문구 표기

This commit is contained in:
nevermoregb 2025-03-18 10:56:48 +09:00
parent 03bb18a1e8
commit 29d8095107
2 changed files with 42 additions and 40 deletions

View File

@ -5,7 +5,7 @@
수정일 : 수정일 :
설명 : 게시글 수정 비밀번호 적재용. 설명 : 게시글 수정 비밀번호 적재용.
*/ */
import { ref, computed, watch } from 'vue'; import { ref } from 'vue';
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
export const useBoardAccessStore = defineStore( export const useBoardAccessStore = defineStore(

View File

@ -316,27 +316,27 @@
page, page,
}, },
}); });
const commentsList = response.data.data.list.map(comment => ({ const commentsList = response.data.data.list
commentId: comment.LOCCMTSEQ, // ID .map(comment => ({
boardId: comment.LOCBRDSEQ, commentId: comment.LOCCMTSEQ, // ID
parentId: comment.LOCCMTPNT, // ID boardId: comment.LOCBRDSEQ,
author: comment.author || '익명', parentId: comment.LOCCMTPNT, // ID
authorId: comment.authorId, author: comment.author || '익명',
content: comment.LOCCMTRPY, authorId: comment.authorId,
likeCount: comment.likeCount || 0, content: comment.LOCCMTRPY,
dislikeCount: comment.dislikeCount || 0, likeCount: comment.likeCount || 0,
profileImg: comment.profileImg || '', dislikeCount: comment.dislikeCount || 0,
likeClicked: comment.likeClicked || false, profileImg: comment.profileImg || '',
dislikeClicked: comment.dislikeClicked || false, likeClicked: comment.likeClicked || false,
// createdAtRaw: new Date(comment.LOCCMTRDT), // dislikeClicked: comment.dislikeClicked || false,
// createdAt: formattedDate(comment.LOCCMTRDT), // createdAtRaw: comment.LOCCMTRDT, //
createdAtRaw: new Date(comment.LOCCMTUDT), // // createdAt: formattedDate(comment.LOCCMTRDT), // ()
createdAt: formattedDate(comment.LOCCMTUDT), // // createdAtRaw: new Date(comment.LOCCMTUDT), //
children: [], // createdAt: formattedDate(comment.LOCCMTUDT) + (comment.LOCCMTUDT !== comment.LOCCMTRDT ? ' (수정됨)' : ''), // ()
updateAtRaw: comment.LOCCMTUDT, children: [], //
})); updateAtRaw: comment.LOCCMTUDT,
}))
commentsList.sort((a, b) => b.createdAtRaw - a.createdAtRaw); .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;
@ -346,23 +346,25 @@
}); });
if (replyResponse.data.data) { if (replyResponse.data.data) {
comment.children = replyResponse.data.data.map(reply => ({ comment.children = replyResponse.data.data
author: reply.author || '익명', .map(reply => ({
authorId: reply.authorId, author: reply.author || '익명',
profileImg: reply.profileImg || '', authorId: reply.authorId,
commentId: reply.LOCCMTSEQ, profileImg: reply.profileImg || '',
boardId: reply.LOCBRDSEQ, commentId: reply.LOCCMTSEQ,
parentId: reply.LOCCMTPNT, // ID boardId: reply.LOCBRDSEQ,
content: reply.LOCCMTRPY || '내용 없음', parentId: reply.LOCCMTPNT, // ID
// createdAtRaw: new Date(reply.LOCCMTRDT), content: reply.LOCCMTRPY || '내용 없음',
// createdAt: formattedDate(reply.LOCCMTRDT), createdAtRaw: reply.LOCCMTRDT,
createdAtRaw: new Date(reply.LOCCMTUDT), // createdAt: formattedDate(reply.LOCCMTRDT),
createdAt: formattedDate(reply.LOCCMTUDT), //createdAtRaw: new Date(reply.LOCCMTUDT),
likeCount: reply.likeCount || 0, createdAt: formattedDate(reply.LOCCMTUDT) + (reply.LOCCMTUDT !== reply.LOCCMTRDT ? ' (수정됨)' : ''),
dislikeCount: reply.dislikeCount || 0, likeCount: reply.likeCount || 0,
likeClicked: false, dislikeCount: reply.dislikeCount || 0,
dislikeClicked: false, likeClicked: false,
})); dislikeClicked: false,
}))
.sort((a, b) => b.createdAtRaw - a.createdAtRaw);
} else { } else {
comment.children = []; // comment.children = []; //
} }
@ -732,7 +734,7 @@
} }
}; };
// //
const handleSubmitEdit = async (comment, editedContent) => { const handleSubmitEdit = async (comment, editedContent) => {
if (!checkValidation(comment, editedContent)) return; // if (!checkValidation(comment, editedContent)) return; //
togglePassword(); togglePassword();