- UserAvatar 컴포넌트(커스텀>구글>이니셜, 로드 실패 시 이니셜 폴백) - 목록: 작성자 아바타 + 추천 수 표기 - 상세: 작성자 아바타, 추천/비추천 토글 버튼(내 투표 강조), 추천자 본문 하단 아바타 10개 + 초과 시 (+N명이 추천했습니다), 클릭 시 전체 목록 모달 - 댓글: 작성자 아바타 + 추천/비추천 버튼 - 계정정보: 포인트 표기(GET /auth/points 최신값) - boardApi.votePost/voteComment/recommenders, authApi.points 추가 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import { computed, ref } from 'vue'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { RouterLink, useRouter } from 'vue-router'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { authApi } from '@/api/authApi'
|
||||
@@ -10,6 +10,18 @@ const auth = useAuthStore()
|
||||
const router = useRouter()
|
||||
const dialog = useDialog()
|
||||
|
||||
// 포인트(게시판 작성으로 수시 변동) — 진입 시 최신값 조회
|
||||
const points = ref(auth.user?.points ?? 0)
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const res = await authApi.points()
|
||||
points.value = res.points ?? 0
|
||||
await auth.applyUser({ points: points.value })
|
||||
} catch {
|
||||
// 조회 실패 시 캐시값 유지
|
||||
}
|
||||
})
|
||||
|
||||
const u = computed(() => auth.user || {})
|
||||
const roleLabel = computed(() => (u.value.role === 'ADMIN' ? '관리자' : '일반회원'))
|
||||
const isPremium = computed(() => auth.isPremium)
|
||||
@@ -116,6 +128,10 @@ function goEdit() {
|
||||
<RouterLink v-if="!isPremium" to="/upgrade" class="up-link">업그레이드 →</RouterLink>
|
||||
</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span class="k">포인트</span>
|
||||
<span class="v"><span class="points">{{ points.toLocaleString('ko-KR') }} P</span></span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<button type="button" class="primary-btn" @click="goEdit">이름 변경</button>
|
||||
@@ -181,6 +197,10 @@ function goEdit() {
|
||||
.v .premium {
|
||||
color: #b8860b;
|
||||
}
|
||||
.points {
|
||||
color: hsla(160, 100%, 37%, 1);
|
||||
font-weight: 700;
|
||||
}
|
||||
.up-link {
|
||||
margin-left: 0.5rem;
|
||||
font-size: 0.82rem;
|
||||
|
||||
Reference in New Issue
Block a user