-
+
{project && project.author &&
@@ -435,15 +435,7 @@ class Detail extends Component {
/
{project && project.name}
- {
- projectDetail && projectDetail.forked_from_project_id && projectDetail.fork_info ?
-
-
-
-
- : ""
- }
+
{
projectDetail && projectDetail.type && projectDetail.type !== 0 ?
projectDetail.type === 2 ?
@@ -516,6 +508,19 @@ class Detail extends Component {
}
+
+
+ {
+ projectDetail && projectDetail.forked_from_project_id && projectDetail.fork_info ?
+ this.textFunc(projectDetail.forked_from_project_id,projectDetail.fork_info)
+ :""
+ }
+
+ {
+ projectDetail && projectDetail.invite_code &&
+
+ }
+
{
firstSync ? "" :
+ 邀请码: {code}
+ 可以通过邀请码邀请成员加入项目
点击复制邀请码。} placement={"bottom"}>
+ jsCopy("#devitecode")}>
+
+
+ )
+}
+export default Invite;
\ No newline at end of file
diff --git a/src/forge/Notice/Apply.jsx b/src/forge/Notice/Apply.jsx
new file mode 100644
index 00000000..3c77edfa
--- /dev/null
+++ b/src/forge/Notice/Apply.jsx
@@ -0,0 +1,114 @@
+import React, { useEffect , useState } from 'react';
+import Axios from 'axios';
+import { Pagination , Spin , Popconfirm }from 'antd';
+import { Link } from 'react-router-dom';
+import { getImageUrl } from 'educoder';
+import Nodata from '../Nodata';
+import { FlexAJ } from '../Component/layout';
+
+const limit = 15;
+function Apply(props) {
+ const username = props.match.params.username;
+ const [ list , setList ] = useState(undefined);
+ const [ page , setPage ] = useState(1);
+ const [ total , setTotal ] = useState(0);
+ const [ isSpin , setIsSpin ] = useState(true);
+
+ useEffect(()=>{
+ if(username){
+ setIsSpin(true);
+ getList();
+ }
+ },[username])
+
+ function getList() {
+ const url = `/users/${username}/applied_projects.json`;
+ Axios.get(url).then(result=>{
+ if(result){
+ setList(result.data.applied_projects);
+ setTotal(result.data.total_count);
+ setIsSpin(false);
+ }
+ }).catch(error=>{})
+ }
+
+ // 接受
+ function acceptDivert(id){
+ const url = `/users/${username}/applied_projects/${id}/accept.json`;
+ Axios.post(url).then(result=>{
+ if(result && result.data){
+ getList();
+ props && props.deleteEvent("apply",1);
+ }
+ }).catch(error=>{})
+ }
+
+ // 拒绝
+ function revertDivert(id){
+ const url = `/users/${username}/applied_projects/${id}/refuse.json`;
+ Axios.post(url).then(result=>{
+ if(result && result.data){
+ getList();
+ props && props.deleteEvent("apply",1);
+ }
+ }).catch(error=>{})
+ }
+ return(
+
+
+
+ {
+ list && list.length > 0 ?
+
+ {
+ list.map((i,k)=>{
+ return(
+ -
+
+
+
+ {i.user && i.user.name}
+ {i.time_ago}
+
+
+ 申请以【{i.role === "developer" ?"开发者":i.role === "manager" ? "管理者":"报告者"}】身份加入【{i.project && i.project.name}】项目。是否同意?
+ {
+ i.status === "common" &&
+
+ acceptDivert(i.id)}>
+ 同意
+
+ revertDivert(i.id)}>
+ 拒绝
+
+
+ }
+ {
+ i.status === "accepted" && 已接受
+ }
+ {
+ i.status === "refused" && 已拒绝
+ }
+
+
+
+ )
+ })
+ }
+
+ :
+ ""
+ }
+ {list && list.length === 0 &&
}
+ {
+ total > limit &&
+
+ }
+
+
+
+ )
+}
+export default Apply;
\ No newline at end of file
diff --git a/src/forge/Notice/Index.jsx b/src/forge/Notice/Index.jsx
index d9d04d59..94c63804 100644
--- a/src/forge/Notice/Index.jsx
+++ b/src/forge/Notice/Index.jsx
@@ -6,6 +6,10 @@ import Loadable from "react-loadable";
import Loading from "../../Loading";
import { Route, Switch } from "react-router-dom";
+const Apply = Loadable({
+ loader: () => import("./Apply"),
+ loading: Loading,
+});
const Notify = Loadable({
loader: () => import("./Notify"),
loading: Loading,
@@ -18,38 +22,62 @@ 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 [ messages , setMessages ] = useState(0);
- const [ transferProjects , setTransferProjects ] = useState(0);
+ const [ messagesCount , setMessagesCount ] = useState(0);
+ const [ transferCount , setTransferCount ] = useState(0);
+ const [ applyCount , setApplyCount ] = useState(0);
+
+ const [ flag , setFlag ] = useState(true);
+ const { current_user } = props;
+
+ useEffect(()=>{
+ if((username && current_user && (current_user.login !== username))){
+ props.history.push(`/users/${username}`);
+ }
+ },[current_user,username])
useEffect(()=>{
if(user){
- setTransferProjects(user.undo_transfer_projects);
+ setTransferCount(user.undo_transfer_projects);
+ setApplyCount(user.undo_join_projects);
+ setMessagesCount(user.undo_messages);
}
- if(undo_messages){
- setMessages(undo_messages);
- }
- },[user,undo_messages])
+ },[user])
useEffect(()=>{
if(pathname && username){
if(pathname === `/users/${username}/notice`){
setMenu("notify");
+ changeNum(user.undo_messages);
}
if(pathname === `/users/${username}/notice/undo`){
setMenu("undo");
}
+ if(pathname === `/users/${username}/notice/apply`){
+ setMenu("apply");
+ }
}
- },[pathname])
-
- function fetchUser(){
- props && props.fetchUser();
- }
+ },[pathname,user])
function changeNum(){
- fetchUser();
+ if(flag){
+ messagesCount && props.deleteUndoEvent(messagesCount);
+ setFlag(false);
+ }
+ }
+
+ function deleteEvent(type,count) {
+ let c = count;
+ if(type==="apply"){
+ setApplyCount(applyCount-count);
+ }else if(type==="undo"){
+ setTransferCount(applyCount-count);
+ }else{
+ setMessagesCount(0);
+ c = messagesCount;
+ }
+ (c || c===0) && props.deleteUndoEvent(c);
}
return (
@@ -58,27 +86,39 @@ function Index(props){
通知
- {messages ? {messages}:""}
+ {messagesCount ? {messagesCount}:""}
接收仓库
- {transferProjects ? {transferProjects}:""}
+ {transferCount ? {transferCount}:""}
+
+
+
+
+ 成员申请
+ {applyCount ? {applyCount}:""}
+ {
+ return ;
+ }}
+ >
{
- return ;
+ return ;
}}
>
{
- return ;
+ return ;
}}
>
diff --git a/src/forge/Notice/Index.scss b/src/forge/Notice/Index.scss
index a50c3413..b00e18a5 100644
--- a/src/forge/Notice/Index.scss
+++ b/src/forge/Notice/Index.scss
@@ -26,7 +26,7 @@
min-width: 23px;
text-align: center;
background-color: #ffe4b3;
- margin-top: 19px;
+ margin-top: 27px;
margin-left: 10px;
display: block;
}
diff --git a/src/forge/Notice/Notify.jsx b/src/forge/Notice/Notify.jsx
index 3aad55ae..761366d3 100644
--- a/src/forge/Notice/Notify.jsx
+++ b/src/forge/Notice/Notify.jsx
@@ -13,6 +13,10 @@ function Notify(props){
const [ total , setTotal ] = useState(0);
const [ isSpin , setIsSpin ] = useState(true);
+ useEffect(()=>{
+ props && props.deleteEvent("notify",0);
+ },[])
+
useEffect(()=>{
if(username){
setIsSpin(true);
@@ -43,7 +47,7 @@ function Notify(props){
return
取消转移【{project && project.name}】仓库
case 'common':
return
正在将【{project && project.name}】仓库转移给【{owner && owner.name}】
- case 'successed':
+ case 'successed':
return
【{project && project.name}】仓库成功转移给【{owner && owner.name}】
default:
return
拒绝转移【{project && project.name}】仓库
@@ -53,6 +57,20 @@ function Notify(props){
}
}
+ function renderApplyStatus(status,applied) {
+ let { project } = applied;
+ if(status){
+ switch(status){
+ case 'successed':
+ return
已通过你加入【{project && project.name}】项目的申请
+ default:
+ return
已拒绝你加入【{project && project.name}】项目的申请
+ }
+ }else{
+ return ""
+ }
+ }
+
return(
@@ -70,7 +88,7 @@ function Notify(props){
{i.applied_user && i.applied_user.name}
{i.time_ago}
- {renderStatus(i.status,i.applied)}
+ { i.applied_type === "AppliedProject" ? renderApplyStatus(i.status,i.applied):renderStatus(i.status,i.applied)}
)
diff --git a/src/forge/Notice/UndoEvent.jsx b/src/forge/Notice/UndoEvent.jsx
index 68557a9e..c8c579dc 100644
--- a/src/forge/Notice/UndoEvent.jsx
+++ b/src/forge/Notice/UndoEvent.jsx
@@ -42,7 +42,7 @@ function UndoEvent(props){
Axios.post(url).then(result=>{
if(result && result.data){
getList();
- props && props.fetchUser();
+ props && props.deleteEvent("undo",1);
}
}).catch(error=>{})
}
@@ -53,7 +53,7 @@ function UndoEvent(props){
Axios.post(url).then(result=>{
if(result && result.data){
getList();
- props && props.fetchUser();
+ props && props.deleteEvent("undo",1);
}
}).catch(error=>{})
}
diff --git a/src/forge/Settings/Collaborator.js b/src/forge/Settings/Collaborator.js
index 4ae29263..0b94eee5 100644
--- a/src/forge/Settings/Collaborator.js
+++ b/src/forge/Settings/Collaborator.js
@@ -34,7 +34,7 @@ function Collaborator(props){
}
{
nav === "1" ?
-
+
:
}
diff --git a/src/forge/Team/Group/Setting/GroupMemberSetting.jsx b/src/forge/Team/Group/Setting/GroupMemberSetting.jsx
index 847dd6ef..a0d8ec78 100644
--- a/src/forge/Team/Group/Setting/GroupMemberSetting.jsx
+++ b/src/forge/Team/Group/Setting/GroupMemberSetting.jsx
@@ -146,7 +146,7 @@ export default ((props) => {
团队成员管理
-
+
diff --git a/src/forge/users/Infos.js b/src/forge/users/Infos.js
index 77ab795a..9b292d2e 100644
--- a/src/forge/users/Infos.js
+++ b/src/forge/users/Infos.js
@@ -66,7 +66,6 @@ class Infos extends Component {
project_type: undefined,
route_type: undefined,
undo_events:0,
- undo_messages:0,
menuKey:"0"
};
}
@@ -124,20 +123,14 @@ class Infos extends Component {
});
const { current_user } = this.props;
const { username } = this.props.match.params;
- const { pathname } = this.props.location;
- const { notice } = this.state;
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 n = notice || pathname === `/users/${username}/notice` ;
this.setState({
user: result.data,
isSpin: false,
- undo_events:n ? (e-p) : e,
- undo_messages:0,
- notice:n
+ undo_events:e
});
})
.catch((error) => {
@@ -161,7 +154,6 @@ class Infos extends Component {
this.setState({
route_type: undefined,
project_type:"notice",
- notice:true
},()=>{
this.props.history.push(`/users/${user && user.login}/notice`);
this.fetchUser();
@@ -190,10 +182,19 @@ class Infos extends Component {
resetUserInfo && resetUserInfo();
}
+ // 修改待办事项右侧的数量
+ deleteUndoEvent=(count)=>{
+ let { undo_events } = this.state;
+ let undo = undo_events - count;
+ this.setState({
+ undo_events:undo
+ })
+ }
+
render() {
- const { current_user, mygetHelmetapi , resetUserInfo } = this.props;
+ const { current_user } = this.props;
const { username } = this.props.match.params;
- const { user, isSpin, project_type, route_type , undo_events , undo_messages , menuKey } = this.state;
+ const { user, isSpin, route_type , undo_events , menuKey } = this.state;
return (
@@ -306,7 +307,7 @@ class Infos extends Component {
{
- return ;
+ return ;
}}
>