Просмотр исходного кода

fix user account in register-result (#695)

* fix user account in register-result

* fix up

* fix account name undefined

* location field state
elevensky 8 лет назад
Родитель
Сommit
8924f3c3a8
2 измененных файлов с 9 добавлено и 5 удалено
  1. 7 1
      src/routes/User/Register.js
  2. 2 4
      src/routes/User/RegisterResult.js

+ 7 - 1
src/routes/User/Register.js

@@ -35,8 +35,14 @@ export default class Register extends Component {
   };
   };
 
 
   componentWillReceiveProps(nextProps) {
   componentWillReceiveProps(nextProps) {
+    const account = this.props.form.getFieldValue('mail');
     if (nextProps.register.status === 'ok') {
     if (nextProps.register.status === 'ok') {
-      this.props.dispatch(routerRedux.push('/user/register-result'));
+      this.props.dispatch(routerRedux.push({
+        pathname: '/user/register-result',
+        state: {
+          account,
+        },
+      }));
     }
     }
   }
   }
 
 

+ 2 - 4
src/routes/User/RegisterResult.js

@@ -4,8 +4,6 @@ import { Link } from 'dva/router';
 import Result from '../../components/Result';
 import Result from '../../components/Result';
 import styles from './RegisterResult.less';
 import styles from './RegisterResult.less';
 
 
-const title = <div className={styles.title}>你的账户:AntDesign@example.com 注册成功</div>;
-
 const actions = (
 const actions = (
   <div className={styles.actions}>
   <div className={styles.actions}>
     <a href=""><Button size="large" type="primary">查看邮箱</Button></a>
     <a href=""><Button size="large" type="primary">查看邮箱</Button></a>
@@ -13,11 +11,11 @@ const actions = (
   </div>
   </div>
 );
 );
 
 
-export default () => (
+export default ({ location }) => (
   <Result
   <Result
     className={styles.registerResult}
     className={styles.registerResult}
     type="success"
     type="success"
-    title={title}
+    title={<div className={styles.title}>你的账户:{location.state && location.state.account} 注册成功</div>}
     description="激活邮件已发送到你的邮箱中,邮件有效期为24小时。请及时登录邮箱,点击邮件中的链接激活帐户。"
     description="激活邮件已发送到你的邮箱中,邮件有效期为24小时。请及时登录邮箱,点击邮件中的链接激活帐户。"
     actions={actions}
     actions={actions}
     style={{ marginTop: 56 }}
     style={{ marginTop: 56 }}