forked from Gitlink/forgeplus-react
Merge branch 'gitlink_server_issue' of http://106.75.45.236:3000/Gitlink/forgeplus-react into gitlink_server_issue
This commit is contained in:
commit
2f0aaccc41
|
|
@ -1,4 +1,4 @@
|
|||
import React , { useState } from 'react';
|
||||
import React , { useState , useEffect } from 'react';
|
||||
import { Form , Input, Button } from 'antd';
|
||||
import ColorCard from './colorCard';
|
||||
import axios from 'axios';
|
||||
|
|
@ -6,7 +6,12 @@ import axios from 'axios';
|
|||
function AddTagsBox({onSuccess , form ,owner , projectsId,onCancel}){
|
||||
const { getFieldDecorator , getFieldsValue , validateFields } = form;
|
||||
const [ colors , setColors ] = useState(undefined);
|
||||
const [ defaultColor , setDefaultColor ]= useState("#F17013");
|
||||
const [ defaultColor , setDefaultColor ]= useState(undefined);
|
||||
|
||||
useEffect(()=>{
|
||||
const c = Math.random().toString(16).substr(-6);
|
||||
c && setDefaultColor(`#${c}`);
|
||||
},[])
|
||||
|
||||
function saveFunc(){
|
||||
validateFields((error,values)=>{
|
||||
|
|
@ -51,7 +56,7 @@ function AddTagsBox({onSuccess , form ,owner , projectsId,onCancel}){
|
|||
})(<Input placeholder="描述30字以内" maxLength={30}/>)}
|
||||
</Form.Item>
|
||||
<div style={{textAlign:'center'}}>
|
||||
<Button style={{width:"80px"}} onClick={onCancel}>取消</Button>
|
||||
<Button style={{width:"80px"}} className="cancelTags" onClick={onCancel}>取消</Button>
|
||||
<Button style={{width:"80px"}} className="ml20" type="primary" onClick={saveFunc}>确认</Button>
|
||||
</div>
|
||||
</Form>
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ function ChooseMenu({
|
|||
if (faComponent && boxComponent) {
|
||||
const isChild = faComponent.contains(target);
|
||||
const isBox = boxComponent.contains(target);
|
||||
const arr = ["removeicon","iconfont icon-guanbi font-12 color-white","iconfont icon-guanbi font-12 color-blue","icon-a-bianji12","color-blue font-15 tagManage","iconfont icon-xiangzuojiantou font-15 color-grey mr5 cursor","cover"];
|
||||
const arr = ["removeicon","iconfont icon-guanbi font-12 color-white","iconfont icon-guanbi font-12 color-blue","icon-a-bianji12","color-blue font-15 tagManage","iconfont icon-xiangzuojiantou font-15 color-grey mr5 cursor","cover","ant-btn cancelTags"];
|
||||
const pointer = arr.includes(target.className);
|
||||
if(!isChild && !isBox && !pointer){
|
||||
setVisible(false);
|
||||
|
|
|
|||
|
|
@ -3,16 +3,17 @@ import { SketchPicker } from 'react-color';
|
|||
|
||||
function ColorCard({getColor,defaultColor}){
|
||||
const [ displayColorPicker , setDisplayColorPicker ] = useState(false);
|
||||
const [ color , setColor ] = useState({r: '241',g: '112',b: '19',a: '1',});
|
||||
const [ textcolor , setTextColor ] = useState("#F17013");
|
||||
|
||||
|
||||
useEffect(()=>{
|
||||
defaultColor && setTextColor(defaultColor);
|
||||
if(defaultColor){
|
||||
setTextColor(defaultColor);
|
||||
}
|
||||
},[defaultColor])
|
||||
|
||||
// 切换色卡
|
||||
function handleChange(color){
|
||||
setColor(color.rgb);
|
||||
setTextColor(color.hex);
|
||||
getColor(color ? color.hex : defaultColor);
|
||||
}
|
||||
|
|
@ -26,7 +27,7 @@ function ColorCard({getColor,defaultColor}){
|
|||
// 还原色卡
|
||||
function reduction(){
|
||||
setTextColor("#F17013");
|
||||
setColor({r: '241',g: '112',b: '19',a: '1',});
|
||||
// setColor({r: '241',g: '112',b: '19',a: '1',});
|
||||
}
|
||||
return(
|
||||
<div>
|
||||
|
|
@ -37,7 +38,7 @@ function ColorCard({getColor,defaultColor}){
|
|||
{displayColorPicker ? (
|
||||
<div className="popover">
|
||||
<div className="cover" onClick={()=>{setDisplayColorPicker(false)}} />
|
||||
<SketchPicker color={color} onChange={handleChange} />
|
||||
<SketchPicker color={textcolor} onChange={handleChange} />
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ function Sign(props){
|
|||
const [ order_name , setOrderName ] = useState(undefined);
|
||||
const [ order_type , setOrderType ] = useState(undefined);
|
||||
const [ nameFlag , setNameFlag ] = useState(undefined);
|
||||
const [ defaultColor , setDefaultColor ]= useState("#F17013");
|
||||
const [ defaultColor , setDefaultColor ]= useState(undefined);
|
||||
|
||||
const [ arrayName , setArrayName ] = useState("标记");
|
||||
const [ key , setKey ] = useState("0");
|
||||
|
|
@ -183,6 +183,12 @@ function Sign(props){
|
|||
setNameFlag(true);
|
||||
}
|
||||
}
|
||||
|
||||
function createSign(){
|
||||
const c = Math.random().toString(16).substr(-6);
|
||||
c && setDefaultColor(`#${c}`);
|
||||
setEdit(true);
|
||||
}
|
||||
return(
|
||||
<div>
|
||||
<DelBox
|
||||
|
|
@ -194,7 +200,7 @@ function Sign(props){
|
|||
/>
|
||||
<div className="between mt30 mb25">
|
||||
<span><Link to={`/${owner}/${projectsId}/issues`}>疑修</Link> / 项目标记</span>
|
||||
<a className="operateButton" onClick={()=>setEdit(true)}><img src={create} alt="" className="mr5"/>创建标记</a>
|
||||
<a className="operateButton" onClick={createSign}><img src={create} alt="" className="mr5"/>创建标记</a>
|
||||
</div>
|
||||
{
|
||||
edit &&
|
||||
|
|
|
|||
Loading…
Reference in New Issue