feat: 头像更细

This commit is contained in:
2026-06-04 14:20:44 +08:00
parent aa672194ea
commit 437b191b12
2 changed files with 8 additions and 6 deletions

View File

@@ -52,7 +52,7 @@
<img src="@/assets/images/profile-content-bg.jpg" alt="" />
<div class="content">
<div class="profile">
<img class="profile-avatar" :src="userInfoStore.state.userInfo.avatarUrl" alt="" />
<img class="profile-avatar" :src="userInfo.avatarUrl" alt="" />
</div>
<div class="name">
{{ $t('MainHeader.HiName', { name: userInfo.username }) }}
@@ -288,7 +288,7 @@
width: 5rem;
height: 5rem;
border-radius: 50%;
.profile-avatar{
.profile-avatar {
width: 100%;
height: 100%;
border-radius: 50%;

View File

@@ -16,7 +16,7 @@
<input
type="file"
ref="fileInput"
style="display:none"
style="display: none"
accept="image/*"
@change="handleFileChange"
/>
@@ -95,7 +95,8 @@
import AvatarCropDialog from './AvatarCropDialog.vue'
import type { RoleOption, RoleValue, SettingsData } from '../types'
import { uploadFile, updateUserAvatar } from '@/api/user'
import { useUserInfoStore } from '@/stores'
const props = defineProps<{
displayData: SettingsData
firstName: string
@@ -178,6 +179,7 @@
}
await updateUserAvatar({ avatarUrl: url })
useUserInfoStore().setAvatarUrl(url)
ElMessage.success(t('Settings.messages.avatarUpdated'))
emit('avatar-updated', url)
} catch (err) {
@@ -205,9 +207,9 @@
isAvatarCropDialogVisible.value = true
}
const handleAvatarCropConfirm = async (file: File) => {
const handleAvatarCropConfirm = (file: File) => {
closeAvatarCropDialog()
await uploadAvatarFile(file)
uploadAvatarFile(file)
}
onBeforeUnmount(() => {