diff --git a/src/App.js b/src/App.js
index d9e1a3ef..aae03b9d 100644
--- a/src/App.js
+++ b/src/App.js
@@ -91,6 +91,10 @@ const ProjectIndex = Loadable({
loader: () => import("./forge/Index"),
loading: Loading,
});
+
+// 此处仅维护前端可能的一级路由,不用进行项目或者组织判断的字段。
+const keyWord = ["explore", "settings", "setting", "CCF", "mulan", "wiki", "issues", "setting", "trending", "code", "projects", "pulls", "mine", "login", "register", "email", "export", "nopage", "404", "403", "500", "501", "search"];
+
class App extends Component {
constructor(props) {
super(props);
@@ -101,7 +105,7 @@ class App extends Component {
occupation: 0,
mygetHelmetapi: null,
pathType: null,
- pathName:'',
+ pathName: '',
}
}
@@ -113,14 +117,15 @@ class App extends Component {
// 添加路由监听,决定组织还是个人
this.unlisten = this.props.history.listen((location) => {
let newPathname = location.pathname.split('/')[1];
- if(this.state.pathName!==newPathname){
- this.setState({pathType:''});
+ if (this.state.pathName !== newPathname) {
+ this.setState({ pathType: '' });
newPathname && this.getPathnameType(newPathname);
}
});
}
shouldComponentUpdate(nextProps, nextState) {
+ // (!keyWord.includes(this.props.location.pathname.split('/')[1])) &&
if (nextProps.location.pathname.split('/')[1] !== this.props.location.pathname.split('/')[1] && nextState.pathType === this.state.pathType) {
return false;
} else {
@@ -129,17 +134,21 @@ class App extends Component {
}
getPathnameType = (pathname) => {
- let keyWord = ["Gitlink", "Trustie", "explore", "settings", "setting", "CCF", "mulan", "wiki", "issues", "setting", "trending", "code", "projects", "pulls", "mine", "login", "register", "email", "export", "nopage", "404", "403", "500", "501", "search"];
if (!keyWord.includes(pathname)) {
let url = `/owners/${pathname}.json`;
axios.get(url).then((response) => {
if (response && response.status === 200) {
this.setState({
pathType: response.data.type || '404',
- pathName:pathname,
+ pathName: pathname,
})
}
});
+ }else{
+ this.setState({
+ pathType: pathname,
+ pathName: pathname,
+ });
}
}
@@ -277,7 +286,7 @@ class App extends Component {
}
}>
-
+
- {/* {
- return ()
- }
- }>
- */}
-
{/*项目*/}
)
}
}>
- : pathType === '404' ? : (
- personal && personal.length > 0 ?
-
- :
-
- )
- }
- />
+ : pathType === '404' ? :
+ (
+ personal && personal.length > 0 ?
+
+ :
+
+ )
+ }
+ />
+ //
}
-
+
{/* 组织 */}
)}
>
- (
-
- )}
- >
);
diff --git a/src/forge/Settings/Setting.js b/src/forge/Settings/Setting.js
index b2a06837..c3150323 100644
--- a/src/forge/Settings/Setting.js
+++ b/src/forge/Settings/Setting.js
@@ -179,11 +179,9 @@ class Setting extends Component {
content: 该操作无法撤销!且将会一并删除相关的易修、合并请求、工作流、里程碑、动态等数据。
是否确认删除 {owner}/{projectName}({projectsId})?,
onOk: () => {
const url = `/${owner}/${projectsId}.json`;
- axios
- .delete(url)
- .then((result) => {
+ axios.delete(url).then((result) => {
this.props.showNotification("仓库删除成功!");
- this.props.history.push("/projects");
+ this.props.history.push(`/${owner}`);
})
.catch((error) => {
console.log(error);
diff --git a/src/forge/Team/Group/GroupDetails.jsx b/src/forge/Team/Group/GroupDetails.jsx
index 64b52964..b35132bc 100644
--- a/src/forge/Team/Group/GroupDetails.jsx
+++ b/src/forge/Team/Group/GroupDetails.jsx
@@ -87,9 +87,9 @@ export default ((props) => {
if (username) {
const url = `/organizations/${OIdentifier}/teams/${groupId}/team_users/quit.json`;
axios.delete(url).then((result) => {
- if (result && result.data) {
+ if (result && result.message==='success') {
props.showNotification(`已成功退出团队!`);
- props.history.push(`/${OIdentifier}`);
+ props.history.push(`/${username}`);
}
}).catch((error) => { });
}
diff --git a/src/forge/Team/Index.jsx b/src/forge/Team/Index.jsx
index e3266c88..4dfa85f4 100644
--- a/src/forge/Team/Index.jsx
+++ b/src/forge/Team/Index.jsx
@@ -72,6 +72,14 @@ export default withRouter(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(
}}
>
+ {/* 组织详情(包含组织设置) */}
+ (
+
+ )}
+ >
+
{/* 组织下的项目详情 */}
- {props.history.push(`/deposit/new/${OIdentifier}`)}}>新建托管项目
+ {props.history.push(`/projects/deposit/new/${OIdentifier}`)}}>新建托管项目
- {props.history.push(`/mirror/new/${OIdentifier}`)}}>新建镜像项目
+ {props.history.push(`/projects/mirror/new/${OIdentifier}`)}}>新建镜像项目
)
diff --git a/src/forge/users/Index.jsx b/src/forge/users/Index.jsx
index 066d8744..7e209113 100644
--- a/src/forge/users/Index.jsx
+++ b/src/forge/users/Index.jsx
@@ -22,21 +22,26 @@ const ProjectDetail = Loadable({
});
export default withRouter(
(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC((props) => {
+
// 个人中心新增的二级目录都需在此添加一次。将项目放组织和个人名下后,此处根据二级目录作判断,
let secondRouter = '';
+ let firstRouter = '';
if (props.location.pathname) {
+ firstRouter =props.location.pathname.split('/')[1];
secondRouter = props.location.pathname.split('/')[2];
}
+ // 如果是explore,把所有路由相关的都改成当前登录人;
+ let changePathProps={...props};
+ if(firstRouter==='explore'){
+ let login=props.current_user.login;
+ changePathProps.match.path=`/${login}`;
+ changePathProps.match.url=`/${login}`;
+ changePathProps.location.pathname=`/${login}`;
+ changePathProps.history.location.pathname=`/${login}`;
+ }
let userRouterArr = ['statistics', 'projects', 'notice', 'devops', 'organizes', 'info', 'watchers', 'fan_users', 'password'];
return (
- {/* (
- secondRouter && (!userRouterArr.includes(secondRouter)) ?
- :
- )}
- > */}
{secondRouter && (!userRouterArr.includes(secondRouter)) ? : (
-
+
)}
>}