diff --git a/client/actions/login.js b/client/actions/login.js index cf5b344f..be866b50 100644 --- a/client/actions/login.js +++ b/client/actions/login.js @@ -1,6 +1,5 @@ import { LOGIN, - REGISTER, LOGIN_TYPE } from '../constants/action-types.js'; import axios from 'axios'; @@ -24,9 +23,18 @@ const loginActions = (data) => { } const regActions = (data) => { - return { - type: REGISTER, - data + console.log(data); + const param = { + email: data.email, + password: data.password, + username: data.userName + } + return () => { + axios.get('/user/login', param).then((res) => { + console.log(res); + }).catch((err) => { + console.log(err); + }); } } diff --git a/client/containers/Login/loginWrap.js b/client/containers/Login/login-wrap.js similarity index 97% rename from client/containers/Login/loginWrap.js rename to client/containers/Login/login-wrap.js index 0e616cf8..6fab88b0 100644 --- a/client/containers/Login/loginWrap.js +++ b/client/containers/Login/login-wrap.js @@ -1,4 +1,4 @@ -import './Login.scss' +import './login.scss' import React, { Component } from 'react' import { connect } from 'react-redux' import PropTypes from 'prop-types' diff --git a/client/containers/Login/login.scss b/client/containers/Login/login.scss new file mode 100644 index 00000000..23812370 --- /dev/null +++ b/client/containers/Login/login.scss @@ -0,0 +1,7 @@ +@import '../../styles/common.scss'; + +/* .login-main.css */ +.login-form { + width: 4rem; + margin: 1rem auto; +} diff --git a/client/containers/Login/reg.js b/client/containers/Login/reg.js index 87f25aa0..d95f6287 100644 --- a/client/containers/Login/reg.js +++ b/client/containers/Login/reg.js @@ -18,7 +18,10 @@ const FormItem = Form.Item; class Reg extends Component { constructor(props) { - super(props) + super(props); + this.state = { + confirmDirty: false + } } static propTypes = { @@ -29,17 +32,41 @@ class Reg extends Component { handleSubmit = (e) => { e.preventDefault(); const form = this.props.form; - form.validateFields((err, values) => { + 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 (
+ + {/* 用户名 */} {getFieldDecorator('userName', { rules: [{ required: true, message: '请输入用户名!' }] @@ -47,6 +74,8 @@ class Reg extends Component { } placeholder="Username" /> )} + + {/* Emaiil */} {getFieldDecorator('email', { rules: [{ required: true, message: '请输入email!' }] @@ -54,13 +83,36 @@ class Reg extends Component { } placeholder="Email" /> )} + + {/* 密码 */} {getFieldDecorator('password', { - rules: [{ required: true, message: '请输入密码!' }] + rules: [{ + required: true, + message: '请输入密码!' + }, { + validator: this.checkConfirm + }] })( } type="password" placeholder="Password" /> )} + + {/* 密码二次确认 */} + + {getFieldDecorator('confirm', { + rules: [{ + required: true, + message: '请再次输入密码密码!' + }, { + validator: this.checkPassword + }] + })( + } type="password" placeholder="Confirm Password" /> + )} + + + {/* 注册按钮 */} diff --git a/client/containers/ProjectGroups/ProjectList/index.js b/client/containers/ProjectGroups/ProjectList/index.js index e7446659..a577b695 100644 --- a/client/containers/ProjectGroups/ProjectList/index.js +++ b/client/containers/ProjectGroups/ProjectList/index.js @@ -1,7 +1,9 @@ import React, { Component } from 'react' -// import PropTypes from 'prop-types' +import PropTypes from 'prop-types' // import { connect } from 'react-redux' -import { Table } from 'antd' +import { Table, Button, Modal, Form, Input, Icon, Tooltip } from 'antd'; +const { TextArea } = Input; +const FormItem = Form.Item; const columns = [{ title: 'Name', @@ -35,12 +37,133 @@ const data = [{ age: 32 }]; - - -export default class GroupList extends Component { +const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 6 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 14 } + } +}; +class ProjectList extends Component { + constructor(props) { + super(props); + this.state = { + visible: false + } + } + static propTypes = { + form: PropTypes.object + } + addProject = () => { + this.setState({ + visible: true + }); + } + handleOk = (e) => { + e.preventDefault(); + this.props.form.validateFields((err, values) => { + if (!err) { + console.log('Received values of form: ', values); + this.setState({ + visible: false + }); + } + }); + } + handleCancel = () => { + this.props.form.resetFields(); + this.setState({ + visible: false + }); + } + handleSubmit = (e) => { + console.log(e); + } render() { + const { getFieldDecorator } = this.props.form; return ( - +
+ + + + + {getFieldDecorator('name', { + rules: [{ + required: true, message: '请输入项目名称!' + }] + })( + + )} + + + + 线上域名  + + + + + )} + > + {getFieldDecorator('prd_host', { + rules: [{ + required: true, message: '请输入项目线上域名!' + }] + })( + + )} + + + + {getFieldDecorator('basepath', { + rules: [{ + required: true, message: '请输入项目基本路径!' + }] + })( + + )} + + + + {getFieldDecorator('desc', { + rules: [{ + required: true, message: '请输入描述!' + }] + })( +