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

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';
export const useBoardAccessStore = defineStore(

View File

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