Commit 189e6c5c authored by 陈帅's avatar 陈帅

Features: add buttonText on Login.Captcha

parent 11df3597
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies # dependencies
/node_modules **/node_modules
# roadhog-api-doc ignore # roadhog-api-doc ignore
/src/utils/request-temp.js /src/utils/request-temp.js
_roadhog-api-doc _roadhog-api-doc
......
...@@ -15,6 +15,10 @@ function generator({ defaultProps, defaultRules, type }) { ...@@ -15,6 +15,10 @@ function generator({ defaultProps, defaultRules, type }) {
updateActive: PropTypes.func, updateActive: PropTypes.func,
}; };
static defaultProps = {
buttonText: '获取验证码',
};
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
...@@ -55,7 +59,7 @@ function generator({ defaultProps, defaultRules, type }) { ...@@ -55,7 +59,7 @@ function generator({ defaultProps, defaultRules, type }) {
const { getFieldDecorator } = form; const { getFieldDecorator } = form;
const options = {}; const options = {};
let otherProps = {}; let otherProps = {};
const { onChange, defaultValue, rules, name, ...restProps } = this.props; const { onChange, defaultValue, buttonText, rules, name, ...restProps } = this.props;
const { count } = this.state; const { count } = this.state;
options.rules = rules || defaultRules; options.rules = rules || defaultRules;
if (onChange) { if (onChange) {
...@@ -82,7 +86,7 @@ function generator({ defaultProps, defaultRules, type }) { ...@@ -82,7 +86,7 @@ function generator({ defaultProps, defaultRules, type }) {
size="large" size="large"
onClick={this.onGetCaptcha} onClick={this.onGetCaptcha}
> >
{count ? `${count} s` : '获取验证码'} {count ? `${count} s` : buttonText}
</Button> </Button>
</Col> </Col>
</Row> </Row>
......
...@@ -19,6 +19,7 @@ export interface LoginItemProps { ...@@ -19,6 +19,7 @@ export interface LoginItemProps {
style?: React.CSSProperties; style?: React.CSSProperties;
onGetCaptcha?: () => void; onGetCaptcha?: () => void;
placeholder?: string; placeholder?: string;
buttonText?: React.ReactNode;
} }
export class LoginItem extends React.Component<LoginItemProps, any> {} export class LoginItem extends React.Component<LoginItemProps, any> {}
......
...@@ -39,6 +39,7 @@ Apart from the above properties, Login.Username also support all properties of a ...@@ -39,6 +39,7 @@ Apart from the above properties, Login.Username also support all properties of a
Property | Description | Type | Default Property | Description | Type | Default
----|------|-----|------ ----|------|-----|------
onGetCaptcha | callback on getting a new Captcha | () => void | - onGetCaptcha | callback on getting a new Captcha | () => void | -
buttonText | text on getting a new Captcha | ReactNode | -
Apart from the above properties, _Login.Captcha_ support the same properties with _Login.UserName_. Apart from the above properties, _Login.Captcha_ support the same properties with _Login.UserName_.
......
...@@ -40,6 +40,7 @@ rules | 校验规则,同 Form getFieldDecorator(id, options) 中 [option.rules ...@@ -40,6 +40,7 @@ rules | 校验规则,同 Form getFieldDecorator(id, options) 中 [option.rules
参数 | 说明 | 类型 | 默认值 参数 | 说明 | 类型 | 默认值
----|------|-----|------ ----|------|-----|------
onGetCaptcha | 点击获取校验码的回调 | () => void | - onGetCaptcha | 点击获取校验码的回调 | () => void | -
buttonText | 点击获取校验码的说明文字 | ReactNode | -
除上述属性以外,Login.Captcha 支持的属性与 Login.UserName 相同。 除上述属性以外,Login.Captcha 支持的属性与 Login.UserName 相同。
......
...@@ -221,14 +221,16 @@ export default class PageHeader extends PureComponent { ...@@ -221,14 +221,16 @@ export default class PageHeader extends PureComponent {
</div> </div>
</div> </div>
</div> </div>
{(tabList && tabList.length) ? ( {tabList && tabList.length ? (
<Tabs <Tabs
className={styles.tabs} className={styles.tabs}
{...activeKeyProps} {...activeKeyProps}
onChange={this.onChange} onChange={this.onChange}
tabBarExtraContent={tabBarExtraContent} tabBarExtraContent={tabBarExtraContent}
> >
{tabList.map(item => <TabPane tab={item.tab} key={item.key} />)} {tabList.map(item => (
<TabPane tab={item.tab} key={item.key} />
))}
</Tabs> </Tabs>
) : null} ) : null}
</div> </div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment