diff --git a/client/containers/Project/AddProject/AddProject.js b/client/containers/Project/AddProject/AddProject.js index 19bc765b..3b43f6ef 100644 --- a/client/containers/Project/AddProject/AddProject.js +++ b/client/containers/Project/AddProject/AddProject.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; -import { Button, Form, Input, Icon, Tooltip, Select, message } from 'antd'; +import { Button, Form, Input, Icon, Tooltip, Select, message, Row, Col, Radio } from 'antd'; import { addProject, fetchProjectList, delProject, changeUpdateModal, changeTableLoading } from '../../../reducer/modules/project'; // import { Link } from 'react-router-dom' // import variable from '../../../constants/variable'; @@ -10,35 +10,21 @@ import { autobind } from 'core-decorators'; const { TextArea } = Input; const FormItem = Form.Item; const Option = Select.Option; +const RadioGroup = Radio.Group; import './Addproject.scss' -// 确认删除项目 handleDelete, currGroup._id, fetchProjectList -// const deleteConfirm = (id, props) => { -// const { delProject, currGroup, fetchProjectList } = props; -// const handle = () => { -// delProject(id).then((res) => { -// if (res.payload.data.errcode == 0) { -// message.success('删除成功!') -// fetchProjectList(currGroup._id).then(() => { -// }); -// } else { -// message.error(res.payload.data.errmsg); -// } -// }); -// } -// return handle; -// }; - - const formItemLayout = { labelCol: { + lg: { span: 3 }, xs: { span: 24 }, sm: { span: 6 } }, wrapperCol: { + lg: { span: 21 }, xs: { span: 24 }, sm: { span: 14 } - } + }, + className: 'form-item' }; @connect( @@ -84,14 +70,6 @@ class ProjectList extends Component { currPage: PropTypes.number } - // 显示模态框 - 创建项目 - @autobind - showAddProjectModal() { - this.setState({ - visible: true - }); - } - // 确认添加项目 @autobind handleOk(e) { @@ -99,6 +77,7 @@ class ProjectList extends Component { const that = this; e.preventDefault(); form.validateFields((err, values) => { + // console.log(values); if (!err) { values.protocol = this.state.protocol.split(':')[0]; // 获取当前分组id传入values @@ -127,15 +106,6 @@ class ProjectList extends Component { }); } - // 取消修改 - @autobind - handleCancel() { - this.props.form.resetFields(); - this.setState({ - visible: false - }); - } - // 修改线上域名的协议类型 (http/https) @autobind protocolChange(value) { @@ -144,35 +114,7 @@ class ProjectList extends Component { }) } - // 分页逻辑 - @autobind - paginationChange(pageNum) { - this.props.fetchProjectList(this.props.currGroup._id, pageNum).then((res) => { - if (res.payload.data.errcode) { - message.error(res.payload.data.errmsg); - } else { - this.props.changeTableLoading(false); - } - }); - } - componentWillReceiveProps(nextProps) { - // 切换分组 - if (this.props.currGroup !== nextProps.currGroup) { - if (nextProps.currGroup._id) { - this.props.fetchProjectList(nextProps.currGroup._id, this.props.currPage).then((res) => { - if (res.payload.data.errcode) { - message.error(res.payload.data.errmsg); - } else { - this.props.changeTableLoading(false); - } - }); - } else { - // 无分组的时候停止loading状态 - this.props.changeTableLoading(false); - } - } - // 切换项目列表 if (this.props.projectList !== nextProps.projectList) { // console.log(nextProps.projectList); @@ -205,6 +147,24 @@ class ProjectList extends Component { )} + + {getFieldDecorator('group_id', { + rules: [{ + required: true, message: '请选择项目所属的分组!' + }] + })( + + )} + + +
+ )} + + + {getFieldDecorator('radio-group', { + rules: [{ + required: true + }], + initialValue: 1 + })( + + + 私有
只有组长和项目开发者可以索引并查看项目信息 +
+
+ + 公开
任何人都可以索引并查看项目信息 +
+
+ )} +
- + + + + + ); } diff --git a/client/containers/Project/AddProject/Addproject.scss b/client/containers/Project/AddProject/Addproject.scss index b76d714a..cf805cb7 100644 --- a/client/containers/Project/AddProject/Addproject.scss +++ b/client/containers/Project/AddProject/Addproject.scss @@ -4,3 +4,27 @@ margin: .24rem auto !important; padding: .24rem !important; } + +.form-item { + margin-bottom: .16rem; +} + +.breakline { + margin-top: .18rem; + margin-bottom: .18rem; + border: 0; + border-top: 1px solid #eeeeee; +} + + +.radio { + font-weight: 600; +} + +.radio-desc { + margin-left: .22rem; + position: relative; + font-weight: normal; + top: -.08rem; + color: #919191; +}