提交修改

This commit is contained in:
quyixiao 2020-08-28 11:42:51 +08:00
parent 8b6bd01a15
commit 3e17a3767a
3 changed files with 28 additions and 11 deletions

View File

@ -56,11 +56,22 @@
}, },
computed: { computed: {
userName: { userName: {
get () { return this.$store.state.user.name } get () {
return this.$store.state.user.username
}
},
realName: {
get () {
return this.$store.state.user.realName
}
}, },
mainTabs: { mainTabs: {
get () { return this.$store.state.common.mainTabs }, get () {
set (val) { this.$store.commit('common/updateMainTabs', val) } return this.$store.state.common.mainTabs
},
set (val) {
this.$store.commit('common/updateMainTabs', val)
}
} }
}, },
methods: { methods: {

View File

@ -38,7 +38,7 @@
<el-menu-item class="site-navbar__avatar" index="3"> <el-menu-item class="site-navbar__avatar" index="3">
<el-dropdown :show-timeout="0" placement="bottom"> <el-dropdown :show-timeout="0" placement="bottom">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
<img src="~@/assets/img/login/avatar.png" :alt="userName">{{ userName }} <img src="~@/assets/img/login/avatar.png" :alt="realName">{{ realName }}
</span> </span>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="handleUpdatePassword()">修改密码</el-dropdown-item> <el-dropdown-item @click.native="handleUpdatePassword()">修改密码</el-dropdown-item>
@ -80,7 +80,10 @@
set (val) { this.$store.commit('common/updateMainTabs', val) } set (val) { this.$store.commit('common/updateMainTabs', val) }
}, },
userName: { userName: {
get () { return this.$store.state.user.name } get () { return this.$store.state.user.username }
},
realName: {
get () { return this.$store.state.user.realName }
} }
}, },
methods: { methods: {

View File

@ -19,7 +19,7 @@
import MainSidebar from './main-sidebar' import MainSidebar from './main-sidebar'
import MainContent from './main-content' import MainContent from './main-content'
import { apiGetUserInfo } from '@/api/api_sys' import { apiGetUserInfo } from '@/api/api_sys'
export default { export default {
provide () { provide () {
return { return {
@ -55,7 +55,9 @@
set (val) { this.$store.commit('user/updateId', val) } set (val) { this.$store.commit('user/updateId', val) }
}, },
userName: { userName: {
get () { return this.$store.state.user.name }, get () {
return this.$store.state.user.userName
},
set (val) { this.$store.commit('user/updateName', val) } set (val) { this.$store.commit('user/updateName', val) }
} }
}, },
@ -63,9 +65,9 @@
this.handleGetUserInfo() this.handleGetUserInfo()
}, },
mounted () { mounted () {
this.resetDocumentClientHeight() this.resetDocumentClientHeight()
}, },
methods: { methods: {
// //
@ -82,6 +84,7 @@
this.loading = false this.loading = false
this.userId = res.user.userId this.userId = res.user.userId
this.userName = res.user.username this.userName = res.user.username
this.$store.state.user = res.user
this.mobile = res.user.mobile this.mobile = res.user.mobile
this.$watermark.set(this.userName + ' ' + this.mobile.substr(0, 4)) this.$watermark.set(this.userName + ' ' + this.mobile.substr(0, 4))
} else { } else {
@ -89,8 +92,8 @@
} }
}) })
} }
} }
} }
</script> </script>