mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-21 05:19:42 +08:00
fix: 统一文件大小写
This commit is contained in:
parent
f4a3a22292
commit
d21eacc5ea
@ -4,7 +4,7 @@ import { connect } from 'react-redux'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { Row, Col, Button } from 'antd'
|
||||
import PropTypes from "prop-types"
|
||||
import Login from '../Login/login-wrap'
|
||||
import Login from '../Login/Login-wrap'
|
||||
import Intro from '../../components/Intro/Intro'
|
||||
import Footer from "../../components/Footer/Footer";
|
||||
|
||||
|
40
client/containers/Login/Login-wrap.js
Normal file
40
client/containers/Login/Login-wrap.js
Normal file
@ -0,0 +1,40 @@
|
||||
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)
|
4
client/containers/Login/Login.scss
Normal file
4
client/containers/Login/Login.scss
Normal file
@ -0,0 +1,4 @@
|
||||
@import '../../styles/common.scss';
|
||||
|
||||
/* .login-main.css */
|
||||
|
124
client/containers/Login/Reg.js
Normal file
124
client/containers/Login/Reg.js
Normal file
@ -0,0 +1,124 @@
|
||||
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,10 +1,10 @@
|
||||
import './login.scss'
|
||||
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';
|
||||
import LoginForm from './Login';
|
||||
import RegForm from './Reg';
|
||||
const TabPane = Tabs.TabPane;
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Home from './Home/Home.js'
|
||||
import Login from './Login/login-wrap.js'
|
||||
import Login from './Login/Login-wrap.js'
|
||||
import ProjectGroups from './ProjectGroups/ProjectGroups.js'
|
||||
import Interface from './Interface/Interface.js'
|
||||
import News from './News/News.js'
|
||||
|
Loading…
Reference in New Issue
Block a user