|
|
|
@ -13,13 +13,15 @@ class Index extends Component{
|
|
|
|
|
this.state={
|
|
|
|
|
// authorValue:"0",
|
|
|
|
|
preType:"0",
|
|
|
|
|
subType:"0",
|
|
|
|
|
// subType:"0",
|
|
|
|
|
languageValue:"0",
|
|
|
|
|
gitignoreType:"0",
|
|
|
|
|
openSourceType:"0",
|
|
|
|
|
LicensesType:"0",
|
|
|
|
|
|
|
|
|
|
CategoryList:undefined,
|
|
|
|
|
LanguageList:undefined
|
|
|
|
|
LanguageList:undefined,
|
|
|
|
|
GitignoreList:undefined,
|
|
|
|
|
LicensesList:undefined,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
componentDidMount=()=>{
|
|
|
|
@ -27,32 +29,79 @@ class Index extends Component{
|
|
|
|
|
this.getCategory();
|
|
|
|
|
// 获取项目语言
|
|
|
|
|
this.getLanguage();
|
|
|
|
|
// 获取Gitignore
|
|
|
|
|
this.getGitignore();
|
|
|
|
|
// 获取开源许可证
|
|
|
|
|
this.getLicenses();
|
|
|
|
|
}
|
|
|
|
|
getCategory=()=>{
|
|
|
|
|
const url = `/project_categories`
|
|
|
|
|
const url = `/project_categories.json`
|
|
|
|
|
axios.get(url).then((result)=>{
|
|
|
|
|
if(result){
|
|
|
|
|
|
|
|
|
|
let CategoryList = this.setOptionsList(result.data.project_categories)
|
|
|
|
|
this.setState({
|
|
|
|
|
CategoryList
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}).catch((error)=>{})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getLanguage=()=>{
|
|
|
|
|
const url = `/project_languages`
|
|
|
|
|
const url = `/project_languages.json`
|
|
|
|
|
axios.get(url).then((result)=>{
|
|
|
|
|
if(result){
|
|
|
|
|
let LanguageList = this.setOptionsList(result.data.project_languages)
|
|
|
|
|
this.setState({
|
|
|
|
|
LanguageList
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}).catch((error)=>{})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getGitignore=()=>{
|
|
|
|
|
const url = `/ignores.json`
|
|
|
|
|
axios.get(url).then((result)=>{
|
|
|
|
|
if(result){
|
|
|
|
|
let GitignoreList = this.setOptionsList(result.data.ignores)
|
|
|
|
|
this.setState({
|
|
|
|
|
GitignoreList
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}).catch((error)=>{})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getLicenses=()=>{
|
|
|
|
|
const url = `/licenses.json`
|
|
|
|
|
axios.get(url).then((result)=>{
|
|
|
|
|
if(result){
|
|
|
|
|
let LicensesList = this.setOptionsList(result.data.licenses)
|
|
|
|
|
this.setState({
|
|
|
|
|
LicensesList
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}).catch((error)=>{})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setOptionsList = (data) =>{
|
|
|
|
|
let list = undefined;
|
|
|
|
|
if(data && data.length > 0){
|
|
|
|
|
list = data.map((item,key)=>{
|
|
|
|
|
return(
|
|
|
|
|
<Option key={item.id}>{item.name}</Option>
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
subMitFrom = () =>{
|
|
|
|
|
this.props.form.validateFieldsAndScroll((err, values) => {
|
|
|
|
|
if(!err){
|
|
|
|
|
const url = `/projects`;
|
|
|
|
|
console.log(values)
|
|
|
|
|
const url = `/projects.json`;
|
|
|
|
|
axios.post(url,{
|
|
|
|
|
values,
|
|
|
|
|
user_id:'50207'
|
|
|
|
|
...values,
|
|
|
|
|
user_id:50207
|
|
|
|
|
}).then((result)=>{
|
|
|
|
|
if(result){
|
|
|
|
|
|
|
|
|
@ -70,10 +119,15 @@ class Index extends Component{
|
|
|
|
|
const {
|
|
|
|
|
// authorValue,
|
|
|
|
|
preType,
|
|
|
|
|
subType,
|
|
|
|
|
// subType,
|
|
|
|
|
languageValue,
|
|
|
|
|
gitignoreType,
|
|
|
|
|
openSourceType
|
|
|
|
|
LicensesType,
|
|
|
|
|
|
|
|
|
|
CategoryList,
|
|
|
|
|
LanguageList,
|
|
|
|
|
GitignoreList,
|
|
|
|
|
LicensesList
|
|
|
|
|
}=this.state;
|
|
|
|
|
return(
|
|
|
|
|
<div className="main">
|
|
|
|
@ -129,7 +183,7 @@ class Index extends Component{
|
|
|
|
|
)}
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<p className="formTip">好的存储库名称使用简单、深刻和独特的关键字</p>
|
|
|
|
|
<div className="newContent_inline">
|
|
|
|
|
{/* <div className="newContent_inline"> */}
|
|
|
|
|
<Form.Item
|
|
|
|
|
label="项目类别"
|
|
|
|
|
>
|
|
|
|
@ -138,13 +192,12 @@ class Index extends Component{
|
|
|
|
|
required: true, message: '请选择大类别'
|
|
|
|
|
}],
|
|
|
|
|
})(
|
|
|
|
|
<Select value={preType} className="inline_Tag">
|
|
|
|
|
<Option key="0">HTMl</Option>
|
|
|
|
|
<Option key="1">HTMl111</Option>
|
|
|
|
|
<Select value={preType}>
|
|
|
|
|
{CategoryList}
|
|
|
|
|
</Select>
|
|
|
|
|
)}
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item>
|
|
|
|
|
{/* <Form.Item>
|
|
|
|
|
{getFieldDecorator('project_language_id', {
|
|
|
|
|
rules: [{
|
|
|
|
|
required: true, message: '请选择子类别'
|
|
|
|
@ -155,8 +208,8 @@ class Index extends Component{
|
|
|
|
|
<Option key="1">HTMl111</Option>
|
|
|
|
|
</Select>
|
|
|
|
|
)}
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</div>
|
|
|
|
|
</Form.Item> */}
|
|
|
|
|
{/* </div> */}
|
|
|
|
|
<Form.Item
|
|
|
|
|
label="项目语言"
|
|
|
|
|
>
|
|
|
|
@ -166,7 +219,7 @@ class Index extends Component{
|
|
|
|
|
}],
|
|
|
|
|
})(
|
|
|
|
|
<Select value={languageValue}>
|
|
|
|
|
<Option key="0">JAVA</Option>
|
|
|
|
|
{LanguageList}
|
|
|
|
|
</Select>
|
|
|
|
|
)}
|
|
|
|
|
</Form.Item>
|
|
|
|
@ -177,7 +230,7 @@ class Index extends Component{
|
|
|
|
|
>
|
|
|
|
|
{getFieldDecorator('ignore_id')(
|
|
|
|
|
<Select value={gitignoreType} className="inline_Tag">
|
|
|
|
|
<Option key="0">选择.gitignore模板</Option>
|
|
|
|
|
{GitignoreList}
|
|
|
|
|
</Select>
|
|
|
|
|
)}
|
|
|
|
|
</Form.Item>
|
|
|
|
@ -185,8 +238,8 @@ class Index extends Component{
|
|
|
|
|
label="开源许可证"
|
|
|
|
|
>
|
|
|
|
|
{getFieldDecorator('license_id')(
|
|
|
|
|
<Select value={openSourceType} className="inline_Tag">
|
|
|
|
|
<Option key="0">选择开源信息模板</Option>
|
|
|
|
|
<Select value={LicensesType} className="inline_Tag">
|
|
|
|
|
{LicensesList}
|
|
|
|
|
</Select>
|
|
|
|
|
)}
|
|
|
|
|
</Form.Item>
|
|
|
|
|