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
5ef482ed
Commit
5ef482ed
authored
Jul 07, 2018
by
xiaohu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.add step-form layout
2.add routes redirect
parent
2378eb05
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
83 additions
and
18 deletions
+83
-18
config/config.js
config/config.js
+4
-0
src/common/menu.js
src/common/menu.js
+23
-6
src/models/form.js
src/models/form.js
+1
-1
src/pages/Forms/StepForm/Step1.js
src/pages/Forms/StepForm/Step1.js
+1
-1
src/pages/Forms/StepForm/Step2.js
src/pages/Forms/StepForm/Step2.js
+1
-1
src/pages/Forms/StepForm/Step3.js
src/pages/Forms/StepForm/Step3.js
+1
-1
src/pages/Forms/StepForm/_layout.js
src/pages/Forms/StepForm/_layout.js
+10
-8
src/pages/_routes.json
src/pages/_routes.json
+42
-0
No files found.
config/config.js
View file @
5ef482ed
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
// https://umijs.org/config/
// https://umijs.org/config/
const
path
=
require
(
'
path
'
);
const
path
=
require
(
'
path
'
);
const
pageRoutes
=
require
(
'
../src/pages/_routes
'
);
export
default
{
export
default
{
// add for transfer to umi
// add for transfer to umi
...
@@ -13,6 +14,9 @@ export default {
...
@@ -13,6 +14,9 @@ export default {
'
umi-plugin-routes
'
,
'
umi-plugin-routes
'
,
{
{
exclude
:
[
/
\.
test
\.
js/
],
exclude
:
[
/
\.
test
\.
js/
],
update
(
routes
)
{
return
[...
pageRoutes
,
...
routes
];
},
},
},
],
],
],
],
...
...
src/common/menu.js
View file @
5ef482ed
...
@@ -194,6 +194,7 @@
...
@@ -194,6 +194,7 @@
import
{
isUrl
}
from
'
../utils/utils
'
;
import
{
isUrl
}
from
'
../utils/utils
'
;
// TODO: authority
const
menuData
=
[
const
menuData
=
[
{
{
name
:
'
dashboard
'
,
name
:
'
dashboard
'
,
...
@@ -211,6 +212,7 @@ const menuData = [
...
@@ -211,6 +212,7 @@ const menuData = [
{
{
name
:
'
工作台
'
,
name
:
'
工作台
'
,
path
:
'
Workplace
'
,
path
:
'
Workplace
'
,
// hideInBreadcrumb: true,
// hideInMenu: true,
// hideInMenu: true,
},
},
],
],
...
@@ -226,11 +228,11 @@ const menuData = [
...
@@ -226,11 +228,11 @@ const menuData = [
},
},
{
{
name
:
'
分步表单
'
,
name
:
'
分步表单
'
,
path
:
'
StepForm
/Step1
'
,
path
:
'
StepForm
'
,
},
},
{
{
name
:
'
高级表单
'
,
name
:
'
高级表单
'
,
authority
:
'
admin
'
,
//
authority: 'admin',
path
:
'
AdvancedForm
'
,
path
:
'
AdvancedForm
'
,
},
},
],
],
...
@@ -246,7 +248,7 @@ const menuData = [
...
@@ -246,7 +248,7 @@ const menuData = [
},
},
{
{
name
:
'
标准列表
'
,
name
:
'
标准列表
'
,
path
:
'
B
asicList
'
,
path
:
'
b
asicList
'
,
},
},
{
{
name
:
'
卡片列表
'
,
name
:
'
卡片列表
'
,
...
@@ -279,11 +281,11 @@ const menuData = [
...
@@ -279,11 +281,11 @@ const menuData = [
children
:
[
children
:
[
{
{
name
:
'
基础详情页
'
,
name
:
'
基础详情页
'
,
path
:
'
Basic
Profile
'
,
path
:
'
Basic
'
,
},
},
{
{
name
:
'
高级详情页
'
,
name
:
'
高级详情页
'
,
path
:
'
Advanced
Profile
'
,
path
:
'
Advanced
'
,
authority
:
'
admin
'
,
authority
:
'
admin
'
,
},
},
],
],
...
@@ -299,7 +301,7 @@ const menuData = [
...
@@ -299,7 +301,7 @@ const menuData = [
},
},
{
{
name
:
'
失败
'
,
name
:
'
失败
'
,
path
:
'
Error
'
,
path
:
'
Fail
'
,
},
},
],
],
},
},
...
@@ -347,6 +349,21 @@ const menuData = [
...
@@ -347,6 +349,21 @@ const menuData = [
},
},
],
],
},
},
{
name
:
'
个人页
'
,
icon
:
'
user
'
,
path
:
'
Account
'
,
children
:
[
{
name
:
'
个人中心
'
,
path
:
'
Center
'
,
},
{
name
:
'
个人设置
'
,
path
:
'
Settings
'
,
},
],
},
];
];
function
formatter
(
data
,
parentPath
=
'
/
'
,
parentAuthority
)
{
function
formatter
(
data
,
parentPath
=
'
/
'
,
parentAuthority
)
{
...
...
src/models/form.js
View file @
5ef482ed
...
@@ -25,7 +25,7 @@ export default {
...
@@ -25,7 +25,7 @@ export default {
type
:
'
saveStepFormData
'
,
type
:
'
saveStepFormData
'
,
payload
,
payload
,
});
});
yield
put
(
routerRedux
.
push
(
'
/
form/step-form/result
'
));
yield
put
(
routerRedux
.
push
(
'
/
Forms/StepForm/Step3
'
));
},
},
*
submitAdvancedForm
({
payload
},
{
call
})
{
*
submitAdvancedForm
({
payload
},
{
call
})
{
yield
call
(
fakeSubmitForm
,
payload
);
yield
call
(
fakeSubmitForm
,
payload
);
...
...
src/pages/Forms/StepForm/Step1.js
View file @
5ef482ed
...
@@ -27,7 +27,7 @@ class Step1 extends React.PureComponent {
...
@@ -27,7 +27,7 @@ class Step1 extends React.PureComponent {
type
:
'
form/saveStepFormData
'
,
type
:
'
form/saveStepFormData
'
,
payload
:
values
,
payload
:
values
,
});
});
dispatch
(
routerRedux
.
push
(
'
/
form/step-form/confirm
'
));
dispatch
(
routerRedux
.
push
(
'
/
Forms/StepForm/Step2
'
));
}
}
});
});
};
};
...
...
src/pages/Forms/StepForm/Step2.js
View file @
5ef482ed
...
@@ -20,7 +20,7 @@ class Step2 extends React.PureComponent {
...
@@ -20,7 +20,7 @@ class Step2 extends React.PureComponent {
const
{
form
,
data
,
dispatch
,
submitting
}
=
this
.
props
;
const
{
form
,
data
,
dispatch
,
submitting
}
=
this
.
props
;
const
{
getFieldDecorator
,
validateFields
}
=
form
;
const
{
getFieldDecorator
,
validateFields
}
=
form
;
const
onPrev
=
()
=>
{
const
onPrev
=
()
=>
{
dispatch
(
routerRedux
.
push
(
'
/
form/step-f
orm
'
));
dispatch
(
routerRedux
.
push
(
'
/
Forms/StepF
orm
'
));
};
};
const
onValidateForm
=
e
=>
{
const
onValidateForm
=
e
=>
{
e
.
preventDefault
();
e
.
preventDefault
();
...
...
src/pages/Forms/StepForm/Step3.js
View file @
5ef482ed
...
@@ -9,7 +9,7 @@ class Step3 extends React.PureComponent {
...
@@ -9,7 +9,7 @@ class Step3 extends React.PureComponent {
render
()
{
render
()
{
const
{
dispatch
,
data
}
=
this
.
props
;
const
{
dispatch
,
data
}
=
this
.
props
;
const
onFinish
=
()
=>
{
const
onFinish
=
()
=>
{
dispatch
(
routerRedux
.
push
(
'
/
form/step-f
orm
'
));
dispatch
(
routerRedux
.
push
(
'
/
Forms/StepF
orm
'
));
};
};
const
information
=
(
const
information
=
(
<
div
className
=
{
styles
.
information
}
>
<
div
className
=
{
styles
.
information
}
>
...
...
src/pages/Forms/StepForm/
index
.js
→
src/pages/Forms/StepForm/
_layout
.js
View file @
5ef482ed
import
React
,
{
PureComponent
,
Fragment
}
from
'
react
'
;
import
React
,
{
PureComponent
,
Fragment
}
from
'
react
'
;
import
{
Route
,
Redirect
,
Switch
}
from
'
dva/router
'
;
import
{
Card
,
Steps
}
from
'
antd
'
;
import
{
Card
,
Steps
}
from
'
antd
'
;
import
PageHeaderLayout
from
'
../../../layouts/PageHeaderLayout
'
;
import
PageHeaderLayout
from
'
../../../layouts/PageHeaderLayout
'
;
import
{
getRoutes
}
from
'
../../../utils/utils
'
;
import
styles
from
'
../style.less
'
;
import
styles
from
'
../style.less
'
;
// import { Route, Redirect, Switch } from 'dva/router';
// import { getRoutes } from '../../../utils/utils';
const
{
Step
}
=
Steps
;
const
{
Step
}
=
Steps
;
export
default
class
StepForm
extends
PureComponent
{
export
default
class
StepForm
extends
PureComponent
{
...
@@ -13,11 +14,11 @@ export default class StepForm extends PureComponent {
...
@@ -13,11 +14,11 @@ export default class StepForm extends PureComponent {
const
{
pathname
}
=
location
;
const
{
pathname
}
=
location
;
const
pathList
=
pathname
.
split
(
'
/
'
);
const
pathList
=
pathname
.
split
(
'
/
'
);
switch
(
pathList
[
pathList
.
length
-
1
])
{
switch
(
pathList
[
pathList
.
length
-
1
])
{
case
'
info
'
:
case
'
Step1
'
:
return
0
;
return
0
;
case
'
confirm
'
:
case
'
Step2
'
:
return
1
;
return
1
;
case
'
result
'
:
case
'
Step3
'
:
return
2
;
return
2
;
default
:
default
:
return
0
;
return
0
;
...
@@ -25,7 +26,7 @@ export default class StepForm extends PureComponent {
...
@@ -25,7 +26,7 @@ export default class StepForm extends PureComponent {
}
}
render
()
{
render
()
{
const
{
match
,
routerData
,
locatio
n
}
=
this
.
props
;
const
{
location
,
childre
n
}
=
this
.
props
;
return
(
return
(
<
PageHeaderLayout
<
PageHeaderLayout
title
=
"
分步表单
"
title
=
"
分步表单
"
...
@@ -39,7 +40,8 @@ export default class StepForm extends PureComponent {
...
@@ -39,7 +40,8 @@ export default class StepForm extends PureComponent {
<
Step
title
=
"
确认转账信息
"
/>
<
Step
title
=
"
确认转账信息
"
/>
<
Step
title
=
"
完成
"
/>
<
Step
title
=
"
完成
"
/>
<
/Steps
>
<
/Steps
>
<
Switch
>
{
children
}
{
/* <Switch>
{getRoutes(match.path, routerData).map(item => (
{getRoutes(match.path, routerData).map(item => (
<Route
<Route
key={item.key}
key={item.key}
...
@@ -50,7 +52,7 @@ export default class StepForm extends PureComponent {
...
@@ -50,7 +52,7 @@ export default class StepForm extends PureComponent {
))}
))}
<Redirect exact from="/form/step-form" to="/form/step-form/info" />
<Redirect exact from="/form/step-form" to="/form/step-form/info" />
<Redirect to="/exception/404" />
<Redirect to="/exception/404" />
<
/Switch
>
</Switch>
*/
}
<
/Fragment
>
<
/Fragment
>
<
/Card
>
<
/Card
>
<
/PageHeaderLayout
>
<
/PageHeaderLayout
>
...
...
src/pages/_routes.json
0 → 100644
View file @
5ef482ed
[
{
"path"
:
"/Dashboard"
,
"exact"
:
true
,
"redirect"
:
"/Dashboard/Analysis"
},
{
"path"
:
"/Forms"
,
"exact"
:
true
,
"redirect"
:
"/Forms/BasicForm"
},
{
"path"
:
"/Forms/StepForm"
,
"exact"
:
true
,
"redirect"
:
"/Forms/StepForm/Step1"
},
{
"path"
:
"/List"
,
"exact"
:
true
,
"redirect"
:
"/List/TableList"
},
{
"path"
:
"/List/Search"
,
"exact"
:
true
,
"redirect"
:
"/List/Search/Articles"
},
{
"path"
:
"/Profile"
,
"exact"
:
true
,
"redirect"
:
"/Profile/BasicProfile"
},
{
"path"
:
"/Result"
,
"exact"
:
true
,
"redirect"
:
"/Result/Success"
},
{
"path"
:
"/Exception"
,
"exact"
:
true
,
"redirect"
:
"/Exception/403"
}
]
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