게시글 프로필 이미지 보이게 익명일경우도 익명이미지 노출하도록

This commit is contained in:
nevermoregb 2025-03-11 12:38:03 +09:00
parent c3dabc4262
commit fb8c00fd6b
3 changed files with 16 additions and 9 deletions

View File

@ -7,6 +7,7 @@
:profileName="comment.author"
:date="comment.createdAt"
:comment="comment"
:profileImg="comment.profileImg"
:showDetail="false"
:isLike="!isLike"
:isCommentPassword="isCommentPassword"

View File

@ -1,8 +1,8 @@
<template>
<div class="d-flex align-items-center flex-wrap">
<div class="d-flex align-items-center">
<div v-if="!unknown" class="avatar me-2">
<img :src="getProfileImage(profilePath)" alt="Avatar" class="rounded-circle" />
<div class="avatar me-2">
<img :src="getProfileImage(profileImg)" alt="Avatar" class="rounded-circle" />
</div>
<div class="me-2">
@ -60,10 +60,6 @@
type: String,
default: '',
},
profilePath: {
type: String,
default: '',
},
unknown: {
type: Boolean,
default: true,
@ -94,6 +90,10 @@
type: Boolean,
default: false,
},
profileImg: {
type: String,
default: false,
},
});
const emit = defineEmits(['updateReaction', 'editClick', 'deleteClick']);
@ -122,7 +122,8 @@
};
//
const getProfileImage = profilePath => {
return profilePath && profilePath.trim() ? `${baseUrl}upload/img/profile/${profilePath}` : defaultProfile;
const getProfileImage = profileImg => {
console.log('profileImg: ', profileImg);
return profileImg && profileImg != '' ? `${baseUrl}upload/img/profile/${profileImg}` : defaultProfile;
};
</script>

View File

@ -10,6 +10,7 @@
:boardId="currentBoardId"
:profileName="profileName"
:unknown="unknown"
:profileImg="profileImg"
:views="views"
:commentNum="commentNum"
:date="formattedBoardDate"
@ -150,6 +151,7 @@
const commentNum = ref(0);
const attachment = ref(false);
const comments = ref([]);
const profileImg = ref('');
const route = useRoute();
const router = useRouter();
@ -240,6 +242,7 @@
authorId.value = data.authorId;
boardTitle.value = data.title || '제목 없음';
boardContent.value = data.content || '';
profileImg.value = data.profileImg || '';
date.value = data.date || '';
views.value = data.cnt || 0;
likes.value = data.likeCount || 0;
@ -304,6 +307,7 @@
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), //
@ -325,6 +329,7 @@
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
@ -340,7 +345,7 @@
comment.children = []; //
}
}
commentsList;
//
comments.value = commentsList;