import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { Table, Button, Modal, Form, Input, Icon, Tooltip, Select } from 'antd'; import { addProject } from '../../../actions/project'; const { TextArea } = Input; const FormItem = Form.Item; const Option = Select.Option; import './ProjectList.scss' const columns = [{ title: 'Name', dataIndex: 'name', key: 'name', render: text => {text} }, { title: 'Age', dataIndex: 'age', key: 'age' }, { title: 'Action', key: 'action', render: () => ( 修改 删除 ) }]; const data = [{ key: '1', age: 32 }, { key: '2', age: 42 }, { key: '3', age: 32 }]; const formItemLayout = { labelCol: { xs: { span: 24 }, sm: { span: 6 } }, wrapperCol: { xs: { span: 24 }, sm: { span: 14 } } }; @connect( state => { return { loginData: state.login } }, { addProject } ) class ProjectList extends Component { constructor(props) { super(props); this.state = { visible: false, protocol: 'http:\/\/' } } static propTypes = { form: PropTypes.object, addProject: PropTypes.func } addProject = () => { this.setState({ visible: true }); } handleOk = (e) => { e.preventDefault(); this.props.form.validateFields((err, values) => { if (!err) { values.prd_host = this.state.protocol + values.prd_host; console.log('Received values of form: ', values); this.setState({ visible: false }); this.props.addProject(values); } }); } handleCancel = () => { this.props.form.resetFields(); this.setState({ visible: false }); } // 修改线上域名的协议类型 (http/https) protocolChange = (value) => { this.setState({ protocol: value }) } 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: '请输入描述!' }] })(