fork from bc4552c5a8
This commit is contained in:
43
client/containers/Login/LoginWrap.js
Normal file
43
client/containers/Login/LoginWrap.js
Normal file
@@ -0,0 +1,43 @@
|
||||
import React, { PureComponent as Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Tabs } from 'antd';
|
||||
import LoginForm from './Login';
|
||||
import RegForm from './Reg';
|
||||
import './Login.scss';
|
||||
const TabPane = Tabs.TabPane;
|
||||
|
||||
@connect(state => ({
|
||||
loginWrapActiveKey: state.user.loginWrapActiveKey,
|
||||
canRegister: state.user.canRegister
|
||||
}))
|
||||
export default class LoginWrap extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
static propTypes = {
|
||||
form: PropTypes.object,
|
||||
loginWrapActiveKey: PropTypes.string,
|
||||
canRegister: PropTypes.bool
|
||||
};
|
||||
|
||||
render() {
|
||||
const { loginWrapActiveKey, canRegister } = this.props;
|
||||
{/** show only login when register is disabled */}
|
||||
return (
|
||||
<Tabs
|
||||
defaultActiveKey={loginWrapActiveKey}
|
||||
className="login-form"
|
||||
tabBarStyle={{ border: 'none' }}
|
||||
>
|
||||
<TabPane tab="登录" key="1">
|
||||
<LoginForm />
|
||||
</TabPane>
|
||||
<TabPane tab={"注册"} key="2">
|
||||
{canRegister ? <RegForm /> : <div style={{minHeight: 200}}>管理员已禁止注册,请联系管理员</div>}
|
||||
</TabPane>
|
||||
</Tabs>
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user