mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-21 05:19:42 +08:00
fix: 删除login组件小写的文件
This commit is contained in:
parent
58d9673114
commit
0735db2846
@ -1,40 +0,0 @@
|
||||
import './Login.scss'
|
||||
import React, { 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';
|
||||
const TabPane = Tabs.TabPane;
|
||||
|
||||
|
||||
class LoginWrap extends Component {
|
||||
constructor(props){
|
||||
super(props);
|
||||
}
|
||||
|
||||
static propTypes = {
|
||||
form: PropTypes.object,
|
||||
loginWrapActiveKey:PropTypes.string
|
||||
}
|
||||
|
||||
render() {
|
||||
const { loginWrapActiveKey } = this.props;
|
||||
return (
|
||||
<Tabs defaultActiveKey={loginWrapActiveKey} className="login-form">
|
||||
<TabPane tab="登录" key="1">
|
||||
<LoginForm/>
|
||||
</TabPane>
|
||||
<TabPane tab="注册" key="2">
|
||||
<RegForm/>
|
||||
</TabPane>
|
||||
</Tabs>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default connect(
|
||||
state =>({
|
||||
loginWrapActiveKey: state.login.loginWrapActiveKey
|
||||
})
|
||||
)(LoginWrap)
|
@ -1,73 +0,0 @@
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import { Form, Button, Input, Icon, Checkbox } from 'antd';
|
||||
import { loginActions } from '../../actions/login';
|
||||
const FormItem = Form.Item;
|
||||
@connect(
|
||||
state => {
|
||||
return {
|
||||
loginData: state.login
|
||||
}
|
||||
},
|
||||
{
|
||||
loginActions
|
||||
}
|
||||
)
|
||||
|
||||
class Login extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
}
|
||||
|
||||
static propTypes = {
|
||||
form: PropTypes.object,
|
||||
loginActions: PropTypes.func
|
||||
}
|
||||
|
||||
handleSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
const form = this.props.form;
|
||||
form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
this.props.loginActions(values);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const { getFieldDecorator } = this.props.form;
|
||||
const that = this;
|
||||
return (
|
||||
<Form onSubmit={this.handleSubmit}>
|
||||
|
||||
{/* 用户名 (Email) */}
|
||||
<FormItem>
|
||||
{getFieldDecorator('email', {
|
||||
rules: [{ required: true, message: '请输入email!' }]
|
||||
})(
|
||||
<Input prefix={<Icon type="user" style={{ fontSize: 13 }} />} placeholder="Email" />
|
||||
)}
|
||||
</FormItem>
|
||||
|
||||
{/* 密码 */}
|
||||
<FormItem>
|
||||
{getFieldDecorator('password', {
|
||||
rules: [{ required: true, message: '请输入密码!' }]
|
||||
})(
|
||||
<Input prefix={<Icon type="lock" style={{ fontSize: 13 }} />} type="password" placeholder="Password" />
|
||||
)}
|
||||
</FormItem>
|
||||
|
||||
|
||||
{/* 登录按钮 */}
|
||||
<FormItem>
|
||||
<Button type="primary" htmlType="submit" className="login-form-button">登录</Button>
|
||||
</FormItem>
|
||||
|
||||
</Form>
|
||||
)
|
||||
}
|
||||
}
|
||||
const LoginForm = Form.create()(Login);
|
||||
export default LoginForm;
|
@ -1,4 +0,0 @@
|
||||
@import '../../styles/common.scss';
|
||||
|
||||
/* .login-main.css */
|
||||
|
@ -1,124 +0,0 @@
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import { Form, Button, Input, Icon } from 'antd';
|
||||
import { regActions } from '../../actions/login';
|
||||
|
||||
const FormItem = Form.Item;
|
||||
@connect(
|
||||
state => {
|
||||
return {
|
||||
loginData: state.login
|
||||
}
|
||||
},
|
||||
{
|
||||
regActions
|
||||
}
|
||||
)
|
||||
|
||||
class Reg extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
confirmDirty: false
|
||||
}
|
||||
}
|
||||
|
||||
static propTypes = {
|
||||
form: PropTypes.object,
|
||||
regActions: PropTypes.func
|
||||
}
|
||||
|
||||
handleSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
const form = this.props.form;
|
||||
form.validateFieldsAndScroll((err, values) => {
|
||||
if (!err) {
|
||||
this.props.regActions(values);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
handleConfirmBlur = (e) => {
|
||||
const value = e.target.value;
|
||||
this.setState({ confirmDirty: this.state.confirmDirty || !!value });
|
||||
}
|
||||
|
||||
checkPassword = (rule, value, callback) => {
|
||||
const form = this.props.form;
|
||||
if (value && value !== form.getFieldValue('password')) {
|
||||
callback('Two passwords that you enter is inconsistent!');
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
checkConfirm = (rule, value, callback) => {
|
||||
const form = this.props.form;
|
||||
if (value && this.state.confirmDirty) {
|
||||
form.validateFields(['confirm'], { force: true });
|
||||
}
|
||||
callback();
|
||||
}
|
||||
|
||||
render() {
|
||||
const { getFieldDecorator } = this.props.form;
|
||||
return (
|
||||
<Form onSubmit={this.handleSubmit}>
|
||||
|
||||
{/* 用户名 */}
|
||||
<FormItem>
|
||||
{getFieldDecorator('userName', {
|
||||
rules: [{ required: true, message: '请输入用户名!' }]
|
||||
})(
|
||||
<Input prefix={<Icon type="user" style={{ fontSize: 13 }} />} placeholder="Username" />
|
||||
)}
|
||||
</FormItem>
|
||||
|
||||
{/* Emaiil */}
|
||||
<FormItem>
|
||||
{getFieldDecorator('email', {
|
||||
rules: [{ required: true, message: '请输入email!' }]
|
||||
})(
|
||||
<Input prefix={<Icon type="user" style={{ fontSize: 13 }} />} placeholder="Email" />
|
||||
)}
|
||||
</FormItem>
|
||||
|
||||
{/* 密码 */}
|
||||
<FormItem>
|
||||
{getFieldDecorator('password', {
|
||||
rules: [{
|
||||
required: true,
|
||||
message: '请输入密码!'
|
||||
}, {
|
||||
validator: this.checkConfirm
|
||||
}]
|
||||
})(
|
||||
<Input prefix={<Icon type="lock" style={{ fontSize: 13 }} />} type="password" placeholder="Password" />
|
||||
)}
|
||||
</FormItem>
|
||||
|
||||
{/* 密码二次确认 */}
|
||||
<FormItem>
|
||||
{getFieldDecorator('confirm', {
|
||||
rules: [{
|
||||
required: true,
|
||||
message: '请再次输入密码密码!'
|
||||
}, {
|
||||
validator: this.checkPassword
|
||||
}]
|
||||
})(
|
||||
<Input prefix={<Icon type="lock" style={{ fontSize: 13 }} />} type="password" placeholder="Confirm Password" />
|
||||
)}
|
||||
</FormItem>
|
||||
|
||||
{/* 注册按钮 */}
|
||||
<FormItem>
|
||||
<Button type="primary" htmlType="submit" className="login-form-button">注册</Button>
|
||||
</FormItem>
|
||||
</Form>
|
||||
)
|
||||
}
|
||||
}
|
||||
const RegForm = Form.create()(Reg);
|
||||
export default RegForm;
|
@ -1,40 +0,0 @@
|
||||
import './Login.scss'
|
||||
import React, { 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';
|
||||
const TabPane = Tabs.TabPane;
|
||||
|
||||
|
||||
class LoginWrap extends Component {
|
||||
constructor(props){
|
||||
super(props);
|
||||
}
|
||||
|
||||
static propTypes = {
|
||||
form: PropTypes.object,
|
||||
loginWrapActiveKey:PropTypes.string
|
||||
}
|
||||
|
||||
render() {
|
||||
const { loginWrapActiveKey } = this.props;
|
||||
return (
|
||||
<Tabs defaultActiveKey={loginWrapActiveKey} className="login-form">
|
||||
<TabPane tab="登录" key="1">
|
||||
<LoginForm/>
|
||||
</TabPane>
|
||||
<TabPane tab="注册" key="2">
|
||||
<RegForm/>
|
||||
</TabPane>
|
||||
</Tabs>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default connect(
|
||||
state =>({
|
||||
loginWrapActiveKey: state.login.loginWrapActiveKey
|
||||
})
|
||||
)(LoginWrap)
|
@ -1,73 +0,0 @@
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import { Form, Button, Input, Icon, Checkbox } from 'antd';
|
||||
import { loginActions } from '../../actions/login';
|
||||
const FormItem = Form.Item;
|
||||
@connect(
|
||||
state => {
|
||||
return {
|
||||
loginData: state.login
|
||||
}
|
||||
},
|
||||
{
|
||||
loginActions
|
||||
}
|
||||
)
|
||||
|
||||
class Login extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
}
|
||||
|
||||
static propTypes = {
|
||||
form: PropTypes.object,
|
||||
loginActions: PropTypes.func
|
||||
}
|
||||
|
||||
handleSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
const form = this.props.form;
|
||||
form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
this.props.loginActions(values);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const { getFieldDecorator } = this.props.form;
|
||||
const that = this;
|
||||
return (
|
||||
<Form onSubmit={this.handleSubmit}>
|
||||
|
||||
{/* 用户名 (Email) */}
|
||||
<FormItem>
|
||||
{getFieldDecorator('email', {
|
||||
rules: [{ required: true, message: '请输入email!' }]
|
||||
})(
|
||||
<Input prefix={<Icon type="user" style={{ fontSize: 13 }} />} placeholder="Email" />
|
||||
)}
|
||||
</FormItem>
|
||||
|
||||
{/* 密码 */}
|
||||
<FormItem>
|
||||
{getFieldDecorator('password', {
|
||||
rules: [{ required: true, message: '请输入密码!' }]
|
||||
})(
|
||||
<Input prefix={<Icon type="lock" style={{ fontSize: 13 }} />} type="password" placeholder="Password" />
|
||||
)}
|
||||
</FormItem>
|
||||
|
||||
|
||||
{/* 登录按钮 */}
|
||||
<FormItem>
|
||||
<Button type="primary" htmlType="submit" className="login-form-button">登录</Button>
|
||||
</FormItem>
|
||||
|
||||
</Form>
|
||||
)
|
||||
}
|
||||
}
|
||||
const LoginForm = Form.create()(Login);
|
||||
export default LoginForm;
|
@ -1,4 +0,0 @@
|
||||
@import '../../styles/common.scss';
|
||||
|
||||
/* .login-main.css */
|
||||
|
@ -1,124 +0,0 @@
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import { Form, Button, Input, Icon } from 'antd';
|
||||
import { regActions } from '../../actions/login';
|
||||
|
||||
const FormItem = Form.Item;
|
||||
@connect(
|
||||
state => {
|
||||
return {
|
||||
loginData: state.login
|
||||
}
|
||||
},
|
||||
{
|
||||
regActions
|
||||
}
|
||||
)
|
||||
|
||||
class Reg extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
confirmDirty: false
|
||||
}
|
||||
}
|
||||
|
||||
static propTypes = {
|
||||
form: PropTypes.object,
|
||||
regActions: PropTypes.func
|
||||
}
|
||||
|
||||
handleSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
const form = this.props.form;
|
||||
form.validateFieldsAndScroll((err, values) => {
|
||||
if (!err) {
|
||||
this.props.regActions(values);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
handleConfirmBlur = (e) => {
|
||||
const value = e.target.value;
|
||||
this.setState({ confirmDirty: this.state.confirmDirty || !!value });
|
||||
}
|
||||
|
||||
checkPassword = (rule, value, callback) => {
|
||||
const form = this.props.form;
|
||||
if (value && value !== form.getFieldValue('password')) {
|
||||
callback('Two passwords that you enter is inconsistent!');
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
checkConfirm = (rule, value, callback) => {
|
||||
const form = this.props.form;
|
||||
if (value && this.state.confirmDirty) {
|
||||
form.validateFields(['confirm'], { force: true });
|
||||
}
|
||||
callback();
|
||||
}
|
||||
|
||||
render() {
|
||||
const { getFieldDecorator } = this.props.form;
|
||||
return (
|
||||
<Form onSubmit={this.handleSubmit}>
|
||||
|
||||
{/* 用户名 */}
|
||||
<FormItem>
|
||||
{getFieldDecorator('userName', {
|
||||
rules: [{ required: true, message: '请输入用户名!' }]
|
||||
})(
|
||||
<Input prefix={<Icon type="user" style={{ fontSize: 13 }} />} placeholder="Username" />
|
||||
)}
|
||||
</FormItem>
|
||||
|
||||
{/* Emaiil */}
|
||||
<FormItem>
|
||||
{getFieldDecorator('email', {
|
||||
rules: [{ required: true, message: '请输入email!' }]
|
||||
})(
|
||||
<Input prefix={<Icon type="user" style={{ fontSize: 13 }} />} placeholder="Email" />
|
||||
)}
|
||||
</FormItem>
|
||||
|
||||
{/* 密码 */}
|
||||
<FormItem>
|
||||
{getFieldDecorator('password', {
|
||||
rules: [{
|
||||
required: true,
|
||||
message: '请输入密码!'
|
||||
}, {
|
||||
validator: this.checkConfirm
|
||||
}]
|
||||
})(
|
||||
<Input prefix={<Icon type="lock" style={{ fontSize: 13 }} />} type="password" placeholder="Password" />
|
||||
)}
|
||||
</FormItem>
|
||||
|
||||
{/* 密码二次确认 */}
|
||||
<FormItem>
|
||||
{getFieldDecorator('confirm', {
|
||||
rules: [{
|
||||
required: true,
|
||||
message: '请再次输入密码密码!'
|
||||
}, {
|
||||
validator: this.checkPassword
|
||||
}]
|
||||
})(
|
||||
<Input prefix={<Icon type="lock" style={{ fontSize: 13 }} />} type="password" placeholder="Confirm Password" />
|
||||
)}
|
||||
</FormItem>
|
||||
|
||||
{/* 注册按钮 */}
|
||||
<FormItem>
|
||||
<Button type="primary" htmlType="submit" className="login-form-button">注册</Button>
|
||||
</FormItem>
|
||||
</Form>
|
||||
)
|
||||
}
|
||||
}
|
||||
const RegForm = Form.create()(Reg);
|
||||
export default RegForm;
|
Loading…
Reference in New Issue
Block a user