From 0bc43677a83a562f3a160d4ac9d55a41d45ad0f2 Mon Sep 17 00:00:00 2001 From: billfeller Date: Tue, 7 May 2019 11:53:05 +0800 Subject: [PATCH] feat: AccountSettings/base add handlerSubmit --- AccountSettings/src/components/base.tsx | 14 ++++++++++++-- AccountSettings/src/locales/en-US.ts | 1 + AccountSettings/src/locales/zh-CN.ts | 1 + AccountSettings/src/locales/zh-TW.ts | 1 + 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/AccountSettings/src/components/base.tsx b/AccountSettings/src/components/base.tsx index da90984a..deb72ce4 100644 --- a/AccountSettings/src/components/base.tsx +++ b/AccountSettings/src/components/base.tsx @@ -1,6 +1,6 @@ import React, { Component, Fragment } from 'react'; import { formatMessage, FormattedMessage } from 'umi-plugin-react/locale'; -import { Form, Input, Upload, Select, Button } from 'antd'; +import { Form, Input, Upload, Select, Button, message } from 'antd'; import { FormComponentProps } from 'antd/lib/form'; import { connect } from 'dva'; import styles from './BaseView.less'; @@ -102,6 +102,16 @@ class BaseView extends Component { this.view = ref; }; + handlerSubmit = (event: Event) => { + event.preventDefault(); + const { form } = this.props; + form.validateFields((err, values) => { + if (!err) { + message.success(formatMessage({ id: 'BLOCK_NAME.basic.updatesucc' })); + } + }); + }; + render() { const { form: { getFieldDecorator }, @@ -193,7 +203,7 @@ class BaseView extends Component { ], })()} - diff --git a/AccountSettings/src/locales/en-US.ts b/AccountSettings/src/locales/en-US.ts index aab0f68d..e939ca47 100644 --- a/AccountSettings/src/locales/en-US.ts +++ b/AccountSettings/src/locales/en-US.ts @@ -21,6 +21,7 @@ export default { 'BLOCK_NAME.basic.phone': 'Phone Number', 'BLOCK_NAME.basic.phone-message': 'Please input your phone!', 'BLOCK_NAME.basic.update': 'Update Information', + 'BLOCK_NAME.basic.updatesucc': 'Update basic information successfully', 'BLOCK_NAME.security.strong': 'Strong', 'BLOCK_NAME.security.medium': 'Medium', 'BLOCK_NAME.security.weak': 'Weak', diff --git a/AccountSettings/src/locales/zh-CN.ts b/AccountSettings/src/locales/zh-CN.ts index 29c5674b..cc6d7666 100644 --- a/AccountSettings/src/locales/zh-CN.ts +++ b/AccountSettings/src/locales/zh-CN.ts @@ -21,6 +21,7 @@ export default { 'BLOCK_NAME.basic.phone': '联系电话', 'BLOCK_NAME.basic.phone-message': '请输入您的联系电话!', 'BLOCK_NAME.basic.update': '更新基本信息', + 'BLOCK_NAME.basic.updatesucc': '更新基本信息成功', 'BLOCK_NAME.security.strong': '强', 'BLOCK_NAME.security.medium': '中', 'BLOCK_NAME.security.weak': '弱', diff --git a/AccountSettings/src/locales/zh-TW.ts b/AccountSettings/src/locales/zh-TW.ts index a65cf7e9..d466c24a 100644 --- a/AccountSettings/src/locales/zh-TW.ts +++ b/AccountSettings/src/locales/zh-TW.ts @@ -21,6 +21,7 @@ export default { 'BLOCK_NAME.basic.phone': '聯系電話', 'BLOCK_NAME.basic.phone-message': '請輸入您的聯系電話!', 'BLOCK_NAME.basic.update': '更新基本信息', + 'BLOCK_NAME.basic.updatesucc': '更新基本信息成功', 'BLOCK_NAME.security.strong': '強', 'BLOCK_NAME.security.medium': '中', 'BLOCK_NAME.security.weak': '弱', -- GitLab