diff --git a/src/forge/Main/Index.js b/src/forge/Main/Index.js index afe108172..539537c49 100644 --- a/src/forge/Main/Index.js +++ b/src/forge/Main/Index.js @@ -256,11 +256,11 @@ class Index extends Component { newItem = ()=>{ return( - - {this.props.history.push('/projects/mirror/new')}}>新建镜像项目 - - {this.props.history.push('/projects/deposit/new')}}>新建托管项目 + {this.props.history.push('/projects/deposit/new')}}>新建项目 + + + {this.props.history.push('/projects/mirror/new')}}>导入项目 ) diff --git a/src/forge/Main/IndexItem.js b/src/forge/Main/IndexItem.js index d2b2c0975..0cba9123e 100644 --- a/src/forge/Main/IndexItem.js +++ b/src/forge/Main/IndexItem.js @@ -41,22 +41,22 @@ class IndexItem extends Component { { !item.is_public && 私有 } { item.forked_from_project_id ? - + - + : "" } { item.type && item.type === 2 ? - + :"" } { item.type && item.type === 1 ? - + - :"" + :"" } diff --git a/src/forge/New/Index.js b/src/forge/New/Index.js index 7a9be5a58..50859e302 100644 --- a/src/forge/New/Index.js +++ b/src/forge/New/Index.js @@ -2,9 +2,10 @@ import React, { Component } from 'react'; import { Link } from 'react-router-dom'; import { Input , Form , Select , Checkbox , Button , Spin , AutoComplete, Modal } from 'antd'; import { Base64 } from 'js-base64'; +import { AlignCenter } from '../Component/layout'; import '../css/index.scss'; -import './new.css' +import './new.scss' import axios from 'axios'; const Option = Select.Option; @@ -44,7 +45,12 @@ class Index extends Component { project_category_name: undefined, license_name: undefined, ignore_name: undefined, - descNum:0 + descNum:0, + + categoreFlag:false, + languageFlag:false, + ignoreFlag:false, + licenseFlag:false, } } componentDidMount = () => { @@ -189,6 +195,7 @@ class Index extends Component { subMitFrom = () => { this.props.form.validateFieldsAndScroll((err, values) => { + console.log(err); if (!err) { this.setState({ isSpin: true @@ -313,41 +320,28 @@ class Index extends Component { mirrorCheck, - descNum + descNum, + + ignoreFlag, + licenseFlag, + languageFlag, + categoreFlag } = this.state; return (
-
创建{projectsType && projectsType === "mirror" ? "镜像" : "托管"}项目
+
{projectsType && projectsType === "mirror" ? "导入" : "新建"}项目
- - {getFieldDecorator('user_id', { - rules: [{ - required: true, message: '请选择拥有者' - },{ - validator:(rule, value, callback) => this.checkId(rule, value, callback, OwnerList, '拥有者') - }], - })( - this.ChangePlatform(value, e, 'owners', OwnerList)} - className="plateAutoComplete" - onBlur={(value) => this.blurCategory(value, OwnerList, "owners")} - > - {owners_list} - - )} - - { + + { projectsType && projectsType === "mirror" && {getFieldDecorator('clone_addr', { rules: [{ @@ -362,13 +356,13 @@ class Index extends Component { } { projectsType && projectsType === "mirror" && - +

需要授权验证 - 如果源项目为公有仓库,禁止填写用户名密码。如果源项目为私有仓库,则必须填写正确的用户名和密码!

+ 如果导入项目为私有仓库,则必须填写相应平台正确的用户名和密码

{ mirrorCheck && -
+
用户名 密码 {getFieldDecorator('password', { rules: [], @@ -393,143 +386,144 @@ class Index extends Component {
} - +
} + + + {getFieldDecorator('user_id', { + rules: [{ + required: true, message: '请选择拥有者' + },{ + validator:(rule, value, callback) => this.checkId(rule, value, callback, OwnerList, '拥有者') + }], + })( + this.ChangePlatform(value, e, 'owners', OwnerList)} + className="plateAutoComplete" + onBlur={(value) => this.blurCategory(value, OwnerList, "owners")} + > + {owners_list} + + )} + + / + + {getFieldDecorator('name', { + rules: [{ + required: true, message: '请填写项目名称' + }], + })( + + )} + + 项目标识 (项目url标识部分)} + colon={false} > - {getFieldDecorator('name', { + {getFieldDecorator('repository_name', { rules: [{ - required: true, message: '请填写项目名称' + required: true, message: '请填写项目标识' }], })( - + )}
{descNum}/200 {getFieldDecorator('description', { - rules: [{ - required: true, message: '请填写项目简介' - }], + rules: [], })( )}
- - {getFieldDecorator('repository_name', { - rules: [{ - required: true, message: '请填写仓库名称' - }], - })( - - )} - - - {getFieldDecorator('project_category', { - rules: [{ - required: true, message: '请选择大类别', - }, { - validator: (rule, value, callback) => this.checkId(rule, value, callback, CategoryList, '项目类别') - }], - })( - this.ChangePlatform(value, e, 'project_category', CategoryList)} - className="plateAutoComplete" - onBlur={(value) => this.blurCategory(value, CategoryList, "project_category")} - > - {project_category_list} - - )} - - - {getFieldDecorator('project_language', { - rules: [{ - required: true, message: '请选择项目语言' - }, { - validator: (rule, value, callback) => this.checkId(rule, value, callback, LanguageList, '项目语言') - }], - })( - this.ChangePlatform(value, e, 'project_language', LanguageList)} - className="plateAutoComplete" - onBlur={(value) => this.blurCategory(value, LanguageList, "project_language")} - > - {project_language_list} - - )} - + { (projectsType === "deposit" || !projectsType) && - {getFieldDecorator('ignore', { - rules: [{ - required: true, message: '请选择gitignore' - }, { - validator: (rule, value, callback) => this.checkId(rule, value, callback, GitignoreList, 'gitignore') - }], - })( - this.ChangePlatform(value, e, 'ignore', GitignoreList)} - className="plateAutoComplete" - onBlur={(value) => this.blurCategory(value, GitignoreList, "ignore")} - > - {ignore_list} - + {getFieldDecorator('ignoreFlag')( + this.setState({ignoreFlag:e.target.checked})}>.gitignore )} + { ignoreFlag && + + {getFieldDecorator('ignore', { + rules: [{ + required: ignoreFlag, message: '请选择gitignore' + }, { + validator: (rule, value, callback) => this.checkId(rule, value, callback, GitignoreList, 'gitignore') + }], + })( + this.ChangePlatform(value, e, 'ignore', GitignoreList)} + className="plateAutoComplete" + onBlur={(value) => this.blurCategory(value, GitignoreList, "ignore")} + > + {ignore_list} + + )} + + } - {getFieldDecorator('license', { - rules: [{ - required: true, message: '请选择开源许可证' - }, { - validator: (rule, value, callback) => this.checkId(rule, value, callback, LicensesList, '开源许可证') - }], - })( - this.ChangePlatform(value, e, 'license', LicensesList)} - className="plateAutoComplete" - onBlur={(value) => this.blurCategory(value, LicensesList, "license")} - > - {license_list} - + {getFieldDecorator('licenseFlag')( + this.setState({licenseFlag:e.target.checked})}>开源许可证 )} + { licenseFlag && + + {getFieldDecorator('license', { + rules: [{ + required: licenseFlag, message: '请选择开源许可证' + }, { + validator: (rule, value, callback) => this.checkId(rule, value, callback, LicensesList, '开源许可证') + }], + })( + this.ChangePlatform(value, e, 'license', LicensesList)} + className="plateAutoComplete" + onBlur={(value) => this.blurCategory(value, LicensesList, "license")} + > + {license_list} + + )} + + } } {getFieldDecorator('private')( - 将项目设为私有(只有项目所有人或拥有权限的项目成员才能看到) + 将项目设为私有(只有项目所有人或拥有权限的项目成员才能看到) )} { projectsType && projectsType === "mirror" && {getFieldDecorator('is_mirror')( @@ -537,7 +531,64 @@ class Index extends Component { )} } -
+ + {getFieldDecorator('categoreFlag')( + this.setState({categoreFlag:e.target.checked})}>项目类别 + )} + + {categoreFlag && + + {getFieldDecorator('project_category', { + rules: [{ + required: categoreFlag, message: '请选择大类别', + }, { + validator: (rule, value, callback) => this.checkId(rule, value, callback, CategoryList, '项目类别') + }], + })( + this.ChangePlatform(value, e, 'project_category', CategoryList)} + className="plateAutoComplete" + onBlur={(value) => this.blurCategory(value, CategoryList, "project_category")} + > + {project_category_list} + + )} + + } + + {getFieldDecorator('languageFlag')( + this.setState({languageFlag:e.target.checked})}>项目语言 + )} + + {languageFlag && + + {getFieldDecorator('project_language', { + rules: [{ + required: languageFlag, message: '请选择项目语言' + }, { + validator: (rule, value, callback) => this.checkId(rule, value, callback, LanguageList, '项目语言') + }], + })( + this.ChangePlatform(value, e, 'project_language', LanguageList)} + className="plateAutoComplete" + onBlur={(value) => this.blurCategory(value, LanguageList, "project_language")} + > + {project_language_list} + + )} + + } +
注: 为必填项,否则为选填
diff --git a/src/forge/New/new.css b/src/forge/New/new.scss similarity index 72% rename from src/forge/New/new.css rename to src/forge/New/new.scss index fcb6fa8cf..15aca70b2 100644 --- a/src/forge/New/new.css +++ b/src/forge/New/new.scss @@ -12,7 +12,13 @@ border-bottom: 1px solid #f0f0f0 } .newPanel_content{ - padding:1rem 2rem; + padding:2rem; +} +.newPanel_content form .ant-row.ant-form-item{ + margin-bottom: 25px; +} +.newPanel_content .ant-form-item-label label{ + font-size: 16px; } .newPanel_content .ant-form-item-control-wrapper{ flex: 1; @@ -25,24 +31,35 @@ height: 35px; line-height: 35px; } - .newContent_inline{ display: flex; flex-wrap: wrap; justify-content: space-between; align-items:flex-end } +.explainPos{ + .ant-form-explain{ + position: absolute; + } +} .newContent_inline > .ant-form-item:nth-child(2){ margin-left: 20px; } -.newPanel_content .privatePart .ant-form-item-label{ - margin-left: 0px; +.privatePart{ + margin-bottom: 0px!important; + .ant-form-item-label{ + margin-left: 0px; + } } .newPanel_content .ant-form-item-label{ line-height: 25px; height: 25px; - margin-left: -0.8rem; +} +.plateAutoComplete{ + .ant-input{ + height: 34px!important; + } } @media screen and (max-width: 750px){ .newPanel_content{ diff --git a/src/forge/Team/List.jsx b/src/forge/Team/List.jsx index 7e64c5de2..5eebfc385 100644 --- a/src/forge/Team/List.jsx +++ b/src/forge/Team/List.jsx @@ -63,10 +63,10 @@ function List(props){ const menu_new=( - {props.history.push(`/projects/deposit/new/${OIdentifier}`)}}>新建托管项目 + {props.history.push(`/projects/deposit/new/${OIdentifier}`)}}>新建项目 - {props.history.push(`/projects/mirror/new/${OIdentifier}`)}}>新建镜像项目 + {props.history.push(`/projects/mirror/new/${OIdentifier}`)}}>导入项目 ) diff --git a/src/forge/Team/RightBox.jsx b/src/forge/Team/RightBox.jsx index 7616fd6ca..5c85ae474 100644 --- a/src/forge/Team/RightBox.jsx +++ b/src/forge/Team/RightBox.jsx @@ -108,7 +108,7 @@ function RightBox({ OIdentifier , history , admin , showCompeleteDialog ,complet
{ (item.is_admin || item.is_member) ? - {item.name} + {item.nickname} : {item.name} } diff --git a/src/forge/users/InfosUser.js b/src/forge/users/InfosUser.js index 276a0b1f8..d6f30ee89 100644 --- a/src/forge/users/InfosUser.js +++ b/src/forge/users/InfosUser.js @@ -115,11 +115,11 @@ class InfosUser extends Component { newItem =()=> ( - - {this.props.history.push('/projects/mirror/new')}}>新建镜像项目 - - {this.props.history.push('/projects/deposit/new')}} >新建托管项目 + {this.props.history.push('/projects/deposit/new')}} >新建项目 + + + {this.props.history.push('/projects/mirror/new')}}>导入项目 );