This commit is contained in:
不做码农 2021-12-05 08:37:25 +08:00
parent 56106b8203
commit c94a94d9d8
2 changed files with 17 additions and 11 deletions

12
ZR.Vue/.jsbeautifyrc Normal file
View File

@ -0,0 +1,12 @@
{
"brace_style": "none,preserve-inline",
"indent_size": 2,
"indent_char": " ",
"jslint_happy": true,
"unformatted": [
""
],
"css": {
"indent_size": 2
}
}

View File

@ -1,13 +1,9 @@
import router from './router'
import store from './store'
import {
Message
} from 'element-ui'
import { Message } from 'element-ui'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
import {
getToken
} from '@/utils/auth'
import { getToken } from '@/utils/auth'
NProgress.configure({
showSpinner: false
@ -22,9 +18,7 @@ router.beforeEach((to, from, next) => {
if (getToken()) {
/* has token*/
if (to.path === '/login') {
next({
path: '/'
})
next({ path: '/' })
NProgress.done()
} else {
if (store.getters.roles.length === 0) {
@ -38,7 +32,7 @@ router.beforeEach((to, from, next) => {
}).catch(err => {
console.error(err)
store.dispatch('LogOut').then(() => {
console.log('弹框登录失败')
console.log('弹框登录失败')
Message.error(err != undefined ? err : '登录失败')
next({ path: '/' })
})
@ -62,4 +56,4 @@ router.beforeEach((to, from, next) => {
router.afterEach(() => {
NProgress.done()
})
})