切换导航条
切换导航条
当前项目
正在载入...
登录
术习电报
/
electron-vue-template
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
作者
umbrella22
2020-06-05 15:32:11 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
提交
9dc4f0bd82af79d2721ce67cce94bf1934907c28
9dc4f0bd
1 个父辈
92de62d2
修改登录
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
3 行增加
和
16 行删除
src/renderer/permission.js
src/renderer/permission.js
查看文件 @
9dc4f0b
/* eslint-disable no-tabs */
import
router
from
'./router'
import
store
from
'./store'
import
{
Message
}
from
'element-ui'
import
Performance
from
'@/tools/performance'
const
whiteList
=
[
'/login'
]
// 不重定向白名单
var
end
=
null
const
whiteList
=
[
'/login'
]
// 不重定向白名单
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
end
=
Performance
.
startExecute
(
`
${
from
.
path
}
=>
${
to
.
path
}
路由耗时`
)
/// 路由性能监控
if
(
store
.
getters
.
token
)
{
if
(
to
.
path
===
'/login'
)
{
next
({
path
:
'/'
})
}
else
{
if
(
store
.
getters
.
roles
.
length
===
0
)
{
store
.
dispatch
(
'GetInfo'
).
then
(
res
=>
{
// 拉取用户信息
next
()
}).
catch
((
err
)
=>
{
store
.
dispatch
(
'FedLogOut'
).
then
(()
=>
{
Message
.
error
(
err
||
'Verification failed, please login again'
)
next
({
path
:
'/'
})
})
})
}
else
{
next
()
}
next
()
}
}
else
{
if
(
whiteList
.
indexOf
(
to
.
path
)
!==
-
1
)
{
...
...
请
注册
或
登录
后发表评论