Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
ds147000
/
react-project-storage
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b95a07dd
authored
Jul 22, 2020
by
GGbong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加登录和登录后逻辑分离
1 parent
a229f795
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
src/router/router-view.js
src/router/router-view.js
View file @
b95a07d
...
...
@@ -19,7 +19,7 @@ import fullScreenRoute from './modules/fullScreenRoute'
const
getAllRouterName
=
route
=>
route
.
map
(
e
=>
e
.
url
)
/** 路由视图 */
const
RouterView
=
({
basisRoute
=
[],
serviceRoute
=
[],
userRoute
=
[],
userSatatus
,
SYSTEM_LOGIN
})
=>
{
const
RouterView
=
({
basisRoute
=
[],
serviceRoute
=
[],
userRoute
=
[],
userSatatus
,
SYSTEM_LOGIN
})
=>
{
const
[
openRoute
,
setOpenRoute
]
=
useState
([])
const
history
=
useHistory
()
...
...
@@ -30,7 +30,7 @@ const RouterView = ({basisRoute = [], serviceRoute = [], userRoute = [], userSat
const
newRoutes
=
allRoute
.
map
(
e
=>
{
const
index
=
serviceRoute
.
findIndex
(
service
=>
service
.
url
===
e
.
url
)
const
newE
=
{
...
e
}
const
newE
=
{
...
e
}
if
(
index
!==
-
1
)
newE
.
component
=
serviceRoute
[
index
].
component
...
...
@@ -72,9 +72,8 @@ const RouterView = ({basisRoute = [], serviceRoute = [], userRoute = [], userSat
history
.
replace
(
'/login'
)
},
[])
if
(
userSatatus
)
return
(
<>
{
userSatatus
?
<
Layout
>
<
Switch
>
{
basisRoute
.
map
(
e
=>
<
Route
path
=
{
e
.
url
}
exact
=
{
e
.
exact
}
component
=
{
Guards
(
e
.
component
)}
key
=
{
e
.
url
}
/>
)
}
...
...
@@ -82,13 +81,13 @@ const RouterView = ({basisRoute = [], serviceRoute = [], userRoute = [], userSat
<
Route
component
=
{
error401
}
/
>
<
/Switch
>
<
/Layout
>
:
)
else
return
(
<
Switch
>
{
fullScreenRoute
.
map
(
e
=>
<
Route
path
=
{
e
.
url
}
exact
=
{
e
.
exact
}
component
=
{
Guards
(
e
.
component
)}
key
=
{
e
.
url
}
/>
)
}
<
Route
component
=
{
error404
}
/
>
<
/Switch
>
}
<
/
>
)
}
...
...
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