feat: 添加项目线上域名选项添加option选项

This commit is contained in:
wenbo.dong 2017-07-18 14:30:33 +08:00
parent 9395b19480
commit 9205e40660
2 changed files with 23 additions and 7 deletions

View File

@ -0,0 +1,3 @@
.ant-input-group-wrapper {
width: 100%;
}

View File

@ -1,10 +1,13 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Table, Button, Modal, Form, Input, Icon, Tooltip } from 'antd'; import { Table, Button, Modal, Form, Input, Icon, Tooltip, Select } from 'antd';
import { addProject } from '../../../actions/project'; import { addProject } from '../../../actions/project';
const { TextArea } = Input; const { TextArea } = Input;
const FormItem = Form.Item; const FormItem = Form.Item;
const Option = Select.Option;
import './ProjectList.scss'
const columns = [{ const columns = [{
title: 'Name', title: 'Name',
@ -59,12 +62,12 @@ const formItemLayout = {
addProject addProject
} }
) )
class ProjectList extends Component { class ProjectList extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
visible: false visible: false,
protocol: 'http:\/\/'
} }
} }
static propTypes = { static propTypes = {
@ -80,6 +83,7 @@ class ProjectList extends Component {
e.preventDefault(); e.preventDefault();
this.props.form.validateFields((err, values) => { this.props.form.validateFields((err, values) => {
if (!err) { if (!err) {
values.prd_host = this.state.protocol + values.prd_host;
console.log('Received values of form: ', values); console.log('Received values of form: ', values);
this.setState({ this.setState({
visible: false visible: false
@ -94,9 +98,14 @@ class ProjectList extends Component {
visible: false visible: false
}); });
} }
handleSubmit = (e) => {
console.log(e); // 修改线上域名的协议类型 (http/https)
protocolChange = (value) => {
this.setState({
protocol: value
})
} }
render() { render() {
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
return ( return (
@ -107,7 +116,7 @@ class ProjectList extends Component {
onOk={this.handleOk} onOk={this.handleOk}
onCancel={this.handleCancel} onCancel={this.handleCancel}
> >
<Form onSubmit={this.handleSubmit}> <Form>
<FormItem <FormItem
{...formItemLayout} {...formItemLayout}
@ -138,7 +147,11 @@ class ProjectList extends Component {
required: true, message: '请输入项目线上域名!' required: true, message: '请输入项目线上域名!'
}] }]
})( })(
<Input /> <Input addonBefore={(
<Select defaultValue="http://" onChange={this.protocolChange}>
<Option value="http://">{'http:\/\/'}</Option>
<Option value="https://">{'https:\/\/'}</Option>
</Select>)} />
)} )}
</FormItem> </FormItem>