save cookie
This commit is contained in:
parent
91cc185cb4
commit
ea09ca58aa
|
|
@ -7,7 +7,6 @@ function ColorCard({getColor,defaultColor}){
|
|||
const [ textcolor , setTextColor ] = useState("#F17013");
|
||||
|
||||
useEffect(()=>{
|
||||
console.log(defaultColor);
|
||||
defaultColor && setTextColor(defaultColor);
|
||||
},[defaultColor])
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import Copy from '../Component/copy';
|
|||
function Datas({checkbox ,item , projectsId,owner}){
|
||||
let host = window.location.hostname === "localhost" ? "testforgeplus.trustie.net" : window.location.hostname;
|
||||
let protocol = window.location.protocol;
|
||||
console.log("protocol:",protocol);
|
||||
function statusTag(name){
|
||||
switch (name) {
|
||||
case "低":
|
||||
|
|
|
|||
|
|
@ -0,0 +1,172 @@
|
|||
import React ,{ useState , useEffect , useRef } from 'react';
|
||||
import { findDOMNode } from 'react-dom';
|
||||
import { Dropdown , Menu , Input , message} from 'antd';
|
||||
import { getImageUrl } from 'educoder';
|
||||
|
||||
const { Search } = Input;
|
||||
/**
|
||||
*
|
||||
* @param {placeholder} placeholder:默认显示内容(为空时)
|
||||
* @param {editFlag} editFlag:是否显示编辑按钮
|
||||
* @param {searchFlag} editFlag:是否显示搜索框
|
||||
* @param {selectValueList} selectValueList:将选中的list保存
|
||||
* @param {searchFunc} searchFunc:搜索方法
|
||||
* @param {onAdd} onAdd:标记管理
|
||||
* @param {headImg} headImg:是否显示头像
|
||||
* @param {menus} menus:下拉列表
|
||||
* @param {chooseFunc} chooseFunc:选择下拉列表
|
||||
* @param {double} double:undefined为单选,有值就是最多选的数量
|
||||
* @returns
|
||||
*/
|
||||
function DropMenu({
|
||||
placeholder ="未设置",
|
||||
editFlag,
|
||||
searchFlag,
|
||||
selectValueList,
|
||||
searchFunc,
|
||||
onAdd,
|
||||
headImg,
|
||||
menus,
|
||||
chooseFunc,double
|
||||
}){
|
||||
const [ visible , setVisible ] = useState(false);
|
||||
const [ searchValue , setSearchValue ]= useState(undefined);
|
||||
const [ valuesId , setValuesId ] = useState([]);
|
||||
const [ valuesName , setValuesName ] = useState([]);
|
||||
|
||||
const refFa = useRef(null);
|
||||
const refBox = useRef(null);
|
||||
|
||||
// 根据选中的列表循环出id数组
|
||||
useEffect(()=>{
|
||||
if(selectValueList && selectValueList.length > 0 ){
|
||||
renderSelectList(selectValueList);
|
||||
}else{
|
||||
setValuesId([])
|
||||
}
|
||||
},[selectValueList])
|
||||
|
||||
function renderSelectList(list){
|
||||
console.log(list);
|
||||
let a = list.map((i,k)=>{
|
||||
return i.id.toString() || i.name
|
||||
})
|
||||
let n = list.map((i,k)=>{
|
||||
return i.name
|
||||
})
|
||||
console.log("根据选中的列表循环出id数组:",a);
|
||||
setValuesId(a);
|
||||
setValuesName(n);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
document.addEventListener('click', clickMe , false);
|
||||
}, [])
|
||||
|
||||
const clickMe = ({ target }) => {
|
||||
// 查找父组件
|
||||
const faComponent = findDOMNode(refFa.current);
|
||||
const boxComponent = findDOMNode(refBox.current);
|
||||
if (faComponent && boxComponent) {
|
||||
const isChild = faComponent.contains(target);
|
||||
const isBox = boxComponent.contains(target);
|
||||
if(!isChild && !isBox){
|
||||
setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 搜索
|
||||
function changeSearchvalue(e){
|
||||
setSearchValue(e.target.value);
|
||||
searchFunc(e.target.value);
|
||||
}
|
||||
|
||||
function chooseMenu(i){
|
||||
let list = selectValueList;
|
||||
let re = [];
|
||||
re = list && list.length > 0 ? list:[];
|
||||
let filter = list.filter(j=>j.id === i.id);
|
||||
|
||||
if(filter && filter.length > 0){
|
||||
re = list.filter(j=>j.id !== i.id) ;
|
||||
}else{
|
||||
if(double && (selectValueList && selectValueList.length >= double)){
|
||||
message.info(`最多只能添加${double}个${placeholder}`);
|
||||
return;
|
||||
}
|
||||
re.push(i);
|
||||
}
|
||||
console.log("选择后:",re);
|
||||
renderSelectList(re);
|
||||
chooseFunc(re);
|
||||
}
|
||||
|
||||
function renderNames(nameArrs){
|
||||
return <React.Fragment>
|
||||
{
|
||||
nameArrs && nameArrs.length>0?
|
||||
nameArrs.map((i,k)=>{
|
||||
return(
|
||||
<p className="task-hide">{i}</p>
|
||||
)
|
||||
})
|
||||
:""
|
||||
}
|
||||
</React.Fragment>
|
||||
}
|
||||
return(
|
||||
<li>
|
||||
<span>
|
||||
{placeholder}
|
||||
{!editFlag &&
|
||||
<a ref={refBox} onClick={()=>setVisible(visible ? false : true)}>
|
||||
<i className="iconfont icon-a-bianji12 font-13" style={{color:"#898d9d"}}></i>
|
||||
</a>
|
||||
}
|
||||
</span>
|
||||
<Dropdown
|
||||
visible={visible}
|
||||
overlayClassName={"overlayStyle"}
|
||||
placement="bottomLeft"
|
||||
trigger={['click']}
|
||||
overlay={
|
||||
<div ref={refFa}>
|
||||
{ searchFunc &&
|
||||
<div className="searchbox">
|
||||
<Search
|
||||
placeholder={`搜索${placeholder}`}
|
||||
value={searchValue}
|
||||
onChange={changeSearchvalue}
|
||||
style={{marginRight:"18px"}}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
{
|
||||
menus && menus.length >0?
|
||||
<Menu className="piecemenu" selectedKeys={valuesId}>
|
||||
{
|
||||
menus.map((i,k)=>{
|
||||
return(
|
||||
<Menu.Item key={i.id || i.name} onClick={()=>chooseMenu(i)}>
|
||||
{ headImg && <img src={getImageUrl(i.image_url)} alt="" width="22px" className="mr5 radius"/>}
|
||||
{i.color && <span style={{backgroundColor:i.color}} className="colorpiece"></span>}
|
||||
<span className="task-hide">{i.name}</span>
|
||||
</Menu.Item>
|
||||
)
|
||||
})
|
||||
}
|
||||
</Menu>
|
||||
:
|
||||
<div className="menusEmpty">
|
||||
<p>{searchValue ? <span>暂无{placeholder}“{searchValue}”</span>: `暂无${placeholder}`}</p>
|
||||
{ onAdd && <a className="color-blue font-15" onClick={()=>{setVisible(false);onAdd()}}><i className="iconfont icon-a-bianji12 font-14 mr5"></i>标记管理</a>}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}>
|
||||
<div className={selectValueList && selectValueList.length > 0 ? "operatevalue color-grey-3":"operatevalue"}>{renderNames(valuesName) || placeholder}</div>
|
||||
</Dropdown>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
export default DropMenu;
|
||||
|
|
@ -110,6 +110,20 @@ function EditMenus({
|
|||
searchFunc(e.target.value);
|
||||
}
|
||||
|
||||
function renderNames(nameArrs){
|
||||
return <React.Fragment>
|
||||
{
|
||||
nameArrs && nameArrs.length>0?
|
||||
nameArrs.map((i,k)=>{
|
||||
return(
|
||||
<p className="task-hide">{i}</p>
|
||||
)
|
||||
})
|
||||
:""
|
||||
}
|
||||
</React.Fragment>
|
||||
}
|
||||
|
||||
|
||||
return(
|
||||
<li>
|
||||
|
|
@ -157,7 +171,7 @@ function EditMenus({
|
|||
}
|
||||
</div>
|
||||
}>
|
||||
<p className={showValue?"operatevalue color-grey-3 task-hide":"operatevalue task-hide"}>{ (names && names.join(",")) || emptyName}</p>
|
||||
<div className={showValue?"operatevalue color-grey-3":"operatevalue"}>{ names ? renderNames(names) : emptyName}</div>
|
||||
</Dropdown>
|
||||
</li>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ function NewPanel(props,ref){
|
|||
if(list && list.length>0 ){
|
||||
arr = list.filter(i=>i.id !== id);
|
||||
}
|
||||
console.log(arr.map(i=>{return i.id}));
|
||||
setFileList(arr.map(i=>{return i.id}));
|
||||
}
|
||||
|
||||
|
|
@ -56,7 +55,6 @@ function NewPanel(props,ref){
|
|||
function sureFunc(){
|
||||
validateFields((error,values)=>{
|
||||
if (!error) {
|
||||
console.log(fileList);
|
||||
createFunc(values,fileList,receivers_login,description);
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { Link } from 'react-router-dom';
|
|||
import { Box , LongWidth } from '../../Component/layout';
|
||||
import RenderHtml from "../../../components/render-html";
|
||||
import EditMenus from '../Component/editMenus';
|
||||
import DropMenu from '../Component/dropMenu';
|
||||
import Add from '../Component/comments/add';
|
||||
import NewPanel from '../Component/newPanel';
|
||||
import Attachments from "../../Upload/attachment";
|
||||
|
|
@ -48,6 +49,8 @@ function Details(props){
|
|||
|
||||
const [ start_date, setStartDate ] = useState("");
|
||||
const [ due_date, setDueDate ] = useState("");
|
||||
|
||||
const [ assigner_choose , setAssigner_choose ] = useState([]);
|
||||
const pathname = props.history.location.pathname;
|
||||
|
||||
useEffect(()=>{
|
||||
|
|
@ -72,6 +75,9 @@ function Details(props){
|
|||
if(result && result.data){
|
||||
let data = result.data;
|
||||
setDetails(data);
|
||||
|
||||
setAssigner_choose(data.assigners);
|
||||
|
||||
let cIds = data.assigners && data.assigners.length>0 ? data.assigners.map((i)=>{return i.id.toString();}):undefined;
|
||||
let cNames = data.assigners && data.assigners.length>0 ? data.assigners.map((i)=>{return i.name.toString();}):undefined;
|
||||
setCharegeId(cIds);
|
||||
|
|
@ -84,10 +90,10 @@ function Details(props){
|
|||
setBranchId(data.branch_name && [data.branch_name]);
|
||||
const n = {
|
||||
issue_priorities_name:data.priority ? [`${data.priority.name}`]:undefined,
|
||||
issue_tag_name:tagNames && [tagNames],
|
||||
issue_tag_name:tagNames,
|
||||
milestone_name:data.milestone ? [`${data.milestone.name}`]:undefined,
|
||||
status_name:data.status ? [`${data.status.name}`]:undefined,
|
||||
assigner_name:cNames && [cNames]
|
||||
assigner_name:cNames
|
||||
}
|
||||
setNames(n);
|
||||
data.start_date && setStartDate(moment(data.start_date).format('YYYY-MM-DD'));
|
||||
|
|
@ -265,7 +271,6 @@ function Details(props){
|
|||
}).catch(error=>{})
|
||||
}else{
|
||||
// 调用新建保存接口
|
||||
console.log(branchId,statusId,prioritiesId,millstoneId,tagId, charegeId);
|
||||
const url = `/v1/${owner}/${projectsId}/issues`;
|
||||
axios.post(url,{
|
||||
...params,
|
||||
|
|
@ -374,6 +379,16 @@ function Details(props){
|
|||
</div> */}
|
||||
</LongWidth>
|
||||
<div className="shortwidth mt25">
|
||||
{/* <DropMenu
|
||||
placeholder="负责人"
|
||||
menus={chargeList}
|
||||
searchFunc={(value)=>{setCharge(value)}}
|
||||
headImg
|
||||
selectValueList={assigner_choose}
|
||||
chooseFunc={(list)=>{setAssigner_choose(list)}}
|
||||
double={5}
|
||||
/> */}
|
||||
|
||||
<EditMenus name="负责人" names={names && names.assigner_name} imgFlag onChange={(ids,name)=>{saveForeach(ids);let copyname = { ...names,assigner_name:name};setNames(copyname);setCharegeId(ids);}} list={chargeList} value={charegeId} searchFlag searchFunc={(value)=>{setCharge(value)}} double={5} editFlag={details && !details.user_permission}/>
|
||||
<EditMenus name="状态" names={names && names.status_name} onChange={(ids,name)=>{setStatusId(ids);saveForeach(undefined,ids);let copyname = { ...names,status_name:name};setNames(copyname);}} list={statusList} value={statusId} editFlag={details && !details.user_permission}/>
|
||||
<EditMenus name="优先级" names={names && names.issue_priorities_name} onChange={(ids,name)=>{setPrioritiesId(ids);saveForeach(undefined,undefined,ids);let copyname = { ...names,issue_priorities_name:name};setNames(copyname);}} list={prioritiesList} value={prioritiesId} editFlag={details && !details.user_permission}/>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import issueEmp from '../Img/issue-big.png';
|
|||
import create from '../Img/create.png';
|
||||
import { Link } from "react-router-dom";
|
||||
import AllMenus from '../Component/allMenus';
|
||||
import CheckProfile from '../../Component/ProfileModal/Profile'
|
||||
import Datas from '../Component/datas';
|
||||
import DelBox from '../Component/delBox';
|
||||
import axios from 'axios';
|
||||
|
|
@ -118,18 +119,17 @@ function List(props){
|
|||
// 获取issue列表数据
|
||||
function Init(params,p,names){
|
||||
const url = `/v1/${owner}/${projectsId}/issues`;
|
||||
let getParams ={
|
||||
participant_category:aboutMe,
|
||||
keyword,category,
|
||||
limit,
|
||||
...params,
|
||||
page:p || page,
|
||||
sort_direction:getDirection(params && params.sort_by),
|
||||
sort_by:getBy(params && params.sort_by)
|
||||
}
|
||||
console.log(getParams);
|
||||
axios.get(url,{
|
||||
params:{...getParams,names:undefined}
|
||||
params:{
|
||||
keyword,
|
||||
participant_category:aboutMe,
|
||||
category,
|
||||
limit,
|
||||
...params,
|
||||
page:p || page,
|
||||
sort_direction:getDirection(params && params.sort_by),
|
||||
sort_by:getBy(params && params.sort_by),
|
||||
names:undefined}
|
||||
}).then(result=>{
|
||||
if(result){
|
||||
setIssueList(result.data.issues);
|
||||
|
|
@ -141,7 +141,14 @@ function List(props){
|
|||
setIssueTotal(result.data.total_issues_count);
|
||||
setHas_created_issues(result.data.has_created_issues);
|
||||
|
||||
let d={...getParams,names:{...names}}
|
||||
let d={keyword,
|
||||
participant_category:aboutMe,
|
||||
category,
|
||||
limit,
|
||||
...params,
|
||||
page:p || page,
|
||||
sort_direction:getDirection(params && params.sort_by),
|
||||
sort_by:getBy(params && params.sort_by),names:{...names}}
|
||||
let inFifteenMinutes = new Date(new Date().getTime() + 24 * 3600 * 1000);
|
||||
cookie.save('states', {...d},{ expires: inFifteenMinutes,path:`/` });
|
||||
}
|
||||
|
|
@ -313,7 +320,7 @@ function List(props){
|
|||
permission && permission !== "reporter" &&
|
||||
<Link to={`/${owner}/${projectsId}/issues/sign`} className="dorpdownButton"><img src={bj} alt="" className="mr5" />标记管理</Link>
|
||||
}
|
||||
<a onClick={createBtnFunc} className="operateButton ml20"><img src={create} alt="" className="mr5" />创建疑修</a>
|
||||
<CheckProfile {...props} sureFunc={()=>{props.history.push(`/${owner}/${projectsId}/issues/new`)}} className="operateButton ml20">创建疑修</CheckProfile>
|
||||
</div>
|
||||
</div>
|
||||
<div className="lists">
|
||||
|
|
@ -358,7 +365,7 @@ function List(props){
|
|||
<div className="listempty">
|
||||
<img src={issueEmp} alt="" width="68px" />
|
||||
<p className="font-22 mt5 mb10">欢迎使用疑修(Issue)</p>
|
||||
<p className="font-15">疑修用于记录与跟踪待办事项、项目bug、功能需求等。在使用之前,请您先<Link to={`/${owner}/${projectsId}/issues/new`} className="color-blue">创建一个疑修</Link></p>
|
||||
<p className="font-15">疑修用于记录与跟踪待办事项、项目bug、功能需求等。在使用之前,请您先<CheckProfile {...props} sureFunc={()=>{props.history.push(`/${owner}/${projectsId}/issues/new`)}} className="color-blue">创建一个疑修</CheckProfile></p>
|
||||
</div>
|
||||
:
|
||||
<div className="dataempty"><img src={emp} alt="" /></div>
|
||||
|
|
|
|||
|
|
@ -26,6 +26,14 @@ function Sign(props){
|
|||
const [ key , setKey ] = useState("0");
|
||||
const owner = props.match.params.owner;
|
||||
const projectsId = props.match.params.projectsId;
|
||||
const { projectDetail } = props;
|
||||
|
||||
useEffect(()=>{
|
||||
if(projectDetail){
|
||||
const { author, name } = projectDetail;
|
||||
document.title = `项目标记-${author.name}/${name}`;
|
||||
}
|
||||
},[projectDetail])
|
||||
|
||||
useEffect(()=>{
|
||||
Init();
|
||||
|
|
|
|||
|
|
@ -416,7 +416,7 @@
|
|||
padding-left: 50px;
|
||||
&>li{
|
||||
border-bottom: 1px solid rgba(172, 176, 191, 0.17);
|
||||
padding-bottom: 12px;
|
||||
padding-bottom: 8px;
|
||||
margin-bottom: 22px!important;
|
||||
&>span{
|
||||
font-size: 15px;
|
||||
|
|
@ -434,8 +434,7 @@
|
|||
}
|
||||
}
|
||||
.operatevalue{
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
line-height: 24px;
|
||||
color: #acb0bf;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue