diff --git a/src/forge/Divert/DivertModal.jsx b/src/forge/Divert/DivertModal.jsx index ab61147b..7d85f809 100644 --- a/src/forge/Divert/DivertModal.jsx +++ b/src/forge/Divert/DivertModal.jsx @@ -1,5 +1,6 @@ import React ,{ forwardRef, useEffect, useState } from 'react'; import { Modal , Form , Input , Radio , Select } from 'antd'; +import SearchUser from '../Component/SearchUser'; import './Index.scss'; import Axios from 'axios'; @@ -31,13 +32,14 @@ function DivertModal({form , visible , onSuccess , onCancel,owner,repo}){ // 确认转移 function onOk(){ validateFields((error,values)=>{ + console.log(...values); if(!error){ const url = `/${owner}/${repo}/applied_transfer_projects.json`; Axios.post(url,{ ...values }).then(result=>{ if(result){ - onSuccess(); + onSuccess(result.data && result.data.owner); } }).catch(error=>{}) } @@ -65,6 +67,12 @@ function DivertModal({form , visible , onSuccess , onCancel,owner,repo}){ labelCol: { span: 5 }, wrapperCol: { span: 18 }, }; + + function getUser(id){ + setFieldsValue({ + owner_name:id + }) + } return( + // + )} } @@ -118,7 +127,7 @@ function DivertModal({form , visible , onSuccess , onCancel,owner,repo}){ {getFieldDecorator("owner_name", {rules:[{required:true,message:"请选择目标组织"}]} )( - trigger.parentNode}> { organizations && organizations.length > 0 ? organizations.map((i,k)=>{ diff --git a/src/forge/Notice/Index.jsx b/src/forge/Notice/Index.jsx index 8135c72f..e222d7b8 100644 --- a/src/forge/Notice/Index.jsx +++ b/src/forge/Notice/Index.jsx @@ -1,5 +1,4 @@ import React, { useEffect, useState } from "react"; -import { Menu } from 'antd'; import { Link } from 'react-router-dom'; import './Index.scss'; @@ -18,7 +17,18 @@ const UndoEvent = Loadable({ function Index(props){ const username = props.match.params.username; const pathname = props.history.location.pathname; + const user = props.user; + const [ menu , setMenu ] = useState("notify"); + const [ undo_messages , setMessages ] = useState("notify"); + const [ undo_transfer_projects , setTransferProjects ] = useState("notify"); + + useEffect(()=>{ + if(user){ + setMessages(user.undo_messages); + setTransferProjects(user.undo_transfer_projects); + } + },[user]) useEffect(()=>{ if(pathname && username){ @@ -31,24 +41,41 @@ function Index(props){ } },[pathname]) + function fetchUser(){ + props && props.fetchUser(); + } + + function changeNum(){ + fetchUser(); + } return (
- - 通知 - 接收仓库 - +
    +
  • + + 通知 + {undo_messages ? {undo_messages}:""} + +
  • +
  • + + 接收仓库 + {undo_transfer_projects ? {undo_transfer_projects}:""} + +
  • +
{ - return ; + return ; }} > { - return ; + return ; }} > diff --git a/src/forge/Notice/Index.scss b/src/forge/Notice/Index.scss index a3c00f9e..c7bb50eb 100644 --- a/src/forge/Notice/Index.scss +++ b/src/forge/Notice/Index.scss @@ -1,11 +1,46 @@ .noticeMenu{ padding:0px 20px; - .ant-menu-item{ + display: flex; + border-bottom: 1px solid #eee; + height: 54px; + line-height: 54px; + li{ font-size: 16px; padding:0px; - margin:0px 20px!important; + margin:0px 30px 0px 20px!important; height: 54px; line-height: 54px; + position: relative; + transform: none; + a{ + display: flex; + &>span{ + position: relative; + } + } + &.active a span:first-child::after{ + position: absolute; + bottom: 0px; + height: 2px; + left: 0px; + content: ""; + background-color: #1890ff; + width: 100%; + } + .unNum{ + color: #d38900; + font-size: 12px; + border-radius: 13px; + height: 16px; + line-height: 16px; + padding:0px 4px; + min-width: 23px; + text-align: center; + background-color: #ffe4b3; + margin-top: 19px; + margin-left: 10px; + display: block; + } } } .notifyList{ diff --git a/src/forge/Notice/Notify.jsx b/src/forge/Notice/Notify.jsx index f4ab2446..c4ac6699 100644 --- a/src/forge/Notice/Notify.jsx +++ b/src/forge/Notice/Notify.jsx @@ -32,6 +32,25 @@ function Notify(props){ }).catch(error=>{}) } + function renderStatus(status,applied){ + let { project , owner} = applied + if(status){ + switch(status){ + case 'canceled': + return `取消转移【${project && project.name}】仓库` + case 'common': + return `正在将【${project && project.name}】仓库转移给【${owner && owner.name}】` + case 'successed': + return `【${project && project.name}】仓库成功转移给【${owner && owner.name}】` + default: + return `拒绝转移【${project && project.name}】仓库` + } + + }else{ + return "" + } + } + return(
{ @@ -48,7 +67,7 @@ function Notify(props){ {i.applied_user && i.applied_user.name} {i.time_ago}

-

{i.name}

+

{renderStatus(i.status,i.applied)}

) @@ -59,7 +78,7 @@ function Notify(props){ : "" } - {list && list.length === 0 && } + {list && list.length === 0 && } { total > limit &&
diff --git a/src/forge/Notice/UndoEvent.jsx b/src/forge/Notice/UndoEvent.jsx index ddf9838c..4f105141 100644 --- a/src/forge/Notice/UndoEvent.jsx +++ b/src/forge/Notice/UndoEvent.jsx @@ -40,6 +40,7 @@ function UndoEvent(props){ Axios.post(url).then(result=>{ if(result && result.data){ getList(); + props && props.fetchUser(); } }).catch(error=>{}) } @@ -50,6 +51,7 @@ function UndoEvent(props){ Axios.post(url).then(result=>{ if(result && result.data){ getList(); + props && props.fetchUser(); } }).catch(error=>{}) } @@ -71,7 +73,8 @@ function UndoEvent(props){ {i.time_ago}

-

请求将仓库【{i.project && i.project.name}】转移给【{i.owner && i.owner.name}】,是否接受?

+

请求将仓库【{i.project && i.project.name}】 + 转移给【{i.owner && i.owner.name}】,是否接受?

{ i.status === "common" && @@ -103,7 +106,7 @@ function UndoEvent(props){ : "" } - {list && list.length === 0 && } + {list && list.length === 0 && } { total > limit &&
diff --git a/src/forge/Settings/Setting.js b/src/forge/Settings/Setting.js index 57ea399f..05b9967c 100644 --- a/src/forge/Settings/Setting.js +++ b/src/forge/Settings/Setting.js @@ -3,6 +3,7 @@ import { Form, Input, Checkbox, Select , Spin } from "antd"; import Title from '../Component/Title'; import {WhiteBack} from '../Component/layout'; import DivertModal from '../Divert/DivertModal'; +import { Link } from 'react-router-dom'; import axios from "axios"; import "./setting.scss"; const { TextArea } = Input; @@ -77,6 +78,7 @@ class Setting extends Component { private_check: result.data.private, loading:false, project_units:units, + transfer:result.data.transfer, is_transfering:result.data.is_transfering, }); } @@ -215,10 +217,11 @@ class Setting extends Component { } // 确定转移仓库 - onSuccess=()=>{ + onSuccess=(owner)=>{ this.setState({ is_transfering:true, - divertVisible:false + divertVisible:false, + transfer:owner }) } @@ -227,7 +230,8 @@ class Setting extends Component { const { projectsId , owner } = this.props.match.params; const { projectDetail } = this.props; - const { CategoryList, LanguageList, private_check ,loading , divertVisible , is_transfering } = this.state; + const { CategoryList, LanguageList, private_check ,loading , divertVisible , is_transfering, transfer } = this.state; + console.log(transfer); return (

转移仓库

- 将此仓库转移给其他用户或组织 + { + is_transfering ? + 此仓库正在转移给【 + {transfer && {transfer.name}} + 】,请联系对方接收此仓库。 + : + `将此仓库转移给其他用户或组织` + }

{ diff --git a/src/forge/users/Infos.js b/src/forge/users/Infos.js index 2248eca2..0759a6a9 100644 --- a/src/forge/users/Infos.js +++ b/src/forge/users/Infos.js @@ -52,7 +52,8 @@ class Infos extends Component { isSpin: false, user: undefined, project_type: undefined, - route_type: undefined + route_type: undefined, + undo_events:0 }; } @@ -73,14 +74,19 @@ class Infos extends Component { }); const { current_user } = this.props; const { username } = this.props.match.params; + const { pathname } = this.props.location; let url = `/users/${username || (current_user && current_user.login)}.json`; axios .get(url) .then((result) => { + let e = result.data && result.data.undo_events; + let p = result.data && result.data.undo_messages; + let notice = p !== 0 ? pathname === `/users/${username}/notice` :false; this.setState({ user: result.data, isSpin: false, + undo_events:notice ? (e-p) : e }); }) .catch((error) => { @@ -142,7 +148,7 @@ class Infos extends Component { const { current_user, mygetHelmetapi } = this.props; const { username } = this.props.match.params; - const { user, isSpin, project_type, route_type } = this.state; + const { user, isSpin, project_type, route_type , undo_events } = this.state; return (
@@ -223,7 +229,7 @@ class Infos extends Component { 待办事项 - {user.undo_events} + {undo_events}

@@ -318,7 +324,7 @@ class Infos extends Component { { - return ; + return ; }} >