feat: 用户信息修改

This commit is contained in:
2026-06-22 12:57:31 +08:00
parent 28b27bf127
commit 3354623dd9
6 changed files with 44 additions and 6 deletions

View File

@@ -239,6 +239,7 @@ import {
} from '@element-plus/icons-vue'
import { useAccountStore } from '@/stores'
import { storeToRefs } from 'pinia'
import { getAvatarUrl } from '@/utils'
import AvatarCropper from './AvatarCropper.vue'
/** 编辑资料表单数据 */
@@ -306,11 +307,11 @@ const hasAvatar = computed(() => {
return !!(av && av.length > 0)
})
/** 头像显示源:裁剪预览 > 移除状态 > store 数据 */
/** 头像显示源:裁剪预览 > 移除状态 > store 数据(已拼接后端域名) */
const avatarDisplaySrc = computed(() => {
if (avatarRemoved.value) return ''
if (croppedPreviewUrl.value) return croppedPreviewUrl.value
return accountInfo.value?.avatar || ''
return getAvatarUrl(accountInfo.value?.avatar)
})
/** 根据生日计算年龄(周岁) */

View File

@@ -30,7 +30,7 @@
>
<div class="table-card__chair-seat">
<img
:src="room.players[idx].avatar"
:src="getAvatarUrl(room.players[idx].avatar)"
:alt="room.players[idx].nickname"
class="table-card__chair-avatar"
/>
@@ -73,6 +73,7 @@
<script setup lang="ts">
import { computed } from 'vue'
import type { RoomItem, RoomPlayer, RoomStatus } from '@/api/modules/game'
import { getAvatarUrl } from '@/utils'
const props = defineProps<{
room: RoomItem

View File

@@ -138,6 +138,7 @@ import { ElMessage } from 'element-plus'
import { Setting, EditPen, ArrowRight, Check, DocumentCopy, SwitchButton } from '@element-plus/icons-vue'
import { useAccountStore } from '@/stores'
import { UserStatus, type UserStatusType } from '@/api/modules/user'
import { getAvatarUrl } from '@/utils'
import EditProfileDialog from './EditProfileDialog.vue'
/** 在线状态选项 */
@@ -170,7 +171,7 @@ const currentStatus = computed<StatusOption>(() => {
return backendStatus ? (statusMap.get(backendStatus) ?? STATUS_OPTIONS[0]!) : STATUS_OPTIONS[0]!
})
const userAvatar = computed(() => accountInfo.value?.avatar || '')
const userAvatar = computed(() => getAvatarUrl(accountInfo.value?.avatar))
const displayName = computed(() => accountInfo.value?.nickName || '未登录')
const signatureText = computed(() => accountInfo.value?.signature || '这个人很懒,什么都没写...')