Former-commit-id: 610c12b2a8679bfcad918e3d24d04a1a6af41c4c [formerly 610c12b2a8679bfcad918e3d24d04a1a6af41c4c [formerly 610c12b2a8679bfcad918e3d24d04a1a6af41c4c [formerly 610c12b2a8679bfcad918e3d24d04a1a6af41c4c [formerly cc710028c0810b73facbb1f00ba054da58bd88da [formerly 39767add7846a4a3f27fb79c47d121ceb1d3d6a0]]]]] Former-commit-id: 740804501e73b47382d505ce1fa24e7bba3beb3b Former-commit-id: a61192c10d96e687b6fe7ebd5e40e2a2cc816d8b Former-commit-id: e142163ddd0be72d2de796dc90a54de29e64da4d [formerly 1f32a6afe0a2302808606bcb9c9776e93d4d805b] Former-commit-id: 2bd41fd483228f0aff6255f5be5b72aa72e4b64e Former-commit-id: bfd7e5e99f4774d60e8433e4f519d1d44db187ad Former-commit-id: 8c4f66b40505956019099d80abbdaaa88808b011 Former-commit-id: aa887c968ab01b652512c95dc5b8503f68230c49 Former-commit-id: 0785746511cac0ba75c813f15e5b0914fbd916c1
50 lines
1.2 KiB
Vue
50 lines
1.2 KiB
Vue
<template>
|
|
<el-dropdown class="d2-mr">
|
|
<span class="btn-text">你好 {{userInfo.name}}</span>
|
|
<el-dropdown-menu slot="dropdown">
|
|
<el-dropdown-item @click.native="logOff"><d2-icon name="power-off"/> 注销</el-dropdown-item>
|
|
<el-dropdown-item><d2-icon name="user-circle-o"/> 个人中心</el-dropdown-item>
|
|
</el-dropdown-menu>
|
|
</el-dropdown>
|
|
</template>
|
|
|
|
<script>
|
|
// 插件
|
|
import Cookies from 'js-cookie'
|
|
import { mapState, mapMutations } from 'vuex'
|
|
export default {
|
|
computed: {
|
|
...mapState({
|
|
userInfo: state => state.d2admin.userInfo
|
|
})
|
|
},
|
|
methods: {
|
|
...mapMutations([
|
|
'd2adminUtilDbRemoveByUuid'
|
|
]),
|
|
logOff () {
|
|
this.$confirm('注销此账户吗?', '注销', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
// 删除用户信息
|
|
this.d2adminUtilDbRemoveByUuid({
|
|
key: 'userInfo',
|
|
emptyValue: ''
|
|
})
|
|
// 删除cookie
|
|
Cookies.remove('token')
|
|
Cookies.remove('uuid')
|
|
// 跳转路由
|
|
this.$router.push({
|
|
name: 'login'
|
|
})
|
|
}).catch(() => {
|
|
// 取消了注销
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|