chore
This commit is contained in:
parent
960576e286
commit
3e51a72e3b
@ -1,9 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-form :model="profile" ref="form" v-loading="loading" label-position="top">
|
<el-form :model="profile" ref="form" v-loading="loading" label-position="top">
|
||||||
<Upload class="w-28 h-28 rounded-full mx-auto" action="upload/image" :show-file-list="false" name="image" :on-success="uploadAvatar">
|
<Upload imageClass="w-28 h-28 rounded-full mx-auto" v-model="profile.avatar" />
|
||||||
<img :src="profile.avatar" class="h-28 rounded-full" v-if="profile.avatar" />
|
|
||||||
<Icon name="plus" v-else />
|
|
||||||
</Upload>
|
|
||||||
<el-form-item
|
<el-form-item
|
||||||
label="昵称"
|
label="昵称"
|
||||||
prop="username"
|
prop="username"
|
||||||
@ -66,14 +63,12 @@ interface profile {
|
|||||||
password: string
|
password: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const profile = ref<profile>(
|
const profile = ref<profile>({
|
||||||
Object.assign({
|
avatar: '',
|
||||||
avatar: '',
|
username: '',
|
||||||
username: '',
|
email: '',
|
||||||
email: '',
|
password: '',
|
||||||
password: '',
|
})
|
||||||
}),
|
|
||||||
)
|
|
||||||
const { form, loading, submitForm, afterCreate } = useCreate('user/online', null, profile)
|
const { form, loading, submitForm, afterCreate } = useCreate('user/online', null, profile)
|
||||||
|
|
||||||
const getUserInfo = () => {
|
const getUserInfo = () => {
|
||||||
@ -91,15 +86,6 @@ onMounted(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const uploadAvatar = (response, uploadFile) => {
|
|
||||||
if (response.code === Code.SUCCESS) {
|
|
||||||
form.value.avatar = response.data.path
|
|
||||||
profile.value.avatar = response.data.path
|
|
||||||
} else {
|
|
||||||
Message.error(response.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
afterCreate.value = () => {
|
afterCreate.value = () => {
|
||||||
userStore.getUserInfo()
|
userStore.getUserInfo()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user