fix(mine): replace static avatar with dynamic dicebear image
This commit is contained in:
@@ -12,8 +12,7 @@
|
||||
<view class="avatar-stage">
|
||||
<view class="avatar-glow"></view>
|
||||
<view class="avatar-circle">
|
||||
<view class="person-head"></view>
|
||||
<view class="person-body"></view>
|
||||
<image class="avatar-img" :src="avatarUrl" mode="aspectFill" />
|
||||
</view>
|
||||
<view class="verify-badge">✓</view>
|
||||
</view>
|
||||
@@ -68,6 +67,11 @@ import { useAppStore } from '../../stores/app.js'
|
||||
const store = useAppStore()
|
||||
const profile = computed(() => store.userProfile || store.registrationData || {})
|
||||
|
||||
const avatarUrl = computed(() => {
|
||||
const seed = profile.value.nickname || 'user'
|
||||
return `https://api.dicebear.com/7.x/avataaars/svg?seed=${encodeURIComponent(seed)}&backgroundColor=b982ff`
|
||||
})
|
||||
|
||||
const displayName = computed(() => profile.value.nickname || '张义明')
|
||||
|
||||
const metaLine = computed(() => {
|
||||
@@ -395,4 +399,10 @@ const terminateLifeHarmony = () => {
|
||||
font-size: 22rpx;
|
||||
letter-spacing: 8rpx;
|
||||
}
|
||||
|
||||
.avatar-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user