import React , { Component } from "react"; import { Form , Input , Select,Divider,Button,Checkbox,Dropdown,Menu} from 'antd'; import {Link} from 'react-router-dom'; import UploadComponent from '../Upload/Index'; import '../Order/order.css'; import './version.css'; import axios from 'axios'; const Option = Select.Option; const TextArea = Input.TextArea; class NewVersion extends Component{ constructor(props){ super(props); this.state={ branch_name:"", issue_tag_ids:"", fixed_version_id:"", issue_chosen:undefined, fileList:undefined, ischeck:undefined, branches:undefined, pull:undefined, tag_name:'', } } componentDidMount=()=>{ this.InitData(); this.getSelectList(); } InitData=()=>{ this.props.form.setFieldsValue({ ...this.state }); } getSelectList=()=>{ const { projectsId } = this.props.match.params; const url = `/projects/${projectsId}/version_releases/new.json`; axios.get(url).then((result)=>{ if(result){ this.setState({ branches:result.data.branches, pull:result.data.branches[0] }) } }).catch((error)=>{ console.log(error); }) } renderSelect=(list)=>{ if(list && list.length >0){ return( list.map((item,key)=>{ return( ) }) ) } } // 创建 handleSubmit=(draft)=>{ this.props.form.validateFieldsAndScroll((err, values) => { if(!err){ const { projectsId } = this.props.match.params; const { pull,tag_name,ischeck,fileList} = this.state; const url = `/projects/${projectsId}/version_releases.json`; // if(values.issue_type==="普通"){ // values.issue_type="1" // } axios.post(url,{ ...values, tag_name:tag_name, draft:draft, prerelease:ischeck, target_commitish:pull, }).then(result=>{ if(result){ this.props.history.push(`/projects/${projectsId}/version`); } }).catch(error=>{ console.log(error); }) } }) } // 获取上传后的文件id数组 UploadFunc=(fileList)=>{ this.setState({ fileList }) } RedieonChange=(e)=>{ this.setState({ ischeck:e.target.checked }) } Preservation=()=>{ alert(this.state.ischeck) } renderMenu =(array,id)=>{ return( { array && array.length > 0 && array.map((item,key)=>{ return( this.getOption(item)}>{item} ) }) } ) } getOption=(name)=>{ this.setState({ pull:name }) } changmodelname=(e)=>{ this.setState({ tag_name:e.target.value }) } render(){ const { getFieldDecorator } = this.props.form; const { current_user } = this.props; const {branches,pull,tag_name} = this.state; return(

发布新版

版本发布组织项目的版本。
@

标题

{getFieldDecorator('name', { rules: [{ required: true, message: '请输入标题' }], })( )}

内容

{getFieldDecorator('body', { rules: [{ required: true, message: '请输入描述内容' }], })(