feat 用户选项添加 用户显示和跳转
This commit is contained in:
parent
63f4064b7c
commit
8a3bddb917
@ -6,6 +6,7 @@ export default {
|
|||||||
namespaced: true,
|
namespaced: true,
|
||||||
state: {
|
state: {
|
||||||
token: null,
|
token: null,
|
||||||
|
id: null,
|
||||||
name: null,
|
name: null,
|
||||||
uname: null,
|
uname: null,
|
||||||
photo: null,
|
photo: null,
|
||||||
@ -19,6 +20,7 @@ export default {
|
|||||||
if (state.token == null) {
|
if (state.token == null) {
|
||||||
if (localStorage.getItem('token') != null) {
|
if (localStorage.getItem('token') != null) {
|
||||||
state.token = localStorage.getItem('token')
|
state.token = localStorage.getItem('token')
|
||||||
|
state.id = localStorage.getItem('id')
|
||||||
state.name = localStorage.getItem('name')
|
state.name = localStorage.getItem('name')
|
||||||
state.uname = localStorage.getItem('uname')
|
state.uname = localStorage.getItem('uname')
|
||||||
state.photo = localStorage.getItem('photo')
|
state.photo = localStorage.getItem('photo')
|
||||||
@ -31,6 +33,7 @@ export default {
|
|||||||
// 清除用户信息
|
// 清除用户信息
|
||||||
destroyUser (state) {
|
destroyUser (state) {
|
||||||
state.token = null
|
state.token = null
|
||||||
|
state.id = null
|
||||||
state.name = null
|
state.name = null
|
||||||
state.uname = null
|
state.uname = null
|
||||||
state.photo = null
|
state.photo = null
|
||||||
@ -57,6 +60,7 @@ export default {
|
|||||||
res => {
|
res => {
|
||||||
if (res.data.status === 1) {
|
if (res.data.status === 1) {
|
||||||
localStorage.setItem('token', res.data.token)
|
localStorage.setItem('token', res.data.token)
|
||||||
|
localStorage.setItem('id', res.data.adminInfo.id)
|
||||||
localStorage.setItem('name', res.data.adminInfo.name)
|
localStorage.setItem('name', res.data.adminInfo.name)
|
||||||
localStorage.setItem('uname', res.data.adminInfo.uname)
|
localStorage.setItem('uname', res.data.adminInfo.uname)
|
||||||
localStorage.setItem('photo', res.data.adminInfo.photo)
|
localStorage.setItem('photo', res.data.adminInfo.photo)
|
||||||
|
@ -20,6 +20,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-dropdown-menu slot="dropdown" class="user-dropdown">
|
<el-dropdown-menu slot="dropdown" class="user-dropdown">
|
||||||
|
<!-- 账号id显示 -->
|
||||||
|
<el-dropdown-item command="go-adminEdit">
|
||||||
|
<i class="el-icon-user-solid m-r-10"></i>
|
||||||
|
<font class="brandFontColor">{{ this.$store.state.user.name }}</font>
|
||||||
|
</el-dropdown-item>
|
||||||
<!-- 自定义语言设置为右侧弹出 -->
|
<!-- 自定义语言设置为右侧弹出 -->
|
||||||
<el-dropdown-item>
|
<el-dropdown-item>
|
||||||
<el-popover placement="right-start" width="150" trigger="hover" v-model="languagePopoverVisible">
|
<el-popover placement="right-start" width="150" trigger="hover" v-model="languagePopoverVisible">
|
||||||
@ -290,6 +295,8 @@ export default {
|
|||||||
this.$router.push('/home/set')
|
this.$router.push('/home/set')
|
||||||
} else if (command === 'logout') {
|
} else if (command === 'logout') {
|
||||||
this.logout()
|
this.logout()
|
||||||
|
} else if (command === 'go-adminEdit') {
|
||||||
|
this.$router.push(`/admin/edit/${this.$store.state.user.id}`)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeLang (lang) {
|
changeLang (lang) {
|
||||||
|
Loading…
Reference in New Issue
Block a user