|
|
|
@ -12,7 +12,7 @@
@@ -12,7 +12,7 @@
|
|
|
|
|
<div class="user-info-top"> |
|
|
|
|
<AAvatar draggable |
|
|
|
|
width="32px" |
|
|
|
|
:src="getUserInfo.avatar" |
|
|
|
|
:src="getAvatarUrl" |
|
|
|
|
:size="80" |
|
|
|
|
/> |
|
|
|
|
<h2>{{ getUserInfo.nickName }}</h2> |
|
|
|
@ -62,6 +62,7 @@
@@ -62,6 +62,7 @@
|
|
|
|
|
<template #label> |
|
|
|
|
<Icon icon="fa6-solid:robot"/> |
|
|
|
|
</template> |
|
|
|
|
<a href="#">申请</a> |
|
|
|
|
已认证 |
|
|
|
|
</ADescriptionsItem> |
|
|
|
|
</ADescriptions> |
|
|
|
@ -92,7 +93,7 @@
@@ -92,7 +93,7 @@
|
|
|
|
|
:customRequest="handleUploadAvatar" |
|
|
|
|
:before-upload="handleBeforeUpload" |
|
|
|
|
> |
|
|
|
|
<img v-if="state.imageUrl" :src="state.imageUrl"> |
|
|
|
|
<img v-if="getImageUrl" :src="getImageUrl"> |
|
|
|
|
<div v-else> |
|
|
|
|
<LoadingOutlined v-if="state.uploadAvatarLoading"/> |
|
|
|
|
<PlusOutlined v-else/> |
|
|
|
@ -119,7 +120,7 @@
@@ -119,7 +120,7 @@
|
|
|
|
|
import {PageWrapper} from '/@/components/Page'; |
|
|
|
|
import {CreditCardOutlined, LoadingOutlined, PlusOutlined, UserOutlined} from '@ant-design/icons-vue'; |
|
|
|
|
import type {CSSProperties} from 'vue'; |
|
|
|
|
import {computed, reactive} from 'vue'; |
|
|
|
|
import {computed, reactive, unref} from 'vue'; |
|
|
|
|
import {Icon} from '/@/components/Icon'; |
|
|
|
|
import {BasicForm, useForm} from '/@/components/Form/index'; |
|
|
|
|
import {userFormSchema} from './userInfo.data'; |
|
|
|
@ -137,7 +138,7 @@
@@ -137,7 +138,7 @@
|
|
|
|
|
uploadAvatarBtnLoading: boolean; |
|
|
|
|
uploadAvatarLoading: boolean; |
|
|
|
|
userInfo: User | any; |
|
|
|
|
imageUrl?: string; |
|
|
|
|
imageUrl: string; |
|
|
|
|
tabList: Recordable[]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -159,7 +160,7 @@
@@ -159,7 +160,7 @@
|
|
|
|
|
uploadAvatarLoading: false, |
|
|
|
|
uploadAvatarBtnLoading: false, |
|
|
|
|
userInfo: undefined, |
|
|
|
|
imageUrl: undefined, |
|
|
|
|
imageUrl: '', |
|
|
|
|
tabList: [ |
|
|
|
|
{ |
|
|
|
|
key: 'baseInfo', |
|
|
|
@ -222,14 +223,16 @@
@@ -222,14 +223,16 @@
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const getUserInfo = computed((): User & any => { |
|
|
|
|
let userInfo = state.userInfo ? state.userInfo : {}; |
|
|
|
|
if (userInfo.avatar) { |
|
|
|
|
userInfo.avatar ? (userInfo.avatar = isUrl(userInfo.avatar) ? userInfo.avatar : apiUrl + userInfo.avatar) : (userInfo.avatar = defaultAvatarUrl); |
|
|
|
|
state!.imageUrl = userInfo.avatar; |
|
|
|
|
} |
|
|
|
|
let userInfo = state.userInfo || {}; |
|
|
|
|
userInfo.avatar || (userInfo.avatar = defaultAvatarUrl); |
|
|
|
|
state!.imageUrl = userInfo.avatar; |
|
|
|
|
return userInfo; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const getAvatarUrl = computed((): string => isUrl(unref(getUserInfo).avatar) ? unref(getUserInfo).avatar : apiUrl + unref(getUserInfo).avatar); |
|
|
|
|
|
|
|
|
|
const getImageUrl = computed((): string => isUrl(state.imageUrl) ? state.imageUrl : apiUrl + state.imageUrl); |
|
|
|
|
|
|
|
|
|
const getLabelStyle = computed((): CSSProperties => ({ |
|
|
|
|
fontSize: '14px', |
|
|
|
|
display: 'inline', |
|
|
|
@ -264,7 +267,7 @@
@@ -264,7 +267,7 @@
|
|
|
|
|
const complete = ((progressEvent.loaded / progressEvent.total) * 100) | 0; |
|
|
|
|
if (complete >= 100) state.uploadAvatarLoading = false; |
|
|
|
|
}); |
|
|
|
|
state.imageUrl = apiUrl + data.url; |
|
|
|
|
state.imageUrl = data.url; |
|
|
|
|
} finally { |
|
|
|
|
state.uploadAvatarLoading = false; |
|
|
|
|
} |
|
|
|
|