From 9c432a24933f04cec1cbe76ee5edbd1011326a14 Mon Sep 17 00:00:00 2001 From: xiaohu <448627663@qq.com> Date: Sat, 7 Jul 2018 14:46:56 +0800 Subject: [PATCH] Close:#4 --- package.json | 2 +- src/pages/Forms/StepForm/Step1.js | 2 +- src/pages/Forms/StepForm/Step2.js | 2 +- src/pages/Forms/StepForm/Step3.js | 2 +- src/pages/Forms/StepForm/_layout.js | 6 +-- src/pages/Forms/StepForm/index.js | 59 ----------------------------- src/pages/_routes.json | 7 +++- 7 files changed, 13 insertions(+), 67 deletions(-) delete mode 100644 src/pages/Forms/StepForm/index.js diff --git a/package.json b/package.json index 723c88fb..4f4ba147 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "umi-plugin-dll": "^0.2.1", "umi-plugin-dva": "^0.7.3", "umi-plugin-routes": "0.1.4", - "umi-plugin-polyfill": "^0.1.0" + "umi-plugin-polyfill": "^0.1.0" }, "dependencies": { "@antv/data-set": "^0.8.7", diff --git a/src/pages/Forms/StepForm/Step1.js b/src/pages/Forms/StepForm/Step1.js index 01cf0df2..30cc4ce9 100644 --- a/src/pages/Forms/StepForm/Step1.js +++ b/src/pages/Forms/StepForm/Step1.js @@ -27,7 +27,7 @@ class Step1 extends React.PureComponent { type: 'form/saveStepFormData', payload: values, }); - dispatch(routerRedux.push('/form/step-form/confirm')); + dispatch(routerRedux.push('/Forms/StepForm/Step2')); } }); }; diff --git a/src/pages/Forms/StepForm/Step2.js b/src/pages/Forms/StepForm/Step2.js index 8dee364f..6cbde098 100644 --- a/src/pages/Forms/StepForm/Step2.js +++ b/src/pages/Forms/StepForm/Step2.js @@ -20,7 +20,7 @@ class Step2 extends React.PureComponent { const { form, data, dispatch, submitting } = this.props; const { getFieldDecorator, validateFields } = form; const onPrev = () => { - dispatch(routerRedux.push('/form/step-form')); + dispatch(routerRedux.push('/Forms/StepForm')); }; const onValidateForm = (e) => { e.preventDefault(); diff --git a/src/pages/Forms/StepForm/Step3.js b/src/pages/Forms/StepForm/Step3.js index 9a8d6d46..eb8afeac 100644 --- a/src/pages/Forms/StepForm/Step3.js +++ b/src/pages/Forms/StepForm/Step3.js @@ -9,7 +9,7 @@ class Step3 extends React.PureComponent { render() { const { dispatch, data } = this.props; const onFinish = () => { - dispatch(routerRedux.push('/form/step-form')); + dispatch(routerRedux.push('/Forms/StepForm')); }; const information = (
diff --git a/src/pages/Forms/StepForm/_layout.js b/src/pages/Forms/StepForm/_layout.js index 8d3bd2ce..41b931fa 100644 --- a/src/pages/Forms/StepForm/_layout.js +++ b/src/pages/Forms/StepForm/_layout.js @@ -12,11 +12,11 @@ export default class StepForm extends PureComponent { const { pathname } = location; const pathList = pathname.split('/'); switch (pathList[pathList.length - 1]) { - case 'info': + case 'Step1': return 0; - case 'confirm': + case 'Step2': return 1; - case 'result': + case 'Step3': return 2; default: return 0; diff --git a/src/pages/Forms/StepForm/index.js b/src/pages/Forms/StepForm/index.js deleted file mode 100644 index 3ab2374b..00000000 --- a/src/pages/Forms/StepForm/index.js +++ /dev/null @@ -1,59 +0,0 @@ -import React, { PureComponent, Fragment } from 'react'; -import { Route, Redirect, Switch } from 'dva/router'; -import { Card, Steps } from 'antd'; -import PageHeaderLayout from '../../../layouts/PageHeaderLayout'; -import NotFound from '../../Exception/404'; -import { getRoutes } from '../../../utils/utils'; -import styles from '../style.less'; - -const { Step } = Steps; - -export default class StepForm extends PureComponent { - getCurrentStep() { - const { location } = this.props; - const { pathname } = location; - const pathList = pathname.split('/'); - switch (pathList[pathList.length - 1]) { - case 'info': - return 0; - case 'confirm': - return 1; - case 'result': - return 2; - default: - return 0; - } - } - render() { - const { match, routerData, location } = this.props; - return ( - - - - - - - - - - {getRoutes(match.path, routerData).map(item => ( - - ))} - - - - - - - ); - } -} diff --git a/src/pages/_routes.json b/src/pages/_routes.json index 643b57de..fdc112b6 100644 --- a/src/pages/_routes.json +++ b/src/pages/_routes.json @@ -9,6 +9,11 @@ "exact": true, "redirect": "/Forms/BasicForm" }, + { + "path": "/Forms/StepForm", + "exact": true, + "redirect": "/Forms/StepForm/Step1" + }, { "path": "/List", "exact": true, @@ -34,4 +39,4 @@ "exact": true, "redirect": "/Exception/403" } -] +] \ No newline at end of file