From ae34240bfbb3fff5f7687adbbbc7dcbe09d4a2db Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 27 Apr 2021 17:46:05 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E7=9F=A5-=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Notice/Index.jsx | 15 ++++++++------- src/forge/Notice/Notify.jsx | 10 +++++----- src/forge/Notice/UndoEvent.jsx | 1 - src/forge/users/Infos.js | 10 ++++++---- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/forge/Notice/Index.jsx b/src/forge/Notice/Index.jsx index e222d7b8..218b16f5 100644 --- a/src/forge/Notice/Index.jsx +++ b/src/forge/Notice/Index.jsx @@ -18,17 +18,18 @@ function Index(props){ const username = props.match.params.username; const pathname = props.history.location.pathname; const user = props.user; + const undo_messages = props.undo_messages; const [ menu , setMenu ] = useState("notify"); - const [ undo_messages , setMessages ] = useState("notify"); - const [ undo_transfer_projects , setTransferProjects ] = useState("notify"); + const [ messages , setMessages ] = useState(0); + const [ transferProjects , setTransferProjects ] = useState(0); useEffect(()=>{ - if(user){ - setMessages(user.undo_messages); + if(user && undo_messages){ + setMessages(undo_messages); setTransferProjects(user.undo_transfer_projects); } - },[user]) + },[user,undo_messages]) useEffect(()=>{ if(pathname && username){ @@ -55,13 +56,13 @@ function Index(props){
取消转移【{project && project.name}】仓库
case 'common': - return `正在将【${project && project.name}】仓库转移给【${owner && owner.name}】` + return正在将【{project && project.name}】仓库转移给【{owner && owner.name}】
case 'successed': - return `【${project && project.name}】仓库成功转移给【${owner && owner.name}】` + return【{project && project.name}】仓库成功转移给【{owner && owner.name}】
default: - return `拒绝转移【${project && project.name}】仓库` + return拒绝转移【{project && project.name}】仓库
} }else{ @@ -67,7 +67,7 @@ function Notify(props){ {i.applied_user && i.applied_user.name} {i.time_ago} -{renderStatus(i.status,i.applied)}
+ {renderStatus(i.status,i.applied)} ) diff --git a/src/forge/Notice/UndoEvent.jsx b/src/forge/Notice/UndoEvent.jsx index 4f105141..afb5c706 100644 --- a/src/forge/Notice/UndoEvent.jsx +++ b/src/forge/Notice/UndoEvent.jsx @@ -13,7 +13,6 @@ function UndoEvent(props){ const [ page , setPage ] = useState(1); const [ total , setTotal ] = useState(0); - useEffect(()=>{ if(username){ getList(); diff --git a/src/forge/users/Infos.js b/src/forge/users/Infos.js index 0759a6a9..06055044 100644 --- a/src/forge/users/Infos.js +++ b/src/forge/users/Infos.js @@ -53,7 +53,8 @@ class Infos extends Component { user: undefined, project_type: undefined, route_type: undefined, - undo_events:0 + undo_events:0, + undo_messages:0 }; } @@ -86,7 +87,8 @@ class Infos extends Component { this.setState({ user: result.data, isSpin: false, - undo_events:notice ? (e-p) : e + undo_events:notice ? (e-p) : e, + undo_messages:notice ? result.data && result.data.undo_messages : 0 }); }) .catch((error) => { @@ -123,7 +125,7 @@ class Infos extends Component { const {user} = this.state this.setState({ route_type: undefined, - project_type:"notice" + project_type:"notice", }) this.props.history.push(`/users/${user && user.login}/notice`) } @@ -148,7 +150,7 @@ class Infos extends Component { const { current_user, mygetHelmetapi } = this.props; const { username } = this.props.match.params; - const { user, isSpin, project_type, route_type , undo_events } = this.state; + const { user, isSpin, project_type, route_type , undo_events , undo_messages } = this.state; return (