날짜 변환전, 좋아요 해결완료

This commit is contained in:
kimdaae328 2025-02-04 10:57:18 +09:00
parent 8e42b6b2b5
commit d1aa5fb438
2 changed files with 21 additions and 23 deletions

View File

@ -7,16 +7,13 @@
<div class="me-2"> <div class="me-2">
<h6 class="mb-0">{{ profileName }}</h6> <h6 class="mb-0">{{ profileName }}</h6>
<div class="profile-detail"> <div class="profile-detail">
<span>2024.12.10 10:46</span> <span>{{ date }}</span>
<template v-if="showDetail"> <template v-if="showDetail">
<span> <span>
<i class="fa-regular fa-eye"></i> {{ views }} <i class="fa-regular fa-eye"></i> {{ views }}
</span> </span>
<span> <span>
<i class="fa-regular fa-thumbs-up"></i> {{ likes }} <i class="bx bx-comment"></i> {{ comments }}
</span>
<span>
<i class="fa-regular fa-thumbs-down"></i> {{ dislikes }}
</span> </span>
</template> </template>
</div> </div>
@ -72,17 +69,17 @@ const props = defineProps({
type: Boolean, type: Boolean,
default: false, default: false,
}, },
date: {
type: String,
required: true,
},
views: { views: {
type: Number, type: Number,
default: 0, default: 0,
}, },
likes: { comments: {
type: Number, type: Number,
default: null, default: 0,
},
dislikes: {
type: Number,
default: null,
}, },
isChild: { isChild: {
type: Boolean, type: Boolean,

View File

@ -9,8 +9,8 @@
:boardId="currentBoardId" :boardId="currentBoardId"
:profileName="profileName" :profileName="profileName"
:views="views" :views="views"
:likes="likes" :comments="comments"
:dislikes="dislikes" :date="date"
class="pb-6 border-bottom" class="pb-6 border-bottom"
/> />
</div> </div>
@ -49,8 +49,8 @@
:bigBtn="true" :bigBtn="true"
:boardId="currentBoardId" :boardId="currentBoardId"
:commentId="null" :commentId="null"
:likeCount="currentLikeCount" :likeCount="likes"
:dislikeCount="currentDislikeCount" :dislikeCount="dislikes"
@updateReaction="handleUpdateReaction" @updateReaction="handleUpdateReaction"
/> />
</div> </div>
@ -63,7 +63,7 @@
</ul> --> </ul> -->
<!-- 댓글 영역 --> <!-- 댓글 영역 -->
<BoardComentArea :comments="comments" /> <BoardComentArea />
<!-- 수정 버튼 --> <!-- 수정 버튼 -->
<!-- <button class="btn btn-primary" @click="goToEditPage"> <!-- <button class="btn btn-primary" @click="goToEditPage">
@ -95,11 +95,12 @@ import axios from '@api';
const profileName = ref('익명 사용자'); const profileName = ref('익명 사용자');
const boardTitle = ref('제목 없음'); const boardTitle = ref('제목 없음');
const boardContent = ref(''); const boardContent = ref('');
const comments = ref([]);
const attachments = ref([]); const attachments = ref([]);
const date = ref('');
const views = ref(0); const views = ref(0);
const likes = ref(0); const likes = ref(0);
const dislikes = ref(0); const dislikes = ref(0);
const comments = ref(0);
const attachment = ref(false); const attachment = ref(false);
// ID // ID
@ -122,24 +123,24 @@ const fetchBoardDetails = async () => {
const boardDetail = data.boardDetail || {}; const boardDetail = data.boardDetail || {};
// console.log('boardDetail:', boardDetail); // console.log('boardDetail:', boardDetail);
console.log('API Response:', response.data);
profileName.value = data.author || '익명 사용자'; profileName.value = data.author || '익명 사용자';
boardTitle.value = data.title || '제목 없음'; boardTitle.value = data.title || '제목 없음';
boardContent.value = data.content || ''; boardContent.value = data.content || '';
date.value = data.date || '';
views.value = data.cnt || 0; views.value = data.cnt || 0;
likes.value = data.likeCount || 0; likes.value = data.likeCount || 0;
dislikes.value = data.dislikeCount || 0; dislikes.value = data.dislikeCount || 0;
attachment.value = data.hasAttachment || null; attachment.value = data.hasAttachment || null;
comments.value = data.commentCount || 0;
console.log(date.value)
attachments.value = data.attachments || [];
comments.value = data.comments || [];
} catch (error) { } catch (error) {
alert('게시물 데이터를 불러오는 중 오류가 발생했습니다.'); alert('게시물 데이터를 불러오는 중 오류가 발생했습니다.');
} }
}; };
const currentLikeCount = ref(10);
const currentDislikeCount = ref(2);
// , // ,
const handleUpdateReaction = async ({ type, boardId, commentId }) => { const handleUpdateReaction = async ({ type, boardId, commentId }) => {
try { try {