feat: add base user avatar component

This commit is contained in:
Tim
2025-09-24 00:30:54 +08:00
parent 26d1db79f4
commit 76aef40de7
15 changed files with 314 additions and 43 deletions

View File

@@ -17,13 +17,13 @@
></div>
</div>
<div class="poll-participants">
<BaseImage
<BaseUserAvatar
v-for="p in pollOptionParticipants[idx] || []"
:key="p.id"
class="poll-participant-avatar"
:user-id="p.id"
:src="p.avatar"
alt="avatar"
@click="gotoUser(p.id)"
/>
</div>
</div>
@@ -119,6 +119,7 @@ import { getToken, authState } from '~/utils/auth'
import { toast } from '~/main'
import { useRuntimeConfig } from '#imports'
import { useCountdown } from '~/composables/useCountdown'
import BaseUserAvatar from '~/components/BaseUserAvatar.vue'
const props = defineProps({
poll: { type: Object, required: true },
@@ -152,8 +153,6 @@ watch([hasVoted, pollEnded], ([voted, ended]) => {
if (voted || ended) showPollResult.value = true
})
const gotoUser = (id) => navigateTo(`/users/${id}`, { replace: true })
const config = useRuntimeConfig()
const API_BASE_URL = config.public.apiBaseUrl
const voteOption = async (idx) => {
@@ -429,4 +428,10 @@ const submitMultiPoll = async () => {
border-radius: 50%;
cursor: pointer;
}
.poll-participant-avatar :deep(.base-user-avatar-img) {
width: 100%;
height: 100%;
object-fit: cover;
}
</style>