diff --git a/src/App.js b/src/App.js index c55f22072..b0770d073 100644 --- a/src/App.js +++ b/src/App.js @@ -203,7 +203,7 @@ class App extends Component { }; componentDidMount() { - document.title = "loading..."; + document.title = "项目托管"; this.getAppdata(); @@ -229,7 +229,7 @@ class App extends Component { this.setState({ mygetHelmetapi: undefined }); - document.title = "Forge"; + // document.title = "Forge"; var link = document.createElement('link'), oldLink = document.getElementById('dynamic-favicon'); link.id = 'dynamic-favicon'; @@ -243,7 +243,7 @@ class App extends Component { //获取数据的时候 gettablogourldata = (response) => { - document.title = response.data.setting.name; + // document.title = response.data.setting.name; var link = document.createElement('link'), oldLink = document.getElementById('dynamic-favicon'); link.id = 'dynamic-favicon'; diff --git a/src/AppConfig.js b/src/AppConfig.js index 4bf27d1b1..7a8272a7a 100644 --- a/src/AppConfig.js +++ b/src/AppConfig.js @@ -32,7 +32,7 @@ export function initAxiosInterceptors(props) { // 判断网络是否连接 initOnlineOfflineListener(); - var proxy = "https://code.educoder.net"; + var proxy = "https://testforgeplus.educoder.net"; //响应前的设置 axios.interceptors.request.use( config => { diff --git a/src/context/TPIContextProvider.js b/src/context/TPIContextProvider.js index f3ea3e0fd..66f6f6225 100644 --- a/src/context/TPIContextProvider.js +++ b/src/context/TPIContextProvider.js @@ -457,7 +457,7 @@ class TPIContextProvider extends Component { testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0), }) - window.document.title = resData.shixun.name + // window.document.title = resData.shixun.name window.__myshixun = resData.myshixun; // tpi_html_show需要用到 } diff --git a/src/forge/About/Index.jsx b/src/forge/About/Index.jsx index be7e01d01..e8dc12012 100644 --- a/src/forge/About/Index.jsx +++ b/src/forge/About/Index.jsx @@ -19,13 +19,17 @@ function Index(props){ const { isManager , isDeveloper , current_user } = props; + + const {projectDetail} = props; + useEffect(()=>{ + if(projectDetail){ + const { author, name} = projectDetail; + document.title = `主页-${author.name}/${name}`; + } + },[projectDetail]) + useEffect(()=>{ if(owner && projectsId){ - const {projectDetail} = props; - if(projectDetail){ - const { author, name} = projectDetail; - document.title = `主页-${author.name}/${name}`; - } Init(); } },[owner,projectsId]) diff --git a/src/forge/Activity/Activity.js b/src/forge/Activity/Activity.js index 7aa2536fa..158ec4c6d 100644 --- a/src/forge/Activity/Activity.js +++ b/src/forge/Activity/Activity.js @@ -53,11 +53,6 @@ class Activity extends Component{ } } componentDidMount=()=>{ - const {projectDetail} = this.props; - if(projectDetail){ - const { author, name} = projectDetail; - document.title = `动态-${author.name}/${name}`; - } const { time,type,status,page } = this.state; this.setState({ isSpin:true @@ -65,6 +60,19 @@ class Activity extends Component{ this.getInfo(time,type,status,page); } + + componentDidUpdate(){ + this.updateDocumentTitle(); + } + // 更新网页标题 + updateDocumentTitle(){ + const {projectDetail} = this.props; + if(projectDetail){ + const { author, name} = projectDetail; + document.title = `动态-${author.name}/${name}`; + } + } + getInfo =(time,type,status,page)=>{ const { projectsId , owner } = this.props.match.params; const url = `/${owner}/${projectsId}/activity.json`; diff --git a/src/forge/DevOps/Dispose.jsx b/src/forge/DevOps/Dispose.jsx index e8a172316..b35fab389 100644 --- a/src/forge/DevOps/Dispose.jsx +++ b/src/forge/DevOps/Dispose.jsx @@ -27,17 +27,12 @@ function Dispose(props){ const current_user = props.current_user; let projectsId = props.match.params.projectsId; let owner = props.match.params.owner; - useEffect(()=>{ - const {projectDetail} = props; - if(projectDetail){ - const { author, name} = projectDetail; - document.title = `引擎-${author.name}/${name}`; - } - },[]) // 获取用户的身份角色 useEffect(()=>{ if(projectDetail){ setPermission(props.projectDetail.permission); + const { author, name} = projectDetail; + document.title = `引擎-${author.name}/${name}`; } },[projectDetail]) diff --git a/src/forge/DevOps/Index.jsx b/src/forge/DevOps/Index.jsx index ee889182b..c1f8209ed 100644 --- a/src/forge/DevOps/Index.jsx +++ b/src/forge/DevOps/Index.jsx @@ -33,13 +33,13 @@ const Params = Loadable({ export default ((props)=>{ + const {projectDetail} = props; useEffect(()=>{ - const {projectDetail} = props; if(projectDetail){ const { author, name} = projectDetail; document.title = `引擎-${author.name}/${name}`; } - },[]) + },[projectDetail]) return( diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index 91a4d88db..237ebec6d 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -72,7 +72,7 @@ function CoderDepot(props){ const { author, name} = projectDetail; document.title = `${author.name}/${name}`; } - },[]) + },[projectDetail]) useEffect(()=>{ if(bannerList && bannerList.length>0){ diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index 7a4bff69c..213d891c8 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -369,6 +369,7 @@ class Detail extends Component { getDetail = () => { const { projectsId, owner } = this.props.match.params; + const { project } =this.state; const url = `/${owner}/${projectsId}/detail.json`; axios.get(url).then((result) => { if (result && result.data) { diff --git a/src/forge/Main/sub/Contribute.jsx b/src/forge/Main/sub/Contribute.jsx index 115452964..788ac62bd 100644 --- a/src/forge/Main/sub/Contribute.jsx +++ b/src/forge/Main/sub/Contribute.jsx @@ -16,14 +16,14 @@ function Contribute(props){ const owner = props.match.params.owner; const projectsId = props.match.params.projectsId; const LIMIT = 20; + const {projectDetail} = props; useEffect(()=>{ - const {projectDetail} = props; if(projectDetail){ const { author, name} = projectDetail; document.title = `贡献者-${author.name}/${name}`; } - },[]) + },[projectDetail]) useEffect(()=>{ if(owner && projectsId){ diff --git a/src/forge/Merge/CreateMerge.js b/src/forge/Merge/CreateMerge.js index 5eb12fd6b..58f668e02 100644 --- a/src/forge/Merge/CreateMerge.js +++ b/src/forge/Merge/CreateMerge.js @@ -103,14 +103,19 @@ class CreateMerge extends Component { this.getMergeInfo(branchParams,true); this.checkBranch(branchParams); + }; + + // 更新网页标题 + updateDocumentTitle(){ const {projectDetail} = this.props; if(projectDetail){ const { author, name} = projectDetail; document.title = `新建合并请求-${author.name}/${name}`; } - }; + } componentDidUpdate = (preProps) => { + this.updateDocumentTitle(); // url变化触发时(切换源分支、切换目标仓库、切换目标分支;回退) const oldPathname = preProps.location.pathname; const newPathname = this.props.location.pathname; diff --git a/src/forge/Merge/merge.js b/src/forge/Merge/merge.js index 729f1b387..ba88a40fe 100644 --- a/src/forge/Merge/merge.js +++ b/src/forge/Merge/merge.js @@ -67,12 +67,18 @@ class merge extends Component { this.getSelectList(); this.getIssueList(); + }; + componentDidUpdate=()=>{ + this.updateDocumentTitle(); + } + // 更新网页标题 + updateDocumentTitle(){ const {projectDetail} = this.props; if(projectDetail){ const { author, name} = projectDetail; - document.title = `合并请求-${author.name}/${name}`; + document.title = `新建合并请求-${author.name}/${name}`; } - }; + } getSelectList = () => { const { projectsId,owner } = this.props.match.params; diff --git a/src/forge/New/Index.js b/src/forge/New/Index.js index ab6542f17..bff296264 100644 --- a/src/forge/New/Index.js +++ b/src/forge/New/Index.js @@ -61,6 +61,13 @@ class Index extends Component { this.getOwner(); //判断是否为删除新建项目失败后返回,并执行对应逻辑 this.isDeleteProjectBack(); + + const { projectsType } = this.props.match.params; + if(projectsType === "mirror"){ + document.title = '导入项目' + }else{ + document.title = '新建项目' + } } componentDidUpdate=(prevPros)=>{ if(prevPros && this.props && !this.props.checkIfLogin()){ diff --git a/src/forge/Order/Milepost.js b/src/forge/Order/Milepost.js index b1eb6e13f..a6f0c3cb6 100644 --- a/src/forge/Order/Milepost.js +++ b/src/forge/Order/Milepost.js @@ -29,10 +29,16 @@ class Milepost extends Component { componentDidMount = () => { this.getList(1, this.state.status, 'desc'); + } + componentDidUpdate = () => { + this.updateDocumentTitle(); + } + // 更新网页标题 + updateDocumentTitle(){ const {projectDetail} = this.props; if(projectDetail){ const { author, name} = projectDetail; - document.title = `里程碑-${author.name}/${name}`; + document.title = `新建合并请求-${author.name}/${name}`; } } diff --git a/src/forge/Order/order.js b/src/forge/Order/order.js index d986147e2..5e6969f5e 100644 --- a/src/forge/Order/order.js +++ b/src/forge/Order/order.js @@ -75,15 +75,20 @@ class order extends Component { }; } - - - - componentDidMount = () => { + componentDidUpdate(){ + this.updateDocumentTitle(); + } + // 更新网页标题 + updateDocumentTitle(){ const {projectDetail} = this.props; if(projectDetail){ const { author, name} = projectDetail; document.title = `疑修-${author.name}/${name}`; } + } + + + componentDidMount = () => { const datas = cookie.load('states'); let states = datas === "undefined" ? undefined : datas; if(states){ diff --git a/src/forge/Quality/index.js b/src/forge/Quality/index.js index b720e63a8..28e1a04c5 100644 --- a/src/forge/Quality/index.js +++ b/src/forge/Quality/index.js @@ -26,12 +26,15 @@ function Quality(props){ "INFO":"建议缺陷", "MAJOR":"一般缺陷", } + const {projectDetail} = props; useEffect(()=>{ - const {projectDetail} = props; if(projectDetail){ const { author, name} = projectDetail; document.title = `质量分析-${author.name}/${name}`; } + },[projectDetail]) + + useEffect(()=>{ getTask() return () => { clearInterval(timer) diff --git a/src/forge/Settings/Index.js b/src/forge/Settings/Index.js index a9505e94c..f87b173be 100644 --- a/src/forge/Settings/Index.js +++ b/src/forge/Settings/Index.js @@ -48,7 +48,6 @@ class Index extends Component { componentDidMount = () => { - this.getList(); const {projectDetail} = this.props; if(projectDetail){ const { author, name} = projectDetail; diff --git a/src/forge/Source/Index.jsx b/src/forge/Source/Index.jsx index 4038adf7e..077e379d3 100644 --- a/src/forge/Source/Index.jsx +++ b/src/forge/Source/Index.jsx @@ -25,14 +25,16 @@ function Index(props){ const [ visible , setVisible ] = useState(false); const repo_id = props.projectDetail && props.projectDetail.repo_id; const owner = props.match.params.owner; - + const {projectDetail} = props; + useEffect(()=>{ + if(projectDetail){ + const { author, name} = projectDetail; + document.title = `资源-${author.name}/${name}`; + } + },[projectDetail]) + useEffect(()=>{ if(owner && repo_id){ - const {projectDetail} = props; - if(projectDetail){ - const { author, name} = projectDetail; - document.title = `资源-${author.name}/${name}`; - } getData(); } },[repo_id,owner,search,sortValue,page]) diff --git a/src/forge/users/Infos.js b/src/forge/users/Infos.js index db063c9ee..ef084afb2 100644 --- a/src/forge/users/Infos.js +++ b/src/forge/users/Infos.js @@ -108,6 +108,7 @@ class Infos extends Component { componentDidMount = () => { this.fetchUser(); + document.title = "个人中心"; }; componentDidUpdate=(prevProps)=>{ diff --git a/src/modules/tpm/TPMIndexHOC.js b/src/modules/tpm/TPMIndexHOC.js index 75fa9e972..696c7ec67 100644 --- a/src/modules/tpm/TPMIndexHOC.js +++ b/src/modules/tpm/TPMIndexHOC.js @@ -79,7 +79,7 @@ export function TPMIndexHOC(WrappedComponent) { this.setState({ mygetHelmetapi: undefined }); - document.title = "Forge"; + // document.title = "Forge"; var link = document.createElement('link'), oldLink = document.getElementById('dynamic-favicon'); link.id = 'dynamic-favicon'; @@ -93,7 +93,7 @@ export function TPMIndexHOC(WrappedComponent) { //获取数据的时候 gettablogourldata = (response) => { - document.title = response.data.setting.name; + // document.title = response.data.setting.name; var link = document.createElement('link'), oldLink = document.getElementById('dynamic-favicon'); link.id = 'dynamic-favicon';