Sync updating avatar

pull/3445/head
johnniang 2019-05-07 10:02:21 +08:00
parent 38fb0306b6
commit 926007c45b
2 changed files with 7 additions and 2 deletions

View File

@ -22,7 +22,7 @@
<a-avatar
class="avatar"
size="small"
:src="user.avatar"
:src="avatar"
/>
</span>
<a-menu
@ -79,9 +79,11 @@ export default {
this.loadUser()
this.loadOptions()
},
computed: {
...mapGetters(['nickname', 'avatar'])
},
methods: {
...mapActions(['logout']),
...mapGetters(['nickname']),
handleLogout() {
const that = this

View File

@ -148,6 +148,7 @@ import AttachmentSelectDrawer from '../attachment/components/AttachmentSelectDra
import userApi from '@/api/user'
import adminApi from '@/api/admin'
import optionApi from '@/api/option'
import { mapMutations } from 'vuex'
export default {
components: {
@ -180,6 +181,7 @@ export default {
this.loadOptions()
},
methods: {
...mapMutations({ setAvatar: 'SET_AVATAR' }),
handleShowAttachDrawer() {
this.attachmentDrawerVisible = true
},
@ -212,6 +214,7 @@ export default {
handleUpdateProfile() {
userApi.updateProfile(this.user).then(response => {
this.user = response.data.data
this.setAvatar(this.user.avatar)
this.$message.success('资料更新成功!')
})
},