diff --git a/config/webpack.config.prod.js b/config/webpack.config.prod.js
index a7b2c9f4e..4a9d94652 100644
--- a/config/webpack.config.prod.js
+++ b/config/webpack.config.prod.js
@@ -19,7 +19,8 @@ const getClientEnvironment = require("./env");
let publicPath = "/react/build/";
const publicUrl = publicPath.slice(0, -1);
-const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== "false";
+// const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== "false";
+const shouldUseSourceMap = process.env.NODE_ENV !== "production";
const env = getClientEnvironment(publicPath);
// This is the production configuration.
@@ -54,7 +55,8 @@ module.exports = {
},
bail: true,
mode: "production",
- devtool: false, //测试版
+ // devtool: false, //测试版
+ devtool: shouldUseSourceMap?'source-map':false,
entry: [require.resolve("./polyfills"), paths.appIndexJs],
output: {
path: paths.appBuild,
diff --git a/src/App.js b/src/App.js
index 6d8397f4f..d9e1a3ef1 100644
--- a/src/App.js
+++ b/src/App.js
@@ -114,13 +114,22 @@ 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:''});
newPathname && this.getPathnameType(newPathname);
}
});
}
+ shouldComponentUpdate(nextProps, nextState) {
+ if (nextProps.location.pathname.split('/')[1] !== this.props.location.pathname.split('/')[1] && nextState.pathType === this.state.pathType) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
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"];
+ 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) => {
@@ -308,6 +317,16 @@ class App extends Component {
}>
*/}
+ {/*项目*/}
+ {
+ return ()
+ }
+ }>
+
+
{/* 判断为用户/组织,并进入对应页面 */}
{
pathType === 'User' ?
@@ -335,16 +354,7 @@ class App extends Component {
/>
}
- {/*项目*/}
- {
- return ()
- }
- }>
-
-
+
{/* 组织 */}
{/* 个人主页 */}
-
{
diff --git a/src/AppConfig.js b/src/AppConfig.js
index 381ce19ac..5849a85f6 100644
--- a/src/AppConfig.js
+++ b/src/AppConfig.js
@@ -86,7 +86,7 @@ export function initAxiosInterceptors(props) {
if (response.data.status === 404) {
let responseURL = response.request ? response.request.responseURL:'';
- if (responseURL.indexOf('/api/users/') === -1 && responseURL.indexOf('/api/organizations/') === -1) {
+ if (responseURL.indexOf('/api/users/') === -1 && responseURL.indexOf('/api/organizations/') === -1 && responseURL.indexOf('/api/owners/') === -1) {
locationurl('/nopage');
}
}
diff --git a/src/forge/Index.js b/src/forge/Index.js
index 7a3ccac5b..361ebee11 100644
--- a/src/forge/Index.js
+++ b/src/forge/Index.js
@@ -21,10 +21,11 @@ const ProjectIndex = Loadable({
loading: Loading,
});
-const ProjectDetail = Loadable({
- loader: () => import("./Main/Detail"),
- loading: Loading,
-});
+// 项目详情放在用户和组织下作为二级菜单存在
+// const ProjectDetail = Loadable({
+// loader: () => import("./Main/Detail"),
+// loading: Loading,
+// });
class Index extends Component {
@@ -40,35 +41,35 @@ class Index extends Component {
(
)}
>
(
)}
>
(
)}
>
- (
)}
- >
- {/* */}
+ (
)}
- > */}
+ >
(
@@ -80,16 +81,16 @@ class Index extends Component {
);
}
}
-// export default withRouter(
-// ImageLayerOfCommentHOC({
-// imgSelector: ".imageLayerParent img, .imageLayerParent .imageTarget",
-// parentSelector: ".newMain",
-// })(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Index))))
-// );
-
export default withRouter(
ImageLayerOfCommentHOC({
imgSelector: ".imageLayerParent img, .imageLayerParent .imageTarget",
parentSelector: ".newMain",
- })(Index)
+ })(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Index))))
);
+
+// export default withRouter(
+// ImageLayerOfCommentHOC({
+// imgSelector: ".imageLayerParent img, .imageLayerParent .imageTarget",
+// parentSelector: ".newMain",
+// })(Index)
+// );
diff --git a/src/forge/Team/Index.jsx b/src/forge/Team/Index.jsx
index 2b75a35ef..e3266c88d 100644
--- a/src/forge/Team/Index.jsx
+++ b/src/forge/Team/Index.jsx
@@ -26,6 +26,11 @@ const SubDetailIndex = Loadable({
loader: () => import("./Sub/SubDetail"),
loading: Loading,
});
+// forge项目详情
+const ProjectDetail = Loadable({
+ loader: () => import("../Main/Detail"),
+ loading: Loading,
+});
export default withRouter(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(
((props)=>{
return (
@@ -66,6 +71,15 @@ export default withRouter(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(
return
}}
>
+
+ {/* 组织下的项目详情 */}
+ (
+
+ )}
+ >
+
{/* 组织详情(包含组织设置) */}
import('../Index'),
+// const Projects = Loadable({
+// loader: () => import('../Index'),
+// loading: Loading,
+// })
+// forge项目详情
+const ProjectDetail = Loadable({
+ loader: () => import("../Main/Detail"),
loading: Loading,
-})
+});
export default withRouter(
(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC((props) => {
- console.log(props.location.pathname);
+ // 个人中心新增的二级目录都需在此添加一次。将项目放组织和个人名下后,此处根据二级目录作判断,
let secondRouter = '';
if (props.location.pathname) {
secondRouter = props.location.pathname.split('/')[2];
@@ -25,13 +30,26 @@ export default withRouter(
let userRouterArr = ['statistics', 'projects', 'notice', 'devops', 'organizes', 'info', 'watchers', 'fan_users', 'password'];
return (
- (
secondRouter && (!userRouterArr.includes(secondRouter)) ?
- :
+ :
)}
- >
+ > */}
+
+ {secondRouter && (!userRouterArr.includes(secondRouter)) ? (
+
+ )}
+ > : (
+
+ )}
+ >}
+
)
}))))