优化登陆和注销逻辑
Former-commit-id: f423b58687a0d65ce70a95ce1593b429704775f5 [formerly 664e42ad888903b010ec1a8e7cbda762b17cdc4a] [formerly f423b58687a0d65ce70a95ce1593b429704775f5 [formerly 664e42ad888903b010ec1a8e7cbda762b17cdc4a] [formerly f423b58687a0d65ce70a95ce1593b429704775f5 [formerly 664e42ad888903b010ec1a8e7cbda762b17cdc4a] [formerly 664e42ad888903b010ec1a8e7cbda762b17cdc4a [formerly a3bbfc1f94606188ed35a2457ad9c151f2a4cedd [formerly ed00257f4f4147114d7aeea450a2d6945b4e7545]]]]] Former-commit-id: 3c329a9dabe00f428051d837e130c1ce71b26036 Former-commit-id: e04dd339ec94fde93518c07ba78374faad70efba Former-commit-id: 4a4af4b9bf562edd65993d9d0eff80116da621fc [formerly 4b8c811d1b2ab5e5bedf583eb374c0819d918d48] Former-commit-id: 67b88726e79a45834e33b9c92a68685da3e6127d Former-commit-id: f6b13db93efe29cea7ad6870f8f8db323ad9898a Former-commit-id: 440e1db752d5dbe6d1a069a7b2a7711d82f640cf Former-commit-id: 19dbd962aa57656bcf29310761b4505ce8df7031 Former-commit-id: 053b5d58aaa43c007bad159603ec7966e99c53cf
This commit is contained in:
parent
1517c714d9
commit
80c68f9e5e
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "d2-admin",
|
||||
"version": "1.6.11",
|
||||
"version": "1.6.12",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve --open",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<el-dropdown size="small" class="d2-mr">
|
||||
<span class="btn-text">你好 {{info.name}}</span>
|
||||
<span class="btn-text">{{info.name ? `你好 ${info.name}` : '未登录'}}</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item @click.native="logOff">
|
||||
<d2-icon name="power-off" class="d2-mr-5"/>
|
||||
|
|
|
|||
|
|
@ -10,8 +10,6 @@ import business from './modules/business'
|
|||
|
||||
import layoutHeaderAside from '@/layout/header-aside'
|
||||
|
||||
const meta = { auth: true }
|
||||
|
||||
/**
|
||||
* 在主框架内显示
|
||||
*/
|
||||
|
|
@ -25,7 +23,9 @@ const frameIn = [
|
|||
{
|
||||
path: 'index',
|
||||
name: 'index',
|
||||
meta,
|
||||
meta: {
|
||||
auth: true
|
||||
},
|
||||
component: () => import('@/pages/index')
|
||||
},
|
||||
// 刷新页面 必须保留
|
||||
|
|
|
|||
|
|
@ -63,11 +63,5 @@ export default {
|
|||
// 是否默认开启页面切换动画
|
||||
transition: {
|
||||
active: true
|
||||
},
|
||||
// 在读取持久化数据失败时默认用户信息
|
||||
user: {
|
||||
info: {
|
||||
name: 'Ghost'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,14 +52,16 @@ export default {
|
|||
* @param {Object} param vm {Object} vue 实例
|
||||
* @param {Object} param confirm {Boolean} 是否需要确认
|
||||
*/
|
||||
logout ({ commit }, { vm, confirm = false }) {
|
||||
logout ({ commit, dispatch }, { vm, confirm = false }) {
|
||||
/**
|
||||
* @description 注销
|
||||
*/
|
||||
function logout () {
|
||||
async function logout () {
|
||||
// 删除cookie
|
||||
util.cookies.remove('token')
|
||||
util.cookies.remove('uuid')
|
||||
// 清空 vuex 用户信息
|
||||
await dispatch('d2admin/user/set', {}, { root: true })
|
||||
// 跳转路由
|
||||
vm.$router.push({
|
||||
name: 'login'
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
// 设置文件
|
||||
import setting from '@/setting.js'
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
// 用户信息
|
||||
info: setting.user.info
|
||||
info: {}
|
||||
},
|
||||
actions: {
|
||||
/**
|
||||
|
|
@ -38,7 +35,7 @@ export default {
|
|||
state.info = await dispatch('d2admin/db/get', {
|
||||
dbName: 'sys',
|
||||
path: 'user.info',
|
||||
defaultValue: setting.user.info,
|
||||
defaultValue: {},
|
||||
user: true
|
||||
}, { root: true })
|
||||
// end
|
||||
|
|
|
|||
Loading…
Reference in New Issue