From ce8c22959aa5a11e95b903ddf00a47f609c21934 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 21 Feb 2023 22:12:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E8=AE=B0=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Issues/Component/addTagsBox.jsx | 1 - src/forge/Issues/Component/colorCard.jsx | 15 +- src/forge/Issues/Component/datas.jsx | 104 +--------- src/forge/Issues/Component/editMenus.jsx | 3 +- src/forge/Issues/Component/menus.jsx | 1 - src/forge/Issues/Component/newPanel.jsx | 3 +- src/forge/Issues/Pages/details.jsx | 108 +++++++--- src/forge/Issues/Pages/list.jsx | 12 +- src/forge/Issues/Pages/sign.jsx | 233 ++++++++++++++++------ src/forge/Issues/index.jsx | 6 + src/forge/Issues/index.scss | 21 +- 11 files changed, 293 insertions(+), 214 deletions(-) diff --git a/src/forge/Issues/Component/addTagsBox.jsx b/src/forge/Issues/Component/addTagsBox.jsx index 65ca4e763..ab0d2ce32 100644 --- a/src/forge/Issues/Component/addTagsBox.jsx +++ b/src/forge/Issues/Component/addTagsBox.jsx @@ -19,7 +19,6 @@ function AddTagsBox({visible,onCancel, onSuccess , form ,owner , projectsId}){ function getColor(colors){ setColors(colors); - console.log(colors); } return( diff --git a/src/forge/Issues/Component/colorCard.jsx b/src/forge/Issues/Component/colorCard.jsx index 1e3a15723..38862a9e5 100644 --- a/src/forge/Issues/Component/colorCard.jsx +++ b/src/forge/Issues/Component/colorCard.jsx @@ -1,22 +1,27 @@ -import React,{ useState } from 'react'; +import React,{ useState , useEffect } from 'react'; import { SketchPicker } from 'react-color'; -function ColorCard({getColor}){ +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(()=>{ + console.log(defaultColor); + defaultColor && setTextColor(defaultColor); + },[defaultColor]) + // 切换色卡 function handleChange(color){ setColor(color.rgb); setTextColor(color.hex); - getColor(color); + getColor(color ? color.hex : defaultColor); } // 隐藏色卡 function handleClick(){ setDisplayColorPicker(!displayColorPicker); - reduction(); + // reduction(); } // 还原色卡 @@ -27,7 +32,7 @@ function ColorCard({getColor}){ return(
-
+

{textcolor}

{displayColorPicker ? ( diff --git a/src/forge/Issues/Component/datas.jsx b/src/forge/Issues/Component/datas.jsx index f2ca31853..ab0e3ba92 100644 --- a/src/forge/Issues/Component/datas.jsx +++ b/src/forge/Issues/Component/datas.jsx @@ -23,7 +23,6 @@ function Datas({checkbox ,item , projectsId,owner}){ } return( -
{checkbox} @@ -52,14 +51,14 @@ function Datas({checkbox ,item , projectsId,owner}){ {item.author && item.author.name} {item.created_at} 发布 {item.updated_at}更新 - {item.milestone_name && {item.milestone_name} } + {item.milestone_name && {item.milestone_name} }
{ item.assigners && item.assigners.length > 0 ? -
+
1 ?"principal hovers":"principal"}> { item.assigners.map((i,k)=>{ return( @@ -75,105 +74,6 @@ function Datas({checkbox ,item , projectsId,owner}){
{item.comment_journals_count}
- {/*
-
- -
- 紧急 - #2 -
-
-
- -

如何参与到项目的开发,提升技术能力?

- test -
-
- - 张嘉佳 - 2022/11/25 15:25 发布 - 2022/11/29 15:25更新 - 里程碑名称标题 -
-
-
-
-
- - - - - -
-
拒绝
-
10
-
-
-
-
- -
- - #3 -
-
-
- - 如何参与到项目的开发,提升技术能力? - feature -
-
- - 张嘉佳 - 2022/11/25 15:25 发布 - 2022/11/29 15:25更新 - 里程碑名称标题 -
-
-
-
-
- - - -
-
反馈
-
10
-
-
-
-
- -
- - #3 -
-
-
- -

如何参与到项目的开发,提升技术能力?

- feature -
-
- - 张嘉佳 - 2022/11/25 15:25 发布 - 2022/11/29 15:25更新 - 里程碑名称标题 -
-
-
-
-
- - - -
-
反馈
-
10
-
-
*/} -
) } export default Datas; \ No newline at end of file diff --git a/src/forge/Issues/Component/editMenus.jsx b/src/forge/Issues/Component/editMenus.jsx index afd55e41f..99536deba 100644 --- a/src/forge/Issues/Component/editMenus.jsx +++ b/src/forge/Issues/Component/editMenus.jsx @@ -82,7 +82,6 @@ function EditMenus({ return; } l.push(idStr); - console.log(valueId,l,idStr); nameArr.push(i.name); } setValueId(l); @@ -140,7 +139,7 @@ function EditMenus({ chooseMenu(i)}> { imgFlag && } {i.color && } - {i.name} + {i.name} ) }) diff --git a/src/forge/Issues/Component/menus.jsx b/src/forge/Issues/Component/menus.jsx index 396d54f03..cc41b9a67 100644 --- a/src/forge/Issues/Component/menus.jsx +++ b/src/forge/Issues/Component/menus.jsx @@ -24,7 +24,6 @@ function Menus({name, ids , lists , size , imgControl , searchFunc , chooseFunc useEffect(()=>{ setChooseValue(ids); setShowValue(names); - console.log(names); },[ids,names]) diff --git a/src/forge/Issues/Component/newPanel.jsx b/src/forge/Issues/Component/newPanel.jsx index 9e74d50f9..cd87ccce5 100644 --- a/src/forge/Issues/Component/newPanel.jsx +++ b/src/forge/Issues/Component/newPanel.jsx @@ -33,7 +33,6 @@ function NewPanel(props,ref){ let arr = files.map(i=>{return i.id}); list = arr && arr.length>0 ? f.concat(arr) : f ; } - console.log(list); setFileList(list); }; function changeAtWhoLoginList(loginList){ @@ -100,7 +99,7 @@ function NewPanel(props,ref){ }
- +
diff --git a/src/forge/Issues/Pages/details.jsx b/src/forge/Issues/Pages/details.jsx index c33417163..1a260b965 100644 --- a/src/forge/Issues/Pages/details.jsx +++ b/src/forge/Issues/Pages/details.jsx @@ -1,6 +1,7 @@ import React , { useEffect , useState , forwardRef } from 'react'; import { Spin , Form } from 'antd'; import { getImageUrl } from 'educoder'; +import { Link } from 'react-router-dom'; import { Box , LongWidth } from '../../Component/layout'; import RenderHtml from "../../../components/render-html"; import EditMenus from '../Component/editMenus'; @@ -43,9 +44,21 @@ function Details(props){ const [ visible , setVisible ] = useState(false); const [ delVisible , setDelVisible] = useState(false); const [ edit , setEdit] = useState(false); + const [ copy , setCopy] = useState(false); const [ start_date, setStartDate ] = useState(""); const [ due_date, setDueDate ] = useState(""); + const pathname = props.history.location.pathname; + + useEffect(()=>{ + if(pathname === `/${owner}/${projectsId}/issues/${index}/copy`){ + setEdit(true); + setCopy(true); + }else{ + setEdit(false); + setCopy(false); + } + },[pathname]) useEffect(()=>{ if(index){ @@ -67,7 +80,7 @@ function Details(props){ let tags = data.tags && data.tags.length>0 ? data.tags.map((i)=>{return i.id.toString();}):undefined; let tagNames = data.tags && data.tags.length>0 ? data.tags.map((i)=>{return i.name.toString();}):undefined; setTagId(tags); - setMillstoneId([`${data.milestone && data.milestone.id}`]) + setMillstoneId((data.milestone && data.milestone.id) ? [`${ data.milestone.id}`] :undefined) setBranchId(data.branch_name && [data.branch_name]); const n = { issue_priorities_name:data.priority ? [`${data.priority.name}`]:undefined, @@ -184,20 +197,23 @@ function Details(props){ setVisible(false); } + // 可单个编辑保存右侧的项(!copy:非复制状态下) function saveForeach(c,s,p,t,m,b,sDate,eDate){ - const url = `/v1/${owner}/${projectsId}/issues/${index}`; - axios.patch(url,{ - branch_name: b ? b.join(",") :undefined, - status_id: s ? s.join(",") : undefined, - priority_id: p ? p.join(",") :undefined, - milestone_id: m ? m.join(",") :undefined, - issue_tag_ids: t?t:undefined, - assigner_ids: c?c:undefined, - start_date:sDate, - due_date:eDate - }).then(result=>{ - - }).catch(error=>{}) + if(!copy){ + const url = `/v1/${owner}/${projectsId}/issues/${index}`; + axios.patch(url,{ + branch_name: b ? b.join(",") :undefined, + status_id: s ? s.join(",") : undefined, + priority_id: p ? p.join(",") :undefined, + milestone_id: m ? m.join(",") :undefined, + issue_tag_ids: t?t:undefined, + assigner_ids: c?c:undefined, + start_date:sDate, + due_date:eDate + }).then(result=>{ + + }).catch(error=>{}) + } } function deleteFunc(){ @@ -212,21 +228,55 @@ function Details(props){ // 编辑保存 function createFunc(values,fileList,receivers_login,description){ - const url = `/v1/${owner}/${projectsId}/issues/${index}`; - axios.patch(url,{ - subject: values.subject, - attachment_ids: fileList, - receivers_login: receivers_login, - description: description - }).then(result=>{ - if(result){ - props.showNotification("疑修更新成功!"); - Init(); - setEdit(false); - } - }).catch(error=>{}) + let params ={ + subject: values.subject, + attachment_ids: fileList, + receivers_login: receivers_login, + description: description + } + if(!copy){ + // 调用编辑保存接口 + const url = `/v1/${owner}/${projectsId}/issues/${index}`; + axios.patch(url,{ + ...params + }).then(result=>{ + if(result){ + props.showNotification("疑修更新成功!"); + Init(); + setEdit(false); + } + }).catch(error=>{}) + }else{ + // 调用新建保存接口 + console.log(branchId,statusId,prioritiesId,millstoneId,tagId, charegeId); + const url = `/v1/${owner}/${projectsId}/issues`; + axios.post(url,{ + ...params, + branch_name:branchId && branchId.join(","), + status_id:statusId && statusId.join(","), + priority_id:prioritiesId && prioritiesId.join(","), + milestone_id:millstoneId && millstoneId.join(","), + issue_tag_ids:tagId, + assigner_ids:charegeId, + start_date,due_date + }).then(result=>{ + debugger; + if(result && result.data && result.data.project_issues_index){ + props.showNotification("任务复制成功!"); + props.history.push(`/${owner}/${projectsId}/issues/${result.data.project_issues_index}`); + } + }).catch(error=>{}) + } } + // 取消编辑或复制 + function onCancel(){ + if(copy){ + props.history.push(`/${owner}/${projectsId}/issues/${index}`); + }else{ + setEdit(false) + } + } return( details ? @@ -249,7 +299,7 @@ function Details(props){
setEdit(false)} + onCancel={onCancel} title={details.subject} desc={details.description} files={details.attachments} @@ -279,7 +329,7 @@ function Details(props){ details.user_permission && } diff --git a/src/forge/Issues/Pages/list.jsx b/src/forge/Issues/Pages/list.jsx index eb24c1778..0900ff6f5 100644 --- a/src/forge/Issues/Pages/list.jsx +++ b/src/forge/Issues/Pages/list.jsx @@ -35,9 +35,7 @@ function List(props){ const menuRef = useRef(null); const owner = props.match.params.owner; const projectsId = props.match.params.projectsId; - console.log(props && props.projectDetail); - const { permission } = props && props.projectDetail; - console.log(permission); + const permission = props && props.projectDetail && props.projectDetail.permission; useEffect(()=>{ @@ -161,7 +159,6 @@ function List(props){ if(allValue && allValue.length>0){ // 将ids保存下来以便修改 setUpdateIds(ids); - console.log(ids); }else{ Init(ids); } @@ -241,10 +238,11 @@ function List(props){ total > 0 && - { - issueList.map((item,key)=>{ +
+ {issueList.map((item,key)=>{ return( } item={item} owner={owner} @@ -253,7 +251,7 @@ function List(props){ ) }) } - +
{ total > 10 && diff --git a/src/forge/Issues/Pages/sign.jsx b/src/forge/Issues/Pages/sign.jsx index 1bd480ce6..3809d6abf 100644 --- a/src/forge/Issues/Pages/sign.jsx +++ b/src/forge/Issues/Pages/sign.jsx @@ -1,14 +1,52 @@ import React , { useEffect , useState } from 'react'; import create from '../Img/create.png'; -import { Menu , Dropdown , Icon, Input, Button } from 'antd'; +import { Menu , Dropdown , Icon, Input, Button , Spin , Pagination } from 'antd'; import ColorCard from '../Component/colorCard'; - -function Sign(){ +import DelBox from '../Component/delBox'; +import axios from 'axios'; +import {Link} from 'react-router-dom'; +const limit = 15; +function Sign(props){ const [ edit , setEdit ] = useState(false); const [ colors , setColors ] = useState(undefined); + const [ delVisible , setDelVisible ] = useState(false); + const [ editId , setEditId ] = useState(undefined); + const [ list , setList ] = useState(undefined); + const [ total , setTotal ] = useState(undefined); + const [ page , setPage ] = useState(1); - function arrayList(){ + const [ name , setName ] = useState(undefined); + const [ desc , setDesc ] = useState(undefined); + const [ order_name , setOrderName ] = useState(undefined); + const [ order_type , setOrderType ] = useState(undefined); + const [ nameFlag , setNameFlag ] = useState(undefined); + const [ defaultColor , setDefaultColor ]= useState("#F17013"); + const owner = props.match.params.owner; + const projectsId = props.match.params.projectsId; + useEffect(()=>{ + Init(); + },[page,order_name,order_type]) + + function Init(){ + const url = `/v1/${owner}/${projectsId}/issue_tags`; + axios.get(url,{ + params:{ + page,limit,order_name,order_type + } + }).then(result=>{ + if(result && result.data){ + setList(result.data.issue_tags); + setTotal(result.data.total_count); + } + }) + } + + function arrayList(e){ + const { eventKey , value } = e.item.props; + setPage(1); + setOrderName(eventKey); + setOrderType(value); } const menu = ( @@ -30,82 +68,153 @@ function Sign(){ function getColor(colors){ setColors(colors); - console.log(colors); + } + + function deleteFunc(){ + if(editId){ + const url = `/v1/${owner}/${projectsId}/issue_tags/${editId}`; + axios.delete(url).then(result=>{ + if(result){ + props.showNotification("项目标记删除成功!"); + Init(); + setDelVisible(false); + } + }).catch(error=>{}) + } + } + + function sureSave(){ + console.log(colors || defaultColor); + if(!name){ + setNameFlag(true); + }else{ + setNameFlag(false); + if(editId){ + // 编辑 + const url = `/v1/${owner}/${projectsId}/issue_tags/${editId}`; + axios.patch(url,{ + color: colors || defaultColor, + description: desc, + name + }).then(result=>{ + if(result){ + props.showNotification("标记编辑成功!"); + Init(); + cancel(); + } + }).catch(error=>{}) + }else{ + // 保存 + const url = `/v1/${owner}/${projectsId}/issue_tags`; + axios.post(url,{ + color: colors || defaultColor, + description: desc, + name + }).then(result=>{ + if(result){ + props.showNotification("标记新增成功!"); + Init(); + cancel(); + } + }).catch(error=>{}) + } + } + } + + function cancel(){ + setNameFlag(false); + setName(undefined); + setEdit(false); + setDesc(undefined); + } + + function editFunc(i){ + setEditId(i.id); + setDefaultColor(i.color); + setName(i.name); + setDesc(i.description); + setEdit(true); + } + + function onChangeValue(e){ + setName(e.target.value); + if(e.target.value){ + setNameFlag(false); + }else{ + setNameFlag(true); + } } return(
+ setDelVisible(false)} + onSuccess={deleteFunc} + content={

您确定要删除当前标记?

} + />
- Issue / 项目标记 + Issue / 项目标记 setEdit(true)}>创建标记
{ edit &&
- - - +
+ + { nameFlag &&

请输入标记名称

} +
+ setDesc(e.target.value)} placeholder="描述30字以内"/> + - - + +
}
- 项目标记(10) + 项目标记({total || 0}) 标记
-
    -
  • -

    - - - 缺陷 -

    -

    表示项目存在问题

    -

    - 0 Issue - 12 合并请求 -

    -

    - 编辑 - 删除 -

    -
  • -
  • -

    - - - 疑问 -

    -

    表示存在的问题

    -

    - 0 Issue - 12 合并请求 -

    -

    - 编辑 - 删除 -

    -
  • -
  • -

    - - - 功能 -

    -

    表示新功能申请

    -

    - 0 Issue - 12 合并请求 -

    -

    - 编辑 - 删除 -

    -
  • -
+ { + list && list.length > 0 ? + + :"" + } + { + total > limit && +
+ setPage(p)} pageSize={limit}/> +
+ } + {total === undefined &&
}
) } diff --git a/src/forge/Issues/index.jsx b/src/forge/Issues/index.jsx index ef13c7453..862c2f37e 100644 --- a/src/forge/Issues/index.jsx +++ b/src/forge/Issues/index.jsx @@ -25,6 +25,12 @@ function Index(props){ return(
+ ( + + )} + > ( diff --git a/src/forge/Issues/index.scss b/src/forge/Issues/index.scss index 736c7f89a..b184273fe 100644 --- a/src/forge/Issues/index.scss +++ b/src/forge/Issues/index.scss @@ -168,8 +168,8 @@ // issue列表 .listdatas{ border:1px solid #d0d0d0; - border-radius:0px 0px 4px 4px ; border-top: none; + border-radius: 0px 0px 2px 2px; &>div{ padding:20px 18px; border-bottom: 1px solid #eee; @@ -215,7 +215,7 @@ .principal{ position: relative; height: 20px; - &:hover{ + &.hovers:hover{ a{ position:initial; } @@ -223,7 +223,6 @@ a{ position: absolute; right: 0px; - bottom: 0px; transition: 0.6s; } img,span{ @@ -334,6 +333,19 @@ align-items: center; margin-bottom: 30px; justify-content: space-between; + &>div{ + position: relative; + .inputred{ + border-color: red; + } + .red{ + position: absolute; + left: 166px; + width: 100%; + top: 2px; + color: red; + } + } } .signlist{ padding:10px 0px; @@ -470,6 +482,7 @@ background-color:#ffffff; border-radius:6px; box-shadow:0px 0px 10px rgba(24, 54, 181, 0.17); + max-width: 280px; .searchbox{ padding:12px 20px 0px 16px; } @@ -484,6 +497,8 @@ border-bottom: none; color:#898d9d; position: relative; + width: 100%; + box-sizing: border-box; &:hover,&.ant-menu-item-selected{ background-color:rgba(70, 106, 255, 0.07); color:#40424a;