mirror of https://github.com/halo-dev/halo
Sync updating avatar
parent
38fb0306b6
commit
926007c45b
|
@ -22,7 +22,7 @@
|
||||||
<a-avatar
|
<a-avatar
|
||||||
class="avatar"
|
class="avatar"
|
||||||
size="small"
|
size="small"
|
||||||
:src="user.avatar"
|
:src="avatar"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
<a-menu
|
<a-menu
|
||||||
|
@ -79,9 +79,11 @@ export default {
|
||||||
this.loadUser()
|
this.loadUser()
|
||||||
this.loadOptions()
|
this.loadOptions()
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters(['nickname', 'avatar'])
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['logout']),
|
...mapActions(['logout']),
|
||||||
...mapGetters(['nickname']),
|
|
||||||
handleLogout() {
|
handleLogout() {
|
||||||
const that = this
|
const that = this
|
||||||
|
|
||||||
|
|
|
@ -148,6 +148,7 @@ import AttachmentSelectDrawer from '../attachment/components/AttachmentSelectDra
|
||||||
import userApi from '@/api/user'
|
import userApi from '@/api/user'
|
||||||
import adminApi from '@/api/admin'
|
import adminApi from '@/api/admin'
|
||||||
import optionApi from '@/api/option'
|
import optionApi from '@/api/option'
|
||||||
|
import { mapMutations } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
@ -180,6 +181,7 @@ export default {
|
||||||
this.loadOptions()
|
this.loadOptions()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
...mapMutations({ setAvatar: 'SET_AVATAR' }),
|
||||||
handleShowAttachDrawer() {
|
handleShowAttachDrawer() {
|
||||||
this.attachmentDrawerVisible = true
|
this.attachmentDrawerVisible = true
|
||||||
},
|
},
|
||||||
|
@ -212,6 +214,7 @@ export default {
|
||||||
handleUpdateProfile() {
|
handleUpdateProfile() {
|
||||||
userApi.updateProfile(this.user).then(response => {
|
userApi.updateProfile(this.user).then(response => {
|
||||||
this.user = response.data.data
|
this.user = response.data.data
|
||||||
|
this.setAvatar(this.user.avatar)
|
||||||
this.$message.success('资料更新成功!')
|
this.$message.success('资料更新成功!')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue