From 1764fbdb883304636823e0b1e0328cc3a1a8a656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= <792998983@qq.com> Date: Fri, 3 Sep 2021 21:51:53 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E9=80=9F=E5=BA=A6=E9=80=9F=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Main/Detail.js | 2 +- src/forge/Main/DetailAdaptor.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 src/forge/Main/DetailAdaptor.js diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index 3303d42c..803b4c74 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -142,7 +142,7 @@ const WikiEdit = Loadable({ function checkPathname(projectsId, owner, pathname) { let name = ""; if (pathname && pathname !== `/${owner}/${projectsId}`) { - let url = pathname.split(`/${owner}/${projectsId}`)[1]; + let url = pathname.split(`/${owner}/${projectsId}`)[1] || ''; if (url.indexOf("/about") > -1) { name = "about" } else if (url.indexOf("/issues") > -1 || url.indexOf("Milepost") > 0) { diff --git a/src/forge/Main/DetailAdaptor.js b/src/forge/Main/DetailAdaptor.js new file mode 100644 index 00000000..4f2fba26 --- /dev/null +++ b/src/forge/Main/DetailAdaptor.js @@ -0,0 +1,6 @@ +import Detail from "./Detail"; +import { SnackbarHOC } from "educoder"; +import { CNotificationHOC } from "../../modules/courses/common/CNotificationHOC"; +import { TPMIndexHOC } from "../../modules/tpm/TPMIndexHOC"; + +export default CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Detail))); \ No newline at end of file From a90eeac318365f000880cdd45fdc4792d5a4d660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= <792998983@qq.com> Date: Sat, 4 Sep 2021 11:16:08 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=B8=8A=E4=BC=A0PR=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.js | 19 ++++++++++++++++++- src/forge/Main/DetailAdaptor.js | 26 ++++++++++++++++++++++++-- src/forge/Merge/NewMerge.js | 14 +++++++++++--- 3 files changed, 53 insertions(+), 6 deletions(-) diff --git a/src/App.js b/src/App.js index af5532ad..f0fe80b1 100644 --- a/src/App.js +++ b/src/App.js @@ -19,7 +19,7 @@ import moment from 'moment' import { MuiThemeProvider, createMuiTheme } from 'material-ui/styles'; import SiderBar from './forge/Component/SiderBar' -import { SnackbarHOC } from 'educoder' +import { SnackbarHOC } from 'educoder'; import { initAxiosInterceptors } from './AppConfig' import { Provider } from 'react-redux'; import configureStore from './redux/stores/configureStore'; @@ -39,6 +39,11 @@ const Projects = Loadable({ loader: () => import('./forge/Index'), loading: Loading, }) +// forge项目详情 +const ProjectDetail = Loadable({ + loader: () => import("./forge/Main/DetailAdaptor"), + loading: Loading, +}); //forge安全设置 const Security = Loadable({ loader: () => import('./forge/SecuritySetting/Index'), @@ -92,6 +97,11 @@ const ProjectIndex = Loadable({ loading: Loading, }); +const CreateMerge = Loadable({ + loader: () => import('./forge/Merge/NewMerge'), + 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"]; @@ -268,6 +278,13 @@ class App extends Component { } } /> + {/* 项目PR */} + () + } + > + {/*项目*/} import("../Main/Detail"), + loading: Loading, +}); +export default withRouter( + (CNotificationHOC()(SnackbarHOC()(TPMIndexHOC((props) => { + return ( + + ( + + )} + > + + ) + })))) +) \ No newline at end of file diff --git a/src/forge/Merge/NewMerge.js b/src/forge/Merge/NewMerge.js index 956be000..7d33028d 100644 --- a/src/forge/Merge/NewMerge.js +++ b/src/forge/Merge/NewMerge.js @@ -48,8 +48,10 @@ class NewMerge extends Component { this.compareProject(this.state.id,pull,"master"); } } + // 页面销毁取消监听 componentWillUnmount () { + console.log('----------destoyed---------'); window.removeEventListener('popstate', this.handleBack, false); }; @@ -60,8 +62,11 @@ class NewMerge extends Component { //获取新建分支数据 getmergelist = (projectsId) => { - this.setState({isSpin: true}) - const { owner } = this.props.match.params; + this.setState({isSpin: true}); + // const { owner } = this.props.match.params; + let owner =this.props.history.location.pathname.split('/')[1]; + console.log('owner:'+owner); + console.log(this.props); const url = `/${owner}/${projectsId}/pulls/new.json`; axios .get(url) @@ -264,7 +269,9 @@ class NewMerge extends Component { show_message, default_message, merge_head, - projects_names,id,comparesData + projects_names, + id, + comparesData } = this.state; const renderBrances = (list, type) => { @@ -298,6 +305,7 @@ class NewMerge extends Component { return
; }; let { project } = this.props; + return (
From 33a669a9403dac0a2919d207b81c0400f6f5e720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= <792998983@qq.com> Date: Mon, 6 Sep 2021 10:37:06 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC404=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.js | 5 +++-- src/AppConfig.js | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/App.js b/src/App.js index f0fe80b1..442d4f32 100644 --- a/src/App.js +++ b/src/App.js @@ -103,7 +103,7 @@ const CreateMerge = Loadable({ }) // 此处仅维护前端可能的一级路由,不用进行项目或者组织判断的字段。 -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"]; +const keyWord = ["explore", "settings", "setting", "mulan", "wiki", "issues", "setting", "trending", "code", "projects", "pulls", "mine", "login", "register", "email", "export", "nopage", "404", "403", "500", "501", "search", "organize"]; class App extends Component { constructor(props) { @@ -365,7 +365,7 @@ class App extends Component { return () } }> - : pathType === '404' ? : + : pathType === '404' ? : ( @@ -377,6 +377,7 @@ class App extends Component { } /> // + // } diff --git a/src/AppConfig.js b/src/AppConfig.js index 825a2a3b..ea85a4e5 100644 --- a/src/AppConfig.js +++ b/src/AppConfig.js @@ -11,9 +11,9 @@ broadcastChannelOnmessage('refreshPage', () => { }) function locationurl(list) { - // if (window.location.port !== "3007") { + if (window.location.port !== "3007") { window.location.href = list - // } + } } // TODO 开发期多个身份切换 let debugType = "" @@ -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 && responseURL.indexOf('/api/owners/') === -1) { + if (responseURL.indexOf('/api/users/') === -1 && responseURL.indexOf('/api/organizations/') === -1 ) { locationurl('/nopage'); } }