|
|
|
@ -8,20 +8,34 @@ class Setting extends Component{
|
|
|
|
|
constructor(props){
|
|
|
|
|
super(props);
|
|
|
|
|
this.state={
|
|
|
|
|
preType:"1",
|
|
|
|
|
CategoryList:undefined
|
|
|
|
|
Language:"1",
|
|
|
|
|
Category:"1",
|
|
|
|
|
CategoryList:undefined,
|
|
|
|
|
LanguageList:undefined,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidMount=()=>{
|
|
|
|
|
this.getCategory();
|
|
|
|
|
this.getLanguage();
|
|
|
|
|
this.getInfo();
|
|
|
|
|
}
|
|
|
|
|
getLanguage=()=>{
|
|
|
|
|
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)=>{})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getInfo=()=>{
|
|
|
|
|
const { current_user } = this.props;
|
|
|
|
|
const { projectsId } = this.props.match.params;
|
|
|
|
|
const url = `/${current_user.login}/${projectsId}.json`;
|
|
|
|
|
const url = `/${current_user.login}/${projectsId}/edit.json`;
|
|
|
|
|
axios.get(url).then(result=>{
|
|
|
|
|
if(result){
|
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
@ -50,7 +64,7 @@ class Setting extends Component{
|
|
|
|
|
if(data && data.length > 0){
|
|
|
|
|
list = data.map((item,key)=>{
|
|
|
|
|
return(
|
|
|
|
|
<Option key={item.id}>{item.name}</Option>
|
|
|
|
|
<Option key={item.id} value={item.id}>{item.name}</Option>
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
@ -64,6 +78,8 @@ class Setting extends Component{
|
|
|
|
|
const { projectsId } = this.props.match.params;
|
|
|
|
|
const url = `/projects/${projectsId}.json`;
|
|
|
|
|
axios.patch(url,{
|
|
|
|
|
name:values.project_name,
|
|
|
|
|
description:values.project_description,
|
|
|
|
|
...values
|
|
|
|
|
}).then(result=>{
|
|
|
|
|
if(result){
|
|
|
|
@ -79,7 +95,7 @@ class Setting extends Component{
|
|
|
|
|
render(){
|
|
|
|
|
const { getFieldDecorator } = this.props.form;
|
|
|
|
|
|
|
|
|
|
const { preType , CategoryList } = this.state;
|
|
|
|
|
const { Category , Language , CategoryList , LanguageList } = this.state;
|
|
|
|
|
return(
|
|
|
|
|
<div className="normalBox">
|
|
|
|
|
<div className="normalBox-title font-16">
|
|
|
|
@ -89,7 +105,7 @@ class Setting extends Component{
|
|
|
|
|
<Form.Item
|
|
|
|
|
label="项目名称"
|
|
|
|
|
>
|
|
|
|
|
{getFieldDecorator('name', {
|
|
|
|
|
{getFieldDecorator('project_name', {
|
|
|
|
|
rules: [{
|
|
|
|
|
required: true, message: '请输入项目名称'
|
|
|
|
|
}],
|
|
|
|
@ -105,14 +121,14 @@ class Setting extends Component{
|
|
|
|
|
{getFieldDecorator('private', {
|
|
|
|
|
rules: [],
|
|
|
|
|
})(
|
|
|
|
|
<Checkbox value="private">将仓库设为私有</Checkbox>
|
|
|
|
|
<Checkbox >将仓库设为私有</Checkbox>
|
|
|
|
|
)}
|
|
|
|
|
</Form.Item >
|
|
|
|
|
</div>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label="仓库描述"
|
|
|
|
|
>
|
|
|
|
|
{getFieldDecorator('description', {
|
|
|
|
|
{getFieldDecorator('project_description', {
|
|
|
|
|
rules: [],
|
|
|
|
|
})(
|
|
|
|
|
<TextArea placeholder="请输入仓库描述" style={{height:"80px"}}/>
|
|
|
|
@ -126,11 +142,24 @@ class Setting extends Component{
|
|
|
|
|
required: true, message: '请选择大类别'
|
|
|
|
|
}],
|
|
|
|
|
})(
|
|
|
|
|
<Select value={preType}>
|
|
|
|
|
<Select>
|
|
|
|
|
{CategoryList}
|
|
|
|
|
</Select>
|
|
|
|
|
)}
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label="项目语言"
|
|
|
|
|
>
|
|
|
|
|
{getFieldDecorator('project_language_id', {
|
|
|
|
|
rules: [{
|
|
|
|
|
required: true, message: '请选择项目语言'
|
|
|
|
|
}],
|
|
|
|
|
})(
|
|
|
|
|
<Select>
|
|
|
|
|
{LanguageList}
|
|
|
|
|
</Select>
|
|
|
|
|
)}
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<p className="clearfix">
|
|
|
|
|
<a className="submitBtn" onClick={this.resetSetting}>更新仓库设置</a>
|
|
|
|
|
</p>
|
|
|
|
|