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
5e02d635
Commit
5e02d635
authored
Dec 27, 2017
by
陈帅
Committed by
偏右
Dec 27, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix list redirect bug (#507)
parent
74b4f30f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
25 deletions
+46
-25
src/common/menu.js
src/common/menu.js
+12
-13
src/layouts/BasicLayout.js
src/layouts/BasicLayout.js
+33
-10
src/routes/List/List.js
src/routes/List/List.js
+1
-2
No files found.
src/common/menu.js
View file @
5e02d635
...
@@ -32,28 +32,27 @@ const menuData = [{
...
@@ -32,28 +32,27 @@ const menuData = [{
icon
:
'
table
'
,
icon
:
'
table
'
,
path
:
'
list
'
,
path
:
'
list
'
,
children
:
[{
children
:
[{
name
:
'
查询表格
'
,
path
:
'
table-list
'
,
},
{
name
:
'
标准列表
'
,
path
:
'
basic-list
'
,
},
{
name
:
'
卡片列表
'
,
path
:
'
card-list
'
,
},
{
name
:
'
搜索列表
'
,
name
:
'
搜索列表
'
,
icon
:
'
search
'
,
path
:
'
search
'
,
path
:
'
search
'
,
children
:
[{
children
:
[{
name
:
'
搜索列表(文章)
'
,
path
:
'
articles
'
,
},
{
name
:
'
搜索列表(项目)
'
,
name
:
'
搜索列表(项目)
'
,
path
:
'
projects
'
,
path
:
'
projects
'
,
},
{
},
{
name
:
'
搜索列表(应用)
'
,
name
:
'
搜索列表(应用)
'
,
path
:
'
applications
'
,
path
:
'
applications
'
,
},
{
name
:
'
搜索列表(文章)
'
,
path
:
'
articles
'
,
}],
}],
},
{
name
:
'
查询表格
'
,
path
:
'
table-list
'
,
},
{
name
:
'
标准列表
'
,
path
:
'
basic-list
'
,
},
{
name
:
'
卡片列表
'
,
path
:
'
card-list
'
,
}],
}],
},
{
},
{
name
:
'
详情页
'
,
name
:
'
详情页
'
,
...
...
src/layouts/BasicLayout.js
View file @
5e02d635
...
@@ -11,9 +11,29 @@ import GlobalFooter from '../components/GlobalFooter';
...
@@ -11,9 +11,29 @@ import GlobalFooter from '../components/GlobalFooter';
import
SiderMenu
from
'
../components/SiderMenu
'
;
import
SiderMenu
from
'
../components/SiderMenu
'
;
import
NotFound
from
'
../routes/Exception/404
'
;
import
NotFound
from
'
../routes/Exception/404
'
;
import
{
getRoutes
}
from
'
../utils/utils
'
;
import
{
getRoutes
}
from
'
../utils/utils
'
;
import
{
getMenuData
}
from
'
../common/menu
'
;
const
{
Content
}
=
Layout
;
/**
* 根据菜单取得重定向地址.
*/
const
redirectData
=
[];
const
getRedirect
=
(
item
)
=>
{
if
(
item
&&
item
.
children
)
{
if
(
item
.
children
[
0
]
&&
item
.
children
[
0
].
path
)
{
redirectData
.
push
({
from
:
`/
${
item
.
path
}
`
,
to
:
`/
${
item
.
children
[
0
].
path
}
`
,
});
item
.
children
.
forEach
((
children
)
=>
{
getRedirect
(
children
);
});
}
}
};
getMenuData
().
forEach
(
getRedirect
);
const
{
Content
}
=
Layout
;
const
query
=
{
const
query
=
{
'
screen-xs
'
:
{
'
screen-xs
'
:
{
maxWidth
:
575
,
maxWidth
:
575
,
...
@@ -79,17 +99,20 @@ class BasicLayout extends React.PureComponent {
...
@@ -79,17 +99,20 @@ class BasicLayout extends React.PureComponent {
<
div
style
=
{{
minHeight
:
'
calc(100vh - 260px)
'
}}
>
<
div
style
=
{{
minHeight
:
'
calc(100vh - 260px)
'
}}
>
<
Switch
>
<
Switch
>
{
{
getRoutes
(
match
.
path
,
routerData
).
map
(
item
=>
redirectData
.
map
(
item
=>
(
<
Redirect
key
=
{
item
.
from
}
exact
from
=
{
item
.
from
}
to
=
{
item
.
to
}
/
>
<
Route
key
=
{
item
.
key
}
path
=
{
item
.
path
}
component
=
{
item
.
component
}
exact
=
{
item
.
exact
}
/
>
)
)
)
}
}
{
getRoutes
(
match
.
path
,
routerData
).
map
(
item
=>
(
<
Route
key
=
{
item
.
key
}
path
=
{
item
.
path
}
component
=
{
item
.
component
}
exact
=
{
item
.
exact
}
/
>
))
}
<
Redirect
exact
from
=
"
/
"
to
=
"
/dashboard/analysis
"
/>
<
Redirect
exact
from
=
"
/
"
to
=
"
/dashboard/analysis
"
/>
<
Route
render
=
{
NotFound
}
/
>
<
Route
render
=
{
NotFound
}
/
>
<
/Switch
>
<
/Switch
>
...
...
src/routes/List/List.js
View file @
5e02d635
import
React
,
{
Component
}
from
'
react
'
;
import
React
,
{
Component
}
from
'
react
'
;
import
{
routerRedux
,
Route
,
Switch
,
Redirect
}
from
'
dva/router
'
;
import
{
routerRedux
,
Route
,
Switch
}
from
'
dva/router
'
;
import
{
connect
}
from
'
dva
'
;
import
{
connect
}
from
'
dva
'
;
import
{
Input
}
from
'
antd
'
;
import
{
Input
}
from
'
antd
'
;
import
PageHeaderLayout
from
'
../../layouts/PageHeaderLayout
'
;
import
PageHeaderLayout
from
'
../../layouts/PageHeaderLayout
'
;
...
@@ -72,7 +72,6 @@ export default class SearchList extends Component {
...
@@ -72,7 +72,6 @@ export default class SearchList extends Component {
)
)
)
)
}
}
<
Redirect
exact
from
=
{
`
${
match
.
path
}
`
}
to
=
{
`
${
match
.
path
}${
routes
[
0
]}
`
}
/
>
<
/Switch
>
<
/Switch
>
<
/PageHeaderLayout
>
<
/PageHeaderLayout
>
);
);
...
...
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