同上,文案已改,项目新建页面前端修改,wait后端

This commit is contained in:
caishi 2021-09-09 14:11:02 +08:00
parent e0aeab0e20
commit a4475e995b
3 changed files with 201 additions and 132 deletions

View File

@ -48,13 +48,13 @@ class IndexItem extends Component {
} }
{ {
item.type && item.type === 2 ? item.type && item.type === 2 ?
<Tooltip title="源镜像仓库为私有:该项目导入于其他网站的私有仓库" className="ml5"> <Tooltip title="该项目是一个同步镜像仓库" className="ml5">
<i className="iconfont icon-banbenku font-18 color-green" /> <i className="iconfont icon-banbenku font-18 color-green" />
</Tooltip>:"" </Tooltip>:""
} }
{ {
item.type && item.type === 1 ? item.type && item.type === 1 ?
<Tooltip title="源镜像仓库为公有:该项目导入于其他网站的公有仓库" className="ml5"> <Tooltip title="该项目是一个导入于其他网站的仓库" className="ml5">
<i className="iconfont icon-jingxiang font-18 color-green" /> <i className="iconfont icon-jingxiang font-18 color-green" />
</Tooltip>:"" </Tooltip>:""
} }

View File

@ -2,9 +2,10 @@ import React, { Component } from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Input , Form , Select , Checkbox , Button , Spin , AutoComplete, Modal } from 'antd'; import { Input , Form , Select , Checkbox , Button , Spin , AutoComplete, Modal } from 'antd';
import { Base64 } from 'js-base64'; import { Base64 } from 'js-base64';
import { AlignCenter } from '../Component/layout';
import '../css/index.scss'; import '../css/index.scss';
import './new.css' import './new.scss'
import axios from 'axios'; import axios from 'axios';
const Option = Select.Option; const Option = Select.Option;
@ -44,7 +45,12 @@ class Index extends Component {
project_category_name: undefined, project_category_name: undefined,
license_name: undefined, license_name: undefined,
ignore_name: undefined, ignore_name: undefined,
descNum:0 descNum:0,
categoreFlag:false,
languageFlag:false,
ignoreFlag:false,
licenseFlag:false,
} }
} }
componentDidMount = () => { componentDidMount = () => {
@ -189,6 +195,7 @@ class Index extends Component {
subMitFrom = () => { subMitFrom = () => {
this.props.form.validateFieldsAndScroll((err, values) => { this.props.form.validateFieldsAndScroll((err, values) => {
console.log(err);
if (!err) { if (!err) {
this.setState({ this.setState({
isSpin: true isSpin: true
@ -313,41 +320,28 @@ class Index extends Component {
mirrorCheck, mirrorCheck,
descNum descNum,
ignoreFlag,
licenseFlag,
languageFlag,
categoreFlag
} = this.state; } = this.state;
return ( return (
<div className="main back-white" style={{padding:"0px",border:"none"}}> <div className="main back-white" style={{padding:"0px",border:"none"}}>
<div className="newPanel"> <div className="newPanel">
<div className="newPanel_title">创建{projectsType && projectsType === "mirror" ? "镜像" : "托管"}项目</div> <div className="newPanel_title">{projectsType && projectsType === "mirror" ? "导入" : "新建"}项目</div>
<Spin spinning={isSpin}> <Spin spinning={isSpin}>
<Form> <Form>
<div className="newPanel_content"> <div className="newPanel_content">
<Form.Item
label="拥有者"
>
{getFieldDecorator('user_id', {
rules: [{
required: true, message: '请选择拥有者'
},{
validator:(rule, value, callback) => this.checkId(rule, value, callback, OwnerList, '拥有者')
}],
})(
<AutoComplete
placeholder="请选择拥有者"
onChange={(value, e) => this.ChangePlatform(value, e, 'owners', OwnerList)}
className="plateAutoComplete"
onBlur={(value) => this.blurCategory(value, OwnerList, "owners")}
>
{owners_list}
</AutoComplete>
)}
</Form.Item>
{ {
projectsType && projectsType === "mirror" && projectsType && projectsType === "mirror" &&
<React.Fragment> <React.Fragment>
<Form.Item <Form.Item
label="镜像版本库地址" label="镜像版本库地址"
style={{ marginBottom: "0px" }} style={{ marginBottom: "0px" }}
colon={false}
> >
{getFieldDecorator('clone_addr', { {getFieldDecorator('clone_addr', {
rules: [{ rules: [{
@ -362,13 +356,13 @@ class Index extends Component {
} }
{ {
projectsType && projectsType === "mirror" && projectsType && projectsType === "mirror" &&
<React.Fragment> <div className="pb10">
<p className="mt10 mb10 color-grey-3 pointer" onClick={this.changeMirrorCheck}> <p className="mt10 mb10 color-grey-3 pointer" onClick={this.changeMirrorCheck}>
需要授权验证<i className={mirrorCheck?"iconfont icon-xiajiantou font-13 ml10 color-grey-8":"iconfont icon-youjiantou font-13 ml10 color-grey-8"}></i> 需要授权验证<i className={mirrorCheck?"iconfont icon-xiajiantou font-13 ml10 color-grey-8":"iconfont icon-youjiantou font-13 ml10 color-grey-8"}></i>
<span className="ml20 font-12 color-red">如果源项目为公有仓库禁止填写用户名密码如果源项目为私有仓库则必须填写正确的用户名和密码!</span></p> <span className="ml20 font-12 color-red">如果导入项目为私有仓库则必须填写相应平台正确的用户名和密码</span></p>
{ {
mirrorCheck && mirrorCheck &&
<div className="df mb20" style={{alignItems:'center'}}> <div className="df mb10" style={{alignItems:'center'}}>
<span className="mr10">用户名</span> <span className="mr10">用户名</span>
<Form.Item <Form.Item
style={{ marginBottom: "0px" }} style={{ marginBottom: "0px" }}
@ -393,10 +387,37 @@ class Index extends Component {
</Form.Item> </Form.Item>
</div> </div>
} }
</React.Fragment> </div>
} }
<AlignCenter>
<Form.Item
label="拥有者"
style={{width:"260px"}}
colon={false}
>
{getFieldDecorator('user_id', {
rules: [{
required: true, message: '请选择拥有者'
},{
validator:(rule, value, callback) => this.checkId(rule, value, callback, OwnerList, '拥有者')
}],
})(
<AutoComplete
style={{width:"260px",height:"35px"}}
placeholder="请选择拥有者"
onChange={(value, e) => this.ChangePlatform(value, e, 'owners', OwnerList)}
className="plateAutoComplete"
onBlur={(value) => this.blurCategory(value, OwnerList, "owners")}
>
{owners_list}
</AutoComplete>
)}
</Form.Item>
<span className="ml10 mr10 mt10 font-18">/</span>
<Form.Item <Form.Item
label="项目名称" label="项目名称"
className="flex1"
colon={false}
> >
{getFieldDecorator('name', { {getFieldDecorator('name', {
rules: [{ rules: [{
@ -406,80 +427,49 @@ class Index extends Component {
<Input placeholder="例如:团队协作方法与研究" maxLength={50}/> <Input placeholder="例如:团队协作方法与研究" maxLength={50}/>
)} )}
</Form.Item> </Form.Item>
</AlignCenter>
<Form.Item
label={<span>项目标识 <span className="color-grey-9">(项目url标识部分)</span></span>}
colon={false}
>
{getFieldDecorator('repository_name', {
rules: [{
required: true, message: '请填写项目标识'
}],
})(
<Input placeholder="项目标识请使用与项目相关的英文关键字" maxLength={100} />
)}
</Form.Item>
<div className="pr"> <div className="pr">
<span className="toprightNum">{descNum}/200</span> <span className="toprightNum">{descNum}/200</span>
<Form.Item <Form.Item
label="项目简介" label="项目简介"
colon={false}
style={{marginBottom:"0px"}}
> >
{getFieldDecorator('description', { {getFieldDecorator('description', {
rules: [{ rules: [],
required: true, message: '请填写项目简介'
}],
})( })(
<Input.TextArea maxLength={200} placeholder="项目的介绍" autoSize={{ minRows: 2, maxRows: 6 }} onChange={this.changeDesc}/> <Input.TextArea maxLength={200} placeholder="项目的介绍" autoSize={{ minRows: 2, maxRows: 6 }} onChange={this.changeDesc}/>
)} )}
</Form.Item> </Form.Item>
</div> </div>
<Form.Item
label="仓库名称"
>
{getFieldDecorator('repository_name', {
rules: [{
required: true, message: '请填写仓库名称'
}],
})(
<Input placeholder="仓库名称请使用与项目相关的英文关键字" maxLength={100} />
)}
</Form.Item>
<Form.Item
label="项目类别"
>
{getFieldDecorator('project_category', {
rules: [{
required: true, message: '请选择大类别',
}, {
validator: (rule, value, callback) => this.checkId(rule, value, callback, CategoryList, '项目类别')
}],
})(
<AutoComplete
placeholder="请选择项目类别"
onChange={(value, e) => this.ChangePlatform(value, e, 'project_category', CategoryList)}
className="plateAutoComplete"
onBlur={(value) => this.blurCategory(value, CategoryList, "project_category")}
>
{project_category_list}
</AutoComplete>
)}
</Form.Item>
<Form.Item
label="项目语言"
>
{getFieldDecorator('project_language', {
rules: [{
required: true, message: '请选择项目语言'
}, {
validator: (rule, value, callback) => this.checkId(rule, value, callback, LanguageList, '项目语言')
}],
})(
<AutoComplete
placeholder="请选择项目语言"
onChange={(value, e) => this.ChangePlatform(value, e, 'project_language', LanguageList)}
className="plateAutoComplete"
onBlur={(value) => this.blurCategory(value, LanguageList, "project_language")}
>
{project_language_list}
</AutoComplete>
)}
</Form.Item>
{ {
(projectsType === "deposit" || !projectsType) && (projectsType === "deposit" || !projectsType) &&
<React.Fragment> <React.Fragment>
<Form.Item <Form.Item
label=".gitignore" className="privatePart"
> >
{getFieldDecorator('ignoreFlag')(
<Checkbox checked={ignoreFlag}>.gitignore</Checkbox>
)}
</Form.Item>
{ ignoreFlag &&
<Form.Item>
{getFieldDecorator('ignore', { {getFieldDecorator('ignore', {
rules: [{ rules: [{
required: true, message: '请选择gitignore' required: ignoreFlag, message: '请选择gitignore'
}, { }, {
validator: (rule, value, callback) => this.checkId(rule, value, callback, GitignoreList, 'gitignore') validator: (rule, value, callback) => this.checkId(rule, value, callback, GitignoreList, 'gitignore')
}], }],
@ -494,12 +484,19 @@ class Index extends Component {
</AutoComplete> </AutoComplete>
)} )}
</Form.Item> </Form.Item>
}
<Form.Item <Form.Item
label="开源许可证" className="privatePart"
> >
{getFieldDecorator('licenseFlag')(
<Checkbox checked={licenseFlag}>开源许可证</Checkbox>
)}
</Form.Item>
{ licenseFlag &&
<Form.Item>
{getFieldDecorator('license', { {getFieldDecorator('license', {
rules: [{ rules: [{
required: true, message: '请选择开源许可证' required: licenseFlag, message: '请选择开源许可证'
}, { }, {
validator: (rule, value, callback) => this.checkId(rule, value, callback, LicensesList, '开源许可证') validator: (rule, value, callback) => this.checkId(rule, value, callback, LicensesList, '开源许可证')
}], }],
@ -514,22 +511,19 @@ class Index extends Component {
</AutoComplete> </AutoComplete>
)} )}
</Form.Item> </Form.Item>
}
</React.Fragment> </React.Fragment>
} }
<Form.Item <Form.Item
label="可见性"
style={{ margin: "0px" }}
className="privatePart" className="privatePart"
> >
{getFieldDecorator('private')( {getFieldDecorator('private')(
<Checkbox value="limit">将项目设为私有<span className="ml15 font-13 color-grey-9">(只有项目所有人或拥有权限的项目成员才能看到)</span></Checkbox> <Checkbox value="limit">将项目设为私有<span className="font-13 color-grey-9">(只有项目所有人或拥有权限的项目成员才能看到)</span></Checkbox>
)} )}
</Form.Item > </Form.Item >
{ {
projectsType && projectsType === "mirror" && projectsType && projectsType === "mirror" &&
<Form.Item <Form.Item
label="迁移类型:"
style={{ margin: "0px" }}
className="privatePart" className="privatePart"
> >
{getFieldDecorator('is_mirror')( {getFieldDecorator('is_mirror')(
@ -537,7 +531,62 @@ class Index extends Component {
)} )}
</Form.Item > </Form.Item >
} }
<div> <Form.Item
style={{ margin: "0px" }}
className="privatePart"
>
{getFieldDecorator('categoreFlag')(
<Checkbox checked={categoreFlag}>项目类别</Checkbox>
)}
</Form.Item>
{categoreFlag &&
<Form.Item>
{getFieldDecorator('project_category', {
rules: [{
required: categoreFlag, message: '请选择大类别',
}, {
validator: (rule, value, callback) => this.checkId(rule, value, callback, CategoryList, '项目类别')
}],
})(
<AutoComplete
placeholder="请选择项目类别"
onChange={(value, e) => this.ChangePlatform(value, e, 'project_category', CategoryList)}
className="plateAutoComplete"
onBlur={(value) => this.blurCategory(value, CategoryList, "project_category")}
>
{project_category_list}
</AutoComplete>
)}
</Form.Item>
}
<Form.Item
className="privatePart"
>
{getFieldDecorator('languageFlag')(
<Checkbox checked={languageFlag} onChange={(e)=>this.setState({languageFlag:e.target.checked})}>项目语言</Checkbox>
)}
</Form.Item>
{languageFlag &&
<Form.Item>
{getFieldDecorator('project_language', {
rules: [{
required: languageFlag, message: '请选择项目语言'
}, {
validator: (rule, value, callback) => this.checkId(rule, value, callback, LanguageList, '项目语言')
}],
})(
<AutoComplete
placeholder="请选择项目语言"
onChange={(value, e) => this.ChangePlatform(value, e, 'project_language', LanguageList)}
className="plateAutoComplete"
onBlur={(value) => this.blurCategory(value, LanguageList, "project_language")}
>
{project_language_list}
</AutoComplete>
)}
</Form.Item>
}
<div className="mt20">
<span className="ant-form-item-required"></span> <span className="ant-form-item-required"></span>
</div> </div>
<Form.Item className="formTip mt20"> <Form.Item className="formTip mt20">

View File

@ -12,7 +12,13 @@
border-bottom: 1px solid #f0f0f0 border-bottom: 1px solid #f0f0f0
} }
.newPanel_content{ .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{ .newPanel_content .ant-form-item-control-wrapper{
flex: 1; flex: 1;
@ -25,7 +31,9 @@
height: 35px; height: 35px;
line-height: 35px; line-height: 35px;
} }
.newPanel_content .ant-form-explain{
position: absolute;
}
.newContent_inline{ .newContent_inline{
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
@ -36,13 +44,25 @@
.newContent_inline > .ant-form-item:nth-child(2){ .newContent_inline > .ant-form-item:nth-child(2){
margin-left: 20px; margin-left: 20px;
} }
.newPanel_content .privatePart .ant-form-item-label{ .privatePart{
margin-bottom: 0px!important;
.ant-form-item-control{
height: 28px;
line-height: 28px;
margin-top: 10px;
}
.ant-form-item-label{
margin-left: 0px; margin-left: 0px;
}
} }
.newPanel_content .ant-form-item-label{ .newPanel_content .ant-form-item-label{
line-height: 25px; line-height: 25px;
height: 25px; height: 25px;
margin-left: -0.8rem; }
.plateAutoComplete{
.ant-input{
height: 34px!important;
}
} }
@media screen and (max-width: 750px){ @media screen and (max-width: 750px){
.newPanel_content{ .newPanel_content{