Merge branch 'main' into board-ji

This commit is contained in:
dyhj625 2025-03-28 13:19:35 +09:00
commit 008adac7a5
4 changed files with 30 additions and 7 deletions

View File

@ -33,13 +33,20 @@
</template> </template>
<!-- 좋아요, 싫어요 버튼 (댓글에서만 표시) --> <!-- 좋아요, 싫어요 버튼 (댓글에서만 표시) -->
<BoardRecommendBtn v-if="isLike && !isDeletedComment" :boardId="boardId" :comment="comment" @updateReaction="handleUpdateReaction" /> <BoardRecommendBtn
v-if="isLike && !isDeletedComment"
:boardId="boardId"
:comment="comment"
:likeClicked="comment.likeClicked"
:dislikeClicked="comment.dislikeClicked"
@updateReaction="handleUpdateReaction"
/>
</div> </div>
</div> </div>
</template> </template>
<script setup> <script setup>
import { computed, defineProps, defineEmits, inject } from 'vue'; import { computed, defineProps, defineEmits, inject, onMounted } from 'vue';
import DeleteButton from '../button/DeleteBtn.vue'; import DeleteButton from '../button/DeleteBtn.vue';
import EditButton from '../button/EditBtn.vue'; import EditButton from '../button/EditBtn.vue';
import BoardRecommendBtn from '../button/BoardRecommendBtn.vue'; import BoardRecommendBtn from '../button/BoardRecommendBtn.vue';

View File

@ -1,8 +1,16 @@
<template v-if="isRecommend"> <template v-if="isRecommend">
<button class="btn btn-label-primary btn-icon me-1" :class="{ clicked: likeClicked, big: bigBtn }" @click="handleLike"> <button
class="btn btn-label-primary btn-icon me-1"
:class="{ clicked: likeClicked, big: bigBtn, active: likeClicked }"
@click="handleLike"
>
<i class="fa-regular fa-thumbs-up"></i> <span class="ms-1">{{ likeCount }}</span> <i class="fa-regular fa-thumbs-up"></i> <span class="ms-1">{{ likeCount }}</span>
</button> </button>
<button class="btn btn-label-danger btn-icon" :class="{ clicked: dislikeClicked, big: bigBtn }" @click="handleDislike"> <button
class="btn btn-label-danger btn-icon"
:class="{ clicked: dislikeClicked, big: bigBtn, active: dislikeClicked }"
@click="handleDislike"
>
<i class="fa-regular fa-thumbs-down"></i> <span class="ms-1">{{ dislikeCount }}</span> <i class="fa-regular fa-thumbs-down"></i> <span class="ms-1">{{ dislikeCount }}</span>
</button> </button>
</template> </template>

View File

@ -78,6 +78,7 @@
style="line-height: 1.6" style="line-height: 1.6"
v-html="$common.contentToHtml(boardContent)" v-html="$common.contentToHtml(boardContent)"
></div> ></div>
<div v-if="!unknown" class="my-12 py-12 pt-12"></div>
<!-- 좋아요 버튼 --> <!-- 좋아요 버튼 -->
<div class="row justify-content-center my-10"> <div class="row justify-content-center my-10">
@ -272,6 +273,14 @@
attachment.value = boardData.hasAttachment || null; attachment.value = boardData.hasAttachment || null;
commentNum.value = boardData.commentCount || 0; commentNum.value = boardData.commentCount || 0;
attachments.value = boardData.attachments || []; attachments.value = boardData.attachments || [];
if (boardData?.myReaction == 1) {
likeClicked.value = true;
dislikeClicked.value = false;
} else if (boardData?.myReaction == 2) {
likeClicked.value = false;
dislikeClicked.value = true;
}
} else { } else {
toastStore.onToast(data.message, 'e'); toastStore.onToast(data.message, 'e');
router.back(); router.back();
@ -332,8 +341,6 @@
dislikeCount: comment.dislikeCount || 0, dislikeCount: comment.dislikeCount || 0,
profileImg: comment.profileImg || '', profileImg: comment.profileImg || '',
nickname: comment.LOCCMTNIC || '', nickname: comment.LOCCMTNIC || '',
likeClicked: comment.likeClicked || false,
dislikeClicked: comment.dislikeClicked || false,
createdAtRaw: comment.LOCCMTRDT, // createdAtRaw: comment.LOCCMTRDT, //
// createdAt: formattedDate(comment.LOCCMTRDT), // () // createdAt: formattedDate(comment.LOCCMTRDT), // ()
// createdAtRaw: new Date(comment.LOCCMTUDT), // // createdAtRaw: new Date(comment.LOCCMTUDT), //
@ -342,6 +349,8 @@
(comment.content === '삭제된 댓글입니다' && comment.LOCCMTUDT !== comment.LOCCMTRDT ? ' (수정됨)' : ''), // () (comment.content === '삭제된 댓글입니다' && comment.LOCCMTUDT !== comment.LOCCMTRDT ? ' (수정됨)' : ''), // ()
children: [], // children: [], //
updateAtRaw: comment.LOCCMTUDT, updateAtRaw: comment.LOCCMTUDT,
likeClicked: comment.myReaction == 1,
dislikeClicked: comment.myReaction == 2,
})) }))
.sort((a, b) => b.createdAtRaw - a.createdAtRaw); .sort((a, b) => b.createdAtRaw - a.createdAtRaw);

View File

@ -273,7 +273,6 @@
if (attachFiles.value && attachFiles.value.length > 0) { if (attachFiles.value && attachFiles.value.length > 0) {
await Promise.all( await Promise.all(
attachFiles.value.map(async file => { attachFiles.value.map(async file => {
console.log(file);
const formData = new FormData(); const formData = new FormData();
const fileNameWithoutExt = file.name.replace(/\.[^/.]+$/, ''); const fileNameWithoutExt = file.name.replace(/\.[^/.]+$/, '');