Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
binhai-company
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
binhai-jiaoguan
binhai-company
Commits
7ef22274
Commit
7ef22274
authored
Nov 22, 2023
by
mzx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
路由跳转拦截
parent
3bc36e51
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
5 deletions
+27
-5
permission.js
src/permission.js
+15
-5
index.vue
src/views/informationReport/basicInformation/index.vue
+12
-0
No files found.
src/permission.js
View file @
7ef22274
...
...
@@ -24,11 +24,21 @@ router.beforeEach((to, from, next) => {
// 判断当前用户是否已拉取完user_info信息
store
.
dispatch
(
'GetInfo'
).
then
(()
=>
{
isRelogin
.
show
=
false
store
.
dispatch
(
'GenerateRoutes'
).
then
(
accessRoutes
=>
{
// 根据roles权限生成可访问的路由表
router
.
addRoutes
(
accessRoutes
)
// 动态添加可访问路由表
next
({
...
to
,
replace
:
true
})
// hack方法 确保addRoutes已完成
})
// console.log('------', store.state.user.user.enterpriseId)
// 当公司id为null时跳至企业基本信息页面 否则跳首页
if
(
store
.
state
.
user
.
user
.
enterpriseId
===
null
)
{
store
.
dispatch
(
'GenerateRoutes'
).
then
(
accessRoutes
=>
{
// 根据roles权限生成可访问的路由表
router
.
addRoutes
(
accessRoutes
)
// 动态添加可访问路由表
next
(
'/informationReport/basicInformation/index'
)
})
}
else
{
store
.
dispatch
(
'GenerateRoutes'
).
then
(
accessRoutes
=>
{
// 根据roles权限生成可访问的路由表
router
.
addRoutes
(
accessRoutes
)
// 动态添加可访问路由表
next
({
...
to
,
replace
:
true
})
// hack方法 确保addRoutes已完成
})
}
}).
catch
(
err
=>
{
store
.
dispatch
(
'LogOut'
).
then
(()
=>
{
Message
.
error
(
err
)
...
...
src/views/informationReport/basicInformation/index.vue
View file @
7ef22274
...
...
@@ -272,6 +272,18 @@ import { getCompany, saveCompany } from '@/api/informationReport'
export
default
{
name
:
'Index'
,
dicts
:
[
'bhxq_business_type'
,
'bhxq_enterprise_transport_type'
,
'bhxq_enterprise_register_status'
,
'bhxq_area_scope'
,
'bhxq_enterprise_trade_status'
],
beforeRouteLeave
(
to
,
from
,
next
)
{
// 在这里进行路由跳转控制 当公司id为空时 完善公司信息后才能跳转到其他页面
if
(
this
.
$store
.
state
.
user
.
user
.
enterpriseId
===
null
)
{
if
(
this
.
$message
.
error
(
'请完善企业基本信息'
))
{
// next()
}
else
{
next
(
false
)
}
}
else
{
next
()
}
},
data
()
{
return
{
companyId
:
this
.
$store
.
state
.
user
.
user
.
enterpriseId
,
// 公司id
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment