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-stage">
|
||||||
<view class="avatar-glow"></view>
|
<view class="avatar-glow"></view>
|
||||||
<view class="avatar-circle">
|
<view class="avatar-circle">
|
||||||
<view class="person-head"></view>
|
<image class="avatar-img" :src="avatarUrl" mode="aspectFill" />
|
||||||
<view class="person-body"></view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="verify-badge">✓</view>
|
<view class="verify-badge">✓</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -68,6 +67,11 @@ import { useAppStore } from '../../stores/app.js'
|
|||||||
const store = useAppStore()
|
const store = useAppStore()
|
||||||
const profile = computed(() => store.userProfile || store.registrationData || {})
|
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 displayName = computed(() => profile.value.nickname || '张义明')
|
||||||
|
|
||||||
const metaLine = computed(() => {
|
const metaLine = computed(() => {
|
||||||
@@ -395,4 +399,10 @@ const terminateLifeHarmony = () => {
|
|||||||
font-size: 22rpx;
|
font-size: 22rpx;
|
||||||
letter-spacing: 8rpx;
|
letter-spacing: 8rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.avatar-img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user