diff --git a/.env.development b/.env.development index e833169..3ecb58e 100644 --- a/.env.development +++ b/.env.development @@ -1,2 +1,3 @@ -# 已切换为真实后端接口 -VITE_USE_MOCK=false +# 后端服务地址(开发环境) +# 头像等静态资源通过此地址访问,生产环境留空即使用相对路径 +VITE_BACKEND_URL=http://localhost:8080 diff --git a/src/components/baseLayouts/EditProfileDialog.vue b/src/components/baseLayouts/EditProfileDialog.vue index b07543d..3d67946 100644 --- a/src/components/baseLayouts/EditProfileDialog.vue +++ b/src/components/baseLayouts/EditProfileDialog.vue @@ -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) }) /** 根据生日计算年龄(周岁) */ diff --git a/src/components/baseLayouts/TableCard.vue b/src/components/baseLayouts/TableCard.vue index 27a4fa8..c46d0d2 100644 --- a/src/components/baseLayouts/TableCard.vue +++ b/src/components/baseLayouts/TableCard.vue @@ -30,7 +30,7 @@ >