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