Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 5fc3a0bf
authored
Nov 02, 2020
by
xinlaa
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
企业微信设置判断
1 parent
054fd5cf
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletions
linkwe-ui/src/permission.js
linkwe-ui/src/permission.js
View file @
5fc3a0b
...
@@ -7,7 +7,7 @@ import { getToken } from '@/utils/auth'
...
@@ -7,7 +7,7 @@ import { getToken } from '@/utils/auth'
// NProgress.configure({ showSpinner: false })
// NProgress.configure({ showSpinner: false })
const
whiteList
=
[
'/login'
,
'/auth-redirect'
,
'/bind'
,
'/register'
]
const
whiteList
=
[
'/login'
,
'/auth-redirect'
,
'/bind'
,
'/register'
,
'/test'
]
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
// NProgress.start()
// NProgress.start()
...
@@ -27,7 +27,24 @@ router.beforeEach((to, from, next) => {
...
@@ -27,7 +27,24 @@ router.beforeEach((to, from, next) => {
// store.dispatch('permission/generateRoutes', { roles }).then(accessRoutes => {
// store.dispatch('permission/generateRoutes', { roles }).then(accessRoutes => {
// 根据roles权限生成可访问的路由表
// 根据roles权限生成可访问的路由表
router
.
addRoutes
(
accessRoutes
)
// 动态添加可访问路由表
router
.
addRoutes
(
accessRoutes
)
// 动态添加可访问路由表
// 判断是否有设置企业微信id
if
(
res
.
user
&&
res
.
user
.
validCropId
)
{
// 设置了企业微信,正常跳转
next
({
...
to
,
replace
:
true
})
// hack方法 确保addRoutes已完成
next
({
...
to
,
replace
:
true
})
// hack方法 确保addRoutes已完成
}
else
{
// 没有设置企业微信的
let
isEnterpriseWechat
=
accessRoutes
.
findIndex
(
element
=>
{
element
.
path
===
'/_enterpriseWechat'
});
// 若有设置企业微信的页面权限,默认跳转到设置企业微信页面
if
(
isEnterpriseWechat
>
-
1
)
{
next
({
path
:
'/enterpriseWechat'
,
replace
:
true
})
}
else
{
// 没有权限的给予提示,并退回登录页面
Message
.
error
(
'没有设置企业微信的权限,请联系系统管理员'
)
next
({
path
:
'/login'
,
replace
:
true
})
}
}
})
})
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment