Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
e2aeb7c9
Commit
e2aeb7c9
authored
Jul 07, 2018
by
xiaohu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set init route
parent
7494ac09
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
1 deletion
+25
-1
config/config.js
config/config.js
+3
-0
src/models/global.js
src/models/global.js
+19
-1
src/pages/index.js
src/pages/index.js
+3
-0
No files found.
config/config.js
View file @
e2aeb7c9
...
...
@@ -93,6 +93,9 @@ export default {
},
alias
:
{
components
:
path
.
resolve
(
__dirname
,
'
../src/components/
'
),
utils
:
path
.
resolve
(
__dirname
,
'
../src/utils/
'
),
assets
:
path
.
resolve
(
__dirname
,
'
../src/assets/
'
),
common
:
path
.
resolve
(
__dirname
,
'
../src/common/
'
),
},
ignoreMomentLocale
:
true
,
theme
:
'
./src/theme.js
'
,
...
...
src/models/global.js
View file @
e2aeb7c9
import
router
from
'
umi/router
'
;
import
{
getAuthority
}
from
'
utils/authority
'
;
import
{
queryNotices
}
from
'
../services/api
'
;
export
default
{
...
...
@@ -31,6 +33,13 @@ export default {
payload
:
count
,
});
},
*
init
({
payload
},
{
put
})
{
if
(
payload
.
hasAuthority
)
{
yield
put
(
router
.
push
(
'
/User/Login
'
));
}
else
{
yield
put
(
router
.
push
(
'
/Dashboard/Analysis
'
));
}
},
},
reducers
:
{
...
...
@@ -55,12 +64,21 @@ export default {
},
subscriptions
:
{
setup
({
history
})
{
setup
({
history
,
dispatch
})
{
// Subscribe history(url) change, trigger `load` action if pathname is `/`
return
history
.
listen
(({
pathname
,
search
})
=>
{
if
(
typeof
window
.
ga
!==
'
undefined
'
)
{
window
.
ga
(
'
send
'
,
'
pageview
'
,
pathname
+
search
);
}
if
(
pathname
===
'
/
'
)
{
const
author
=
getAuthority
();
dispatch
({
type
:
'
init
'
,
payload
:
{
hasAuthority
:
author
===
'
guest
'
||
!
author
,
},
});
}
});
},
},
...
...
src/pages/index.js
0 β 100644
View file @
e2aeb7c9
import
React
from
'
react
'
;
export
default
()
=>
<
div
/>
;
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