forked from Gitlink/forgeplus-react
save
This commit is contained in:
parent
f0eae6d4db
commit
95c1d6a4f8
|
|
@ -1,21 +1,25 @@
|
|||
import React , { useState } from 'react';
|
||||
import { Form , Modal , Input, Button } from 'antd';
|
||||
import { Form , Input, Button } from 'antd';
|
||||
import ColorCard from './colorCard';
|
||||
import axios from 'axios';
|
||||
|
||||
function AddTagsBox({onSuccess , form ,owner , projectsId,onCancel}){
|
||||
const { getFieldDecorator , getFieldsValue } = form;
|
||||
const { getFieldDecorator , getFieldsValue , validateFields } = form;
|
||||
const [ colors , setColors ] = useState(undefined);
|
||||
const [ defaultColor , setDefaultColor ]= useState("#F17013");
|
||||
|
||||
function saveFunc(){
|
||||
const { desc , name } = getFieldsValue();
|
||||
const url = `/v1/${owner}/${projectsId}/issue_tags`;
|
||||
axios.post(url,{
|
||||
name,description:desc,color:colors || defaultColor
|
||||
}).then(result=>{
|
||||
result && onSuccess();
|
||||
}).catch(error=>{})
|
||||
validateFields((error,values)=>{
|
||||
if(!error){
|
||||
const { desc , name } = getFieldsValue();
|
||||
const url = `/v1/${owner}/${projectsId}/issue_tags`;
|
||||
axios.post(url,{
|
||||
name,description:desc,color:colors || defaultColor
|
||||
}).then(result=>{
|
||||
result && onSuccess();
|
||||
}).catch(error=>{})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getColor(colors){
|
||||
|
|
@ -25,26 +29,27 @@ function AddTagsBox({onSuccess , form ,owner , projectsId,onCancel}){
|
|||
return(
|
||||
<Form className="addTags_form" hideRequiredMark={true}>
|
||||
<p className="manageTitle" onClick={onCancel}><i className="iconfont icon-xiangzuojiantou font-15 color-grey mr5"/>标记管理</p>
|
||||
<Form.Item colon={false}>
|
||||
{getFieldDecorator('name',{
|
||||
rules:[
|
||||
{
|
||||
required:true,
|
||||
message:"请输入标记名称"
|
||||
}
|
||||
],
|
||||
validateTrigger:"onInput",
|
||||
})(<Input placeholder="标记名称15字以内" maxLength={15}/>)}
|
||||
</Form.Item>
|
||||
<div className="inline">
|
||||
<Form.Item colon={false} style={{flex:1,marginRight:'20px'}}>
|
||||
{getFieldDecorator('name',{
|
||||
rules:[
|
||||
{
|
||||
required:true,
|
||||
message:"请输入标记名称"
|
||||
}
|
||||
],
|
||||
validateTrigger:"onInput",
|
||||
})(<Input placeholder="标记名称15字以内" maxLength={15}/>)}
|
||||
</Form.Item>
|
||||
<Form.Item style={{marginTop:"7px"}}>
|
||||
<ColorCard getColor={getColor} defaultColor={defaultColor}/>
|
||||
</Form.Item>
|
||||
</div>
|
||||
<Form.Item colon={false}>
|
||||
{getFieldDecorator('desc',{rules:[],
|
||||
validateTrigger:"onInput",
|
||||
})(<Input placeholder="描述30字以内" maxLength={30}/>)}
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<ColorCard getColor={getColor}
|
||||
defaultColor={defaultColor}/>
|
||||
</Form.Item>
|
||||
<div style={{textAlign:'center'}}>
|
||||
<Button style={{width:"80px"}} onClick={onCancel}>取消</Button>
|
||||
<Button style={{width:"80px"}} className="ml20" type="primary" onClick={saveFunc}>确认</Button>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import React ,{ useState , useEffect , useRef } from 'react';
|
||||
import React ,{ useState , useEffect , useRef , forwardRef } from 'react';
|
||||
import { findDOMNode } from 'react-dom';
|
||||
import { Dropdown , Menu , Input , message, Button} from 'antd';
|
||||
import { Dropdown , Menu , Input , message, Button, Form } from 'antd';
|
||||
import { getImageUrl } from 'educoder';
|
||||
import AddTagsBox from './addTagsBox';
|
||||
|
||||
|
|
@ -191,7 +191,8 @@ function ChooseMenu({
|
|||
}
|
||||
|
||||
function onSuccess(){
|
||||
|
||||
setContent(false);
|
||||
onAdd();
|
||||
}
|
||||
return(
|
||||
<li>
|
||||
|
|
@ -295,4 +296,4 @@ function ChooseMenu({
|
|||
</li>
|
||||
)
|
||||
}
|
||||
export default ChooseMenu;
|
||||
export default Form.create()(forwardRef(ChooseMenu));
|
||||
|
|
@ -448,7 +448,7 @@ function Details(props){
|
|||
colorFlag="2"
|
||||
removeFlag
|
||||
editFlag={details && !details.user_permission}
|
||||
onAdd={permission && permission !== "Reporter" ? ()=>setVisible(true) :false}
|
||||
onAdd={permission && permission !== "Reporter" ? ()=>{setVisible(true);getSign();} :false}
|
||||
owner
|
||||
projectsId
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -227,12 +227,12 @@ function New(props){
|
|||
}
|
||||
return(
|
||||
<div>
|
||||
<AddTagsBox
|
||||
{/* <AddTagsBox
|
||||
owner={owner}
|
||||
projectsId={projectsId}
|
||||
visible={visible}
|
||||
onCancel={()=>setVisible(false)} onSuccess={onSuccess}
|
||||
/>
|
||||
/> */}
|
||||
<p className="font-17 color-grey-3 mt20 mb15">新建疑修</p>
|
||||
<Box>
|
||||
<LongWidth>
|
||||
|
|
@ -275,7 +275,9 @@ function New(props){
|
|||
double={3}
|
||||
colorFlag="2"
|
||||
removeFlag
|
||||
onAdd={permission && permission !== "Reporter" ? ()=>setVisible(true) :false}
|
||||
onAdd={permission && permission !== "Reporter" ? ()=>{setVisible(true);getSign();} :false}
|
||||
owner={owner}
|
||||
projectsId={projectsId}
|
||||
/>
|
||||
<ChooseMenu
|
||||
placeholder="里程碑"
|
||||
|
|
|
|||
|
|
@ -530,6 +530,10 @@
|
|||
font-size:16px;
|
||||
border-bottom:1px solid #e1e3e8;
|
||||
}
|
||||
.inline{
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
}
|
||||
}
|
||||
.addTagsModal{
|
||||
.ant-modal-content{
|
||||
|
|
|
|||
Loading…
Reference in New Issue