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

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" :profileName="comment.author"
:date="comment.createdAt" :date="comment.createdAt"
:comment="comment" :comment="comment"
:profileImg="comment.profileImg"
:showDetail="false" :showDetail="false"
:isLike="!isLike" :isLike="!isLike"
:isCommentPassword="isCommentPassword" :isCommentPassword="isCommentPassword"

View File

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

View File

@ -10,6 +10,7 @@
:boardId="currentBoardId" :boardId="currentBoardId"
:profileName="profileName" :profileName="profileName"
:unknown="unknown" :unknown="unknown"
:profileImg="profileImg"
:views="views" :views="views"
:commentNum="commentNum" :commentNum="commentNum"
:date="formattedBoardDate" :date="formattedBoardDate"
@ -150,6 +151,7 @@
const commentNum = ref(0); const commentNum = ref(0);
const attachment = ref(false); const attachment = ref(false);
const comments = ref([]); const comments = ref([]);
const profileImg = ref('');
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
@ -240,6 +242,7 @@
authorId.value = data.authorId; authorId.value = data.authorId;
boardTitle.value = data.title || '제목 없음'; boardTitle.value = data.title || '제목 없음';
boardContent.value = data.content || ''; boardContent.value = data.content || '';
profileImg.value = data.profileImg || '';
date.value = data.date || ''; date.value = data.date || '';
views.value = data.cnt || 0; views.value = data.cnt || 0;
likes.value = data.likeCount || 0; likes.value = data.likeCount || 0;
@ -304,6 +307,7 @@
content: comment.LOCCMTRPY, content: comment.LOCCMTRPY,
likeCount: comment.likeCount || 0, likeCount: comment.likeCount || 0,
dislikeCount: comment.dislikeCount || 0, dislikeCount: comment.dislikeCount || 0,
profileImg: comment.profileImg || '',
likeClicked: comment.likeClicked || false, likeClicked: comment.likeClicked || false,
dislikeClicked: comment.dislikeClicked || false, dislikeClicked: comment.dislikeClicked || false,
createdAtRaw: new Date(comment.LOCCMTRDT), // createdAtRaw: new Date(comment.LOCCMTRDT), //
@ -325,6 +329,7 @@
comment.children = replyResponse.data.data.map(reply => ({ comment.children = replyResponse.data.data.map(reply => ({
author: reply.author || '익명', author: reply.author || '익명',
authorId: reply.authorId, authorId: reply.authorId,
profileImg: reply.profileImg || '',
commentId: reply.LOCCMTSEQ, commentId: reply.LOCCMTSEQ,
boardId: reply.LOCBRDSEQ, boardId: reply.LOCBRDSEQ,
parentId: reply.LOCCMTPNT, // ID parentId: reply.LOCCMTPNT, // ID
@ -340,7 +345,7 @@
comment.children = []; // comment.children = []; //
} }
} }
commentsList;
// //
comments.value = commentsList; comments.value = commentsList;