diff --git a/src/App.js b/src/App.js index 9d7745691..28b3f7861 100644 --- a/src/App.js +++ b/src/App.js @@ -232,7 +232,7 @@ class App extends Component { this.setState({ mygetHelmetapi: undefined }); - document.title = "Forge"; + // document.title = "GitLink | 确实开源"; var link = document.createElement('link'), oldLink = document.getElementById('dynamic-favicon'); link.id = 'dynamic-favicon'; @@ -246,7 +246,7 @@ class App extends Component { //获取数据的时候 gettablogourldata = (response) => { - document.title = response.data.setting.name; + // document.title = `app${response.data.setting.name}`; var link = document.createElement('link'), oldLink = document.getElementById('dynamic-favicon'); link.id = 'dynamic-favicon'; diff --git a/src/forge/About/Index.jsx b/src/forge/About/Index.jsx index b36b815cf..0546278f5 100644 --- a/src/forge/About/Index.jsx +++ b/src/forge/About/Index.jsx @@ -16,14 +16,14 @@ function Index(props){ const [ fileList , setFileList ] = useState(undefined); const [ editOpration , setEditOpration ] = useState(false); const { owner , projectsId } = props.match.params; - - const { isManager , isDeveloper , current_user } = props; - + const { isManager , isDeveloper , current_user, projectDetail } = props; + useEffect(()=>{ - if(owner && projectsId){ + if(owner && projectsId && projectDetail){ Init(); + document.title = `主页-${projectDetail.author.name}/${projectDetail.name}`; } - },[owner,projectsId]) + },[owner,projectsId, projectDetail]) useEffect(()=>{ if( (current_user && current_user.login) && (isManager === true || isDeveloper === true)){ diff --git a/src/forge/AboutUs/AboutUs.jsx b/src/forge/AboutUs/AboutUs.jsx index 2113f7c75..7f63044a9 100644 --- a/src/forge/AboutUs/AboutUs.jsx +++ b/src/forge/AboutUs/AboutUs.jsx @@ -32,6 +32,7 @@ function AboutUs(){ const [units, setUnits] = useState([]); useEffect(()=>{ + document.title="关于我们"; //添加浏览器滚动监听事件 window.addEventListener('scroll', scrollListener); //请求topics.json接口获取合作单位信息 diff --git a/src/forge/Activity/Activity.js b/src/forge/Activity/Activity.js index 1525cb499..5f04acfcc 100644 --- a/src/forge/Activity/Activity.js +++ b/src/forge/Activity/Activity.js @@ -53,6 +53,7 @@ class Activity extends Component{ } } componentDidMount=()=>{ + this.updateDocumentTitle(); const { time,type,status,page } = this.state; this.setState({ isSpin:true @@ -60,6 +61,19 @@ class Activity extends Component{ this.getInfo(time,type,status,page); } + componentDidUpdate(){ + this.updateDocumentTitle(); + } + + // 更新网页标题 + updateDocumentTitle(){ + const {projectDetail} = this.props; + if(projectDetail && document.title.indexOf('动态-') === -1){ + 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/Branch/Select.jsx b/src/forge/Branch/Select.jsx index a39f9556f..5dd2e99bd 100644 --- a/src/forge/Branch/Select.jsx +++ b/src/forge/Branch/Select.jsx @@ -57,7 +57,7 @@ export default (({ projectsId , branch , owner , changeBranch , branchList , tag
setVisible(visible ? false : true)}> {/* {nav === 0 ?"分支":"标签"} */} - + {showValue} diff --git a/src/forge/Component/SiderBar.js b/src/forge/Component/SiderBar.js index 61e6f85e3..b3900311b 100644 --- a/src/forge/Component/SiderBar.js +++ b/src/forge/Component/SiderBar.js @@ -161,7 +161,7 @@ function SiderBar(props) {
{/* /Gitlink/forgeplus */} {failApply &&
{failApply}
} -
若需上传截图,请{setFeedBackModal(false); history.push('/xxq250/BootstrapAdmin/issues/new?type=feedback')}} className='gotoIssueFeedBack'>点击此处留言
+
若需上传截图,请{setFeedBackModal(false); history.push('/Gitlink/forgeplus/issues/new?type=feedback')}} className='gotoIssueFeedBack'>点击此处留言
) diff --git a/src/forge/DevOps/Index.jsx b/src/forge/DevOps/Index.jsx index 8feaf29d6..8cc6bc818 100644 --- a/src/forge/DevOps/Index.jsx +++ b/src/forge/DevOps/Index.jsx @@ -33,10 +33,17 @@ const Params = Loadable({ }) export default ((props)=>{ - const {isManager, project} = props; + const {isManager, project, projectDetail} = props; const { projectsId, owner } = props.match.params; const [jianmu_devops, setJianmu_devops] = useState(undefined); + useEffect(()=>{ + if(projectDetail){ + const { author, name} = projectDetail; + document.title = `引擎-${author.name}/${name}`; + } + }, [projectDetail]) + useEffect(()=>{ // 请求simple接口获取jianmu_devops const url = `/${owner}/${projectsId}/simple.json`; diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index aff47e0bf..fd6b6661b 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -41,7 +41,7 @@ function CoderDepot(props){ const [ fileInfo ,setFileInfo ] = useState(undefined);//文件内容信息 const [ zip_url , setZip_url ] = useState(undefined); const [ tar_url , setTar_url ] = useState(undefined); - const [ readOnly , setReadOnly] = useState(true); + const [ readOnly , setReadOnly] = useState(undefined); const [ isSpin , setIsSpin] = useState(true); const [ visible ,setVisible ] = useState(false); const [ mainFlag ,setMainFlag ] = useState(false); @@ -65,7 +65,6 @@ function CoderDepot(props){ //distribution:判断此用户是否可以创建发行版 const distribution = details && details.type != 2 && (details.permission === "Admin" || details.permission === "Owner" || details.permission === "Manager"); const { bannerList } = props; - useEffect(()=>{ if(bannerList && bannerList.length>0){ let a = bannerList.filter(i=>i.menu_name === "pulls"); @@ -102,6 +101,19 @@ function CoderDepot(props){ } },[details]) + useEffect(()=>{ + // 设置网页标题 + if(details){ + const { author, name, description, default_branch} = details; + if(branchName && branchName !== default_branch){ + // 处于某分支/标签 + document.title = `${author.name}/${name}-${branchName}`; + }else{ + document.title = `${author.name}/${name}${description?': '+description:''}`; + } + } + }, [treeValuePath, details, branchName]) + useEffect(()=>{ if(treeValue){ setTreeValuePath(decodeURIComponent(treeValue).split('/')); @@ -127,6 +139,7 @@ function CoderDepot(props){ },[projectsId,owner,pathname,defaultBranch]) useEffect(()=>{ + setReadOnly(props.history.location.search.indexOf('edit') !== -1); axios.get(`/${owner}/${projectsId}/releases.json`).then((result)=>{ if(result && result.data){ const release = { @@ -289,12 +302,18 @@ function CoderDepot(props){ function onEdit(readOnly){ setReadOnly(readOnly); setEditReadme(false); + const {history} = props; + if(readOnly){ + history.push(history.location.pathname); + }else{ + history.push(`${history.location.pathname}?edit`); + } } function ChangeFile(path, readOnly){ //点击直接跳转页面 加载一次路由 let enBranch = branchName || defaultBranch; let checkvalue = turnbar(enBranch); - props.history.push(`/${owner}/${projectsId}/tree/${checkvalue}/${path}`); + props.history.push(`/${owner}/${projectsId}/tree/${checkvalue}/${path}?edit`); setType("file"); setEditReadme(true); }; @@ -537,6 +556,7 @@ function CoderDepot(props){ currentBranch={branchName || defaultBranch} branch={branchName || defaultBranch} type={projectDetail.type} + treeValuePath={treeValuePath} > } diff --git a/src/forge/Main/CoderRootCommit.js b/src/forge/Main/CoderRootCommit.js index b3beef413..3df0bfef8 100644 --- a/src/forge/Main/CoderRootCommit.js +++ b/src/forge/Main/CoderRootCommit.js @@ -31,10 +31,20 @@ class CoderRootCommit extends Component{ } componentDidMount=()=>{ + this.updateDocumentTitle(); this.Init(); this.getBranchs(); } + // 更新网页标题 + updateDocumentTitle(){ + const {projectDetail} = this.props; + if(projectDetail && document.title.indexOf('提交-') === -1){ + const { author, name} = projectDetail; + document.title = `提交-${author.name}/${name}`; + } + } + // 获取分支列表 getBranchs=()=>{ const { projectsId , owner } = this.props.match.params; @@ -46,6 +56,7 @@ class CoderRootCommit extends Component{ } componentDidUpdate=(prevProps)=>{ + this.updateDocumentTitle(); const { location } = this.props; const prevlocation = prevProps && prevProps.location; if (location !== prevlocation) { diff --git a/src/forge/Main/CoderRootFileDetail.js b/src/forge/Main/CoderRootFileDetail.js index a50c30f4d..d73fdea01 100644 --- a/src/forge/Main/CoderRootFileDetail.js +++ b/src/forge/Main/CoderRootFileDetail.js @@ -27,6 +27,7 @@ class CoderRootFileDetail extends Component { } componentDidMount = () => { + this.updateDocumentTitle(); window.scrollTo(0, 0); const { detail , mdFlag } = this.props; this.setState({ @@ -36,6 +37,7 @@ class CoderRootFileDetail extends Component { }; componentDidUpdate=(prevProps)=>{ + this.updateDocumentTitle(); const { replace_content } = this.props && this.props.detail; const prevcontent = prevProps.detail && prevProps.detail.replace_content; if (replace_content && prevcontent) { @@ -47,6 +49,16 @@ class CoderRootFileDetail extends Component { } } + // 更新网页标题 + updateDocumentTitle(){ + const {projectDetail, treeValuePath, location} = this.props; + const readOnly = location && location.search.indexOf('edit') === -1 + if(projectDetail && treeValuePath){ + const { author, name} = projectDetail; + document.title = `${readOnly ? treeValuePath.join('/') : '编辑'+treeValuePath[treeValuePath.length-1]}-${author.name}/${name}`; + } + } + languages_total = () => { const { detail } = this.props; const file_name = detail.path.split("/").pop().split(".").pop(); @@ -200,7 +212,6 @@ class CoderRootFileDetail extends Component { render() { const { - readOnly, detail, current_user, isManager, @@ -210,6 +221,8 @@ class CoderRootFileDetail extends Component { md, type } = this.props; + // 文件只读状态 + const readOnly = this.props.history.location.search.indexOf('edit') === -1 const { language, languages, description } = this.state; let flag = current_user && current_user.login && (isManager || isDeveloper); const Option = Select.Option; diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index 02fce6360..6a165223c 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -403,7 +403,6 @@ class Detail extends Component { forked_count: result.data.forked_count, defaultBranch: result.data.default_branch }); - document.title = `${result.data.author.name}/${result.data.name}${result.data.description?':'+result.data.description:''}`; } } }).catch((error) => { }) diff --git a/src/forge/Main/Diff.jsx b/src/forge/Main/Diff.jsx index 51eca8816..bb644fc03 100644 --- a/src/forge/Main/Diff.jsx +++ b/src/forge/Main/Diff.jsx @@ -49,13 +49,21 @@ const Infos = styled.div` `; //提交详情页 export default (props) => { - const {match , history } = props; + const {match , history, projectDetail } = props; const [data, setData] = useState({undefined}); const [commit, setCommit] = useState(undefined); const [parents, setParents] = useState(undefined); const [committer, setCommitter] = useState(undefined); const [isSpin, setIsSpin] = useState(true); const { sha , projectsId, owner } = match.params; + + useEffect(()=>{ + if(projectDetail){ + const { author, name} = projectDetail; + document.title = `${commit && commit.message ? commit.message+'-' : ''}${sha}-${author.name}/${name}`; + } + }, [projectDetail, sha, commit]) + useEffect(() => { if (projectsId && owner && sha) { const url = `/${owner}/${projectsId}/commits/${sha}.json`; diff --git a/src/forge/Main/Index.js b/src/forge/Main/Index.js index 087abecc0..c95fe5650 100644 --- a/src/forge/Main/Index.js +++ b/src/forge/Main/Index.js @@ -59,6 +59,7 @@ class Index extends Component { this.getLanguage(); // this.getRecommandOri(); + document.title='开源项目'; } // 获取语言列表 diff --git a/src/forge/Main/projecthome/Index.jsx b/src/forge/Main/projecthome/Index.jsx index 81cd8b0c8..227ed4457 100644 --- a/src/forge/Main/projecthome/Index.jsx +++ b/src/forge/Main/projecthome/Index.jsx @@ -24,6 +24,7 @@ function Index() { useEffect(()=>{ getCate(); + document.title='开源项目'; },[]) useEffect(()=>{ diff --git a/src/forge/Main/tag/Index.jsx b/src/forge/Main/tag/Index.jsx index a80515aca..4c8beb065 100644 --- a/src/forge/Main/tag/Index.jsx +++ b/src/forge/Main/tag/Index.jsx @@ -18,6 +18,14 @@ function Tags(props) { const [total,setTotal] =useState(0); const [limit,setLimit] =useState(10); const { projectsId, owner } = props.match.params; + const { projectDetail} = props; + + useEffect(()=>{ + if(projectDetail && document.title.indexOf('所有标签-') === -1){ + const { author, name} = projectDetail; + document.title = `所有标签-${author.name}/${name}`; + } + }, [projectDetail]) useEffect(() => { if (projectsId) { diff --git a/src/forge/Main/tree/Index.jsx b/src/forge/Main/tree/Index.jsx index 3f4bc0c06..f1b9b920b 100644 --- a/src/forge/Main/tree/Index.jsx +++ b/src/forge/Main/tree/Index.jsx @@ -20,6 +20,13 @@ function Index(props) { getList(); },[]) + useEffect(()=>{ + if(projectDetail && document.title.indexOf('所有分支-') === -1){ + const { author, name} = projectDetail; + document.title = `所有分支-${author.name}/${name}`; + } + }, [projectDetail]) + const menu =(zip_url,tar_url)=> ( diff --git a/src/forge/Main/version/New.jsx b/src/forge/Main/version/New.jsx index 38fb6bf8a..e388e4078 100644 --- a/src/forge/Main/version/New.jsx +++ b/src/forge/Main/version/New.jsx @@ -42,6 +42,12 @@ export default Form.create()( } },[projectDetail]) + useEffect(()=>{ + if(projectDetail){ + const { author, name} = projectDetail; + document.title = `${versionId ? "编辑" : "创建"}发行版-${author.name}/${name}`; + } + }, [projectDetail, versionId]) useEffect(() => { if (versionId) { diff --git a/src/forge/Main/version/version.js b/src/forge/Main/version/version.js index 2d7312497..1dde17daa 100644 --- a/src/forge/Main/version/version.js +++ b/src/forge/Main/version/version.js @@ -17,12 +17,20 @@ function version(props) { const [ releases , setReleases ] = useState(undefined); const [ isSpin , setIsSpin ] = useState(true); const { projectsId ,owner } = props.match.params; - const { location } = props; + const { location, projectDetail } = props; const type = props.projectDetail && props.projectDetail.type; const turnFromNew = location && location.query && location.query.turnFromNew; useEffect(()=>{ getIssueList(); },[]) + + useEffect(()=>{ + if(projectDetail){ + const { author, name} = projectDetail; + document.title = `发行版-${author.name}/${name}`; + } + }, [projectDetail]) + // 获取列表数据 function getIssueList(){ const url = `/${owner}/${projectsId}/releases.json`; diff --git a/src/forge/Merge/CreateMerge.js b/src/forge/Merge/CreateMerge.js index 26e2ed520..932ecf06a 100644 --- a/src/forge/Merge/CreateMerge.js +++ b/src/forge/Merge/CreateMerge.js @@ -96,6 +96,7 @@ class CreateMerge extends Component { } componentDidMount = () => { + this.updateDocumentTitle(); // 初始化时根据url获取目标仓库、分支,源仓库、分支; // 再获取对应的仓库列表、分支列表 // 再调用比较接口 @@ -105,6 +106,7 @@ class CreateMerge extends Component { }; componentDidUpdate = (preProps) => { + this.updateDocumentTitle(); // url变化触发时(切换源分支、切换目标仓库、切换目标分支;回退) const oldPathname = preProps.location.pathname; const newPathname = this.props.location.pathname; @@ -115,6 +117,15 @@ class CreateMerge extends Component { } }; + // 更新网页标题 + updateDocumentTitle(){ + const {projectDetail} = this.props; + if(projectDetail && document.title.indexOf('新建合并请求-') === -1){ + const { author, name} = projectDetail; + document.title = `新建合并请求-${author.name}/${name}`; + } + } + //获取新建合并请求数据 getMergeInfo = (branchParams,init) => { this.setState({ isSpin: true }); diff --git a/src/forge/Merge/MessageCount.js b/src/forge/Merge/MessageCount.js index 8b4f8f30b..3a3db57a4 100644 --- a/src/forge/Merge/MessageCount.js +++ b/src/forge/Merge/MessageCount.js @@ -43,7 +43,12 @@ class MessageCount extends Component { }; } + componentDidUpdate(){ + this.updateDocumentTitle(); + } + componentDidMount = () => { + this.updateDocumentTitle(); this.setState({ SpinFlag: true, }); @@ -58,6 +63,16 @@ class MessageCount extends Component { } }; + // 更新网页标题 + updateDocumentTitle(){ + const {projectDetail} = this.props; + const {data} = this.state; + if(projectDetail && data){ + const { author, name} = projectDetail; + document.title = `${data.issue.subject}-合并请求-${author.name}/${name}`; + } + } + bindFootRef = (footRef) => { this.footRef = footRef; } diff --git a/src/forge/Merge/UpdateMerge.js b/src/forge/Merge/UpdateMerge.js index 2c97e3b45..d9167fa2a 100644 --- a/src/forge/Merge/UpdateMerge.js +++ b/src/forge/Merge/UpdateMerge.js @@ -21,6 +21,20 @@ class UpdateMerge extends Component { this.getmergelist(); }; + componentDidUpdate(){ + this.updateDocumentTitle(); + } + + // 更新网页标题 + updateDocumentTitle(){ + const {projectDetail} = this.props; + const {data} = this.state; + if(projectDetail && data){ + const { author, name} = projectDetail; + document.title = `${data.title}-合并请求-${author.name}/${name}`; + } + } + //获取新建分枝数据 getmergelist = () => { this.setState({ isSpin: true }); diff --git a/src/forge/Merge/merge.js b/src/forge/Merge/merge.js index 0f6aeea4d..e7a6c7de6 100644 --- a/src/forge/Merge/merge.js +++ b/src/forge/Merge/merge.js @@ -68,6 +68,19 @@ class merge extends Component { this.getIssueList(); }; + componentDidUpdate(){ + this.updateDocumentTitle(); + } + + // 更新网页标题 + updateDocumentTitle(){ + const {projectDetail} = this.props; + if(projectDetail){ + const { author, name} = projectDetail; + 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 4e1fb100a..86709b9cf 100644 --- a/src/forge/New/Index.js +++ b/src/forge/New/Index.js @@ -54,18 +54,26 @@ class Index extends Component { } } componentDidMount = () => { + this.updateDocumentTitle(); // 获取拥有者列表 this.getOwner(); //判断是否为删除新建项目失败后返回,并执行对应逻辑 this.isDeleteProjectBack(); } componentDidUpdate=(prevPros)=>{ + this.updateDocumentTitle(); if(prevPros && this.props && !this.props.checkIfLogin()){ this.props.history.push("/403") return } } + // 更新网页标题 + updateDocumentTitle(){ + const { projectsType } = this.props.match.params; + document.title = `${projectsType && projectsType === "mirror" ? "导入" : "新建"}项目`; + } + getOwner=()=>{ const { OIdentifier } = this.props.match.params; const { user_id } = this.props && this.props.current_user; @@ -561,7 +569,7 @@ class Index extends Component { className="privatePart" > {getFieldDecorator('is_mirror')( - 该仓库将是一个镜像(设置为镜像后,该项目为只读,不能进行push等相关操作) + 该仓库将是一个镜像(设置为镜像后,该仓库为只读,每24小时定时同步一次) )} } diff --git a/src/forge/Newfile/Index.js b/src/forge/Newfile/Index.js index 31ef58656..6e0ea20e4 100644 --- a/src/forge/Newfile/Index.js +++ b/src/forge/Newfile/Index.js @@ -15,6 +15,23 @@ class Index extends Component { }; } + componentDidUpdate(){ + this.updateDocumentTitle(); + } + + componentDidMount(){ + this.updateDocumentTitle(); + } + + // 更新网页标题 + updateDocumentTitle(){ + const {projectDetail} = this.props; + if(projectDetail && document.title.indexOf('新建文件-') === -1){ + const { author, name} = projectDetail; + document.title = `新建文件-${author.name}/${name}`; + } + } + // 命名文件 changeFileName = (e) => { this.setState({ diff --git a/src/forge/Newfile/codeReview/index.jsx b/src/forge/Newfile/codeReview/index.jsx index 403491242..d50a45051 100644 --- a/src/forge/Newfile/codeReview/index.jsx +++ b/src/forge/Newfile/codeReview/index.jsx @@ -82,6 +82,15 @@ const CodeReview = (props) => { ); }, []); + useEffect(()=>{ + // 设置网页标题 + if(pr && projectDetail){ + const { title} = pr; + const { author, name} = projectDetail; + document.title = `代码评审-${title}-${author.name}/${name}`; + } + }, [pr, projectDetail]) + useEffect(() => { if (!pluginActivated) { return; @@ -109,7 +118,6 @@ const CodeReview = (props) => { function EditorEmpty() { const system=windowsOrMac(); - console.log(system); return
@@ -246,8 +254,6 @@ const CodeReview = (props) => { zIndex: 1002, }; - console.log('propsIDE:'); - console.log(propsIDE); return (
diff --git a/src/forge/Newfile/m_editor.js b/src/forge/Newfile/m_editor.js index 94fa4b558..77cf86f75 100644 --- a/src/forge/Newfile/m_editor.js +++ b/src/forge/Newfile/m_editor.js @@ -35,8 +35,6 @@ class m_editor extends Component { render() { const { editorValue, changeValue } = this.state; const { readOnly, editorType, currentBranch, descName, checkName, detail, match: { params },filepath,ideTheme } = this.props; - console.log('params') - console.log(params) const editor_options = { lineNumbers: "on", lineWrapping: true, //强制换行 diff --git a/src/forge/Newfile/upload_file.js b/src/forge/Newfile/upload_file.js index 2e2f49b65..85655b867 100644 --- a/src/forge/Newfile/upload_file.js +++ b/src/forge/Newfile/upload_file.js @@ -15,6 +15,23 @@ class UploadFile extends Component { }; } + componentDidUpdate(){ + this.updateDocumentTitle(); + } + + componentDidMount(){ + this.updateDocumentTitle(); + } + + // 更新网页标题 + updateDocumentTitle(){ + const {projectDetail} = this.props; + if(projectDetail && document.title.indexOf('上传文件-') === -1){ + const { author, name} = projectDetail; + document.title = `上传文件-${author.name}/${name}`; + } + } + // 获取上传后的文件id数组 UploadFunc = (fileList) => { this.setState({ diff --git a/src/forge/Newfile/webIDE.jsx b/src/forge/Newfile/webIDE.jsx index ec6361a8a..f0e0478c4 100644 --- a/src/forge/Newfile/webIDE.jsx +++ b/src/forge/Newfile/webIDE.jsx @@ -74,12 +74,18 @@ const layoutConfig = { const platform = 'gitlink'; const WebIDE = ( props) => { - const { match: { params: { owner, projectsId, branchName } }, } = props; + const { match: { params: { owner, projectsId, branchName } }, mygetHelmetapi } = props; let origin=window.location.origin; if(origin.indexOf('localhost')>-1){ origin='https://testforgeplus.trustie.net'; } + useEffect(()=>{ + if(mygetHelmetapi && mygetHelmetapi.name){ + document.title= mygetHelmetapi.name + } + },[mygetHelmetapi]) + return ({ + if(user){ + // 更改网页标题 + const {username, login} = user; + document.title = `${menu === "undo" ? '接收仓库' : '成员申请'}-${username}/${login}`; + } + },[user, menu]) + useEffect(()=>{ if((username && current_user && (current_user.login !== username))){ props.history.push(`/${username}`); diff --git a/src/forge/Order/Detail.js b/src/forge/Order/Detail.js index e590d74ca..5dc19bb8c 100644 --- a/src/forge/Order/Detail.js +++ b/src/forge/Order/Detail.js @@ -44,6 +44,20 @@ class Detail extends Component { this.getDetail(); }; + componentDidUpdate=()=>{ + this.updateDocumentTitle(); + } + + // 更新网页标题 + updateDocumentTitle(){ + const {projectDetail} = this.props; + const {data} = this.state; + if(projectDetail && data){ + const { author, name} = projectDetail; + document.title = `${data.subject}-疑修-${author.name}/${name}`; + } + } + getDetail = () => { const { projectsId, orderId, owner } = this.props.match.params; const url = `/${owner}/${projectsId}/issues/${orderId}.json`; diff --git a/src/forge/Order/Milepost.js b/src/forge/Order/Milepost.js index 442852b6e..45121cccd 100644 --- a/src/forge/Order/Milepost.js +++ b/src/forge/Order/Milepost.js @@ -26,9 +26,22 @@ class Milepost extends Component { spinings: true } } + componentDidUpdate(){ + this.updateDocumentTitle(); + } componentDidMount = () => { this.getList(1, this.state.status, 'desc'); + this.updateDocumentTitle(); + } + + // 更新网页标题 + updateDocumentTitle(){ + const {projectDetail} = this.props; + if(projectDetail){ + const { author, name} = projectDetail; + document.title = `里程碑-${author.name}/${name}`; + } } getList = (page, status, order_type, order_name) => { diff --git a/src/forge/Order/MilepostDetail.js b/src/forge/Order/MilepostDetail.js index 02ca7505f..9505fe535 100644 --- a/src/forge/Order/MilepostDetail.js +++ b/src/forge/Order/MilepostDetail.js @@ -59,6 +59,7 @@ class MilepostDetail extends Component { } componentDidUpdate=(prevProps)=>{ + this.updateDocumentTitle(); const prebannerList = prevProps && prevProps.bannerList; const bannerList = this.props && this.props.bannerList; if(prebannerList !== bannerList){ @@ -71,6 +72,16 @@ class MilepostDetail extends Component { } } + // 更新网页标题 + updateDocumentTitle(){ + const {projectDetail} = this.props; + const {data} = this.state; + if(projectDetail && data){ + const { author, name} = projectDetail; + document.title = `${data.name}-里程碑-${author.name}/${name}`; + } + } + getSelectList = () => { const { projectsId , owner } = this.props.match.params; const url = `/${owner}/${projectsId}/issues/index_chosen.json`; diff --git a/src/forge/Order/UpdateMilepost.js b/src/forge/Order/UpdateMilepost.js index 2cc5d789a..72c288c33 100644 --- a/src/forge/Order/UpdateMilepost.js +++ b/src/forge/Order/UpdateMilepost.js @@ -22,6 +22,20 @@ class UpdateMilepost extends Component { this.getmeil(); } + componentDidUpdate=()=>{ + this.updateDocumentTitle(); + } + + // 更新网页标题 + updateDocumentTitle(){ + const {projectDetail} = this.props; + const {data} = this.state; + if(projectDetail && data){ + const { author, name} = projectDetail; + document.title = `${data.name}-里程碑-${author.name}/${name}`; + } + } + onPanelChange = (time, mode) => { this.setState({ value: time @@ -53,7 +67,6 @@ class UpdateMilepost extends Component { name: result.data.name, description: result.data.description }); - } }).catch((error) => { console.log(error); diff --git a/src/forge/Order/newMilepost.js b/src/forge/Order/newMilepost.js index 7b7c184e2..a5aeb08c5 100644 --- a/src/forge/Order/newMilepost.js +++ b/src/forge/Order/newMilepost.js @@ -16,11 +16,26 @@ class NewMilepost extends Component { isSpin: false } } + + componentDidMount = () => { + this.updateDocumentTitle(); + } + componentDidUpdate=(prevPros)=>{ if(prevPros && this.props && !this.props.checkIfLogin()){ this.props.history.push("/403") return } + this.updateDocumentTitle(); + } + + // 更新网页标题 + updateDocumentTitle(){ + const {projectDetail} = this.props; + if(projectDetail){ + const { author, name} = projectDetail; + document.title = `新建里程碑-${author.name}/${name}`; + } } // componentDidMount = () => { // this.check_is_login(); @@ -101,7 +116,7 @@ class NewMilepost extends Component { required: true, message: '请输入标题' }], })( - + )}
diff --git a/src/forge/Order/order.js b/src/forge/Order/order.js index f43de37c4..33a03c559 100644 --- a/src/forge/Order/order.js +++ b/src/forge/Order/order.js @@ -75,10 +75,12 @@ class order extends Component { }; } - - + componentDidUpdate(){ + this.updateDocumentTitle(); + } componentDidMount = () => { + this.updateDocumentTitle(); const datas = cookie.load('states'); let states = datas === "undefined" ? undefined : datas; if(states){ @@ -94,6 +96,14 @@ class order extends Component { } }; + // 更新网页标题 + updateDocumentTitle(){ + const {projectDetail} = this.props; + if(projectDetail){ + const { author, name} = projectDetail; + document.title = `疑修-${author.name}/${name}`; + } + } getSelectList = () => { this.setState({ diff --git a/src/forge/Order/order_form.js b/src/forge/Order/order_form.js index 3cb3f07f2..7eb22d6d7 100644 --- a/src/forge/Order/order_form.js +++ b/src/forge/Order/order_form.js @@ -44,11 +44,28 @@ class order_form extends Component { this.props.history.push("/403") return } + this.updateDocumentTitle(); } componentDidMount = () => { this.getSelectList(); }; + // 更新网页标题 + updateDocumentTitle(){ + const {form_type, projectDetail} = this.props; + const {subject} = this.state; + if(projectDetail && form_type){ + const { author, name} = projectDetail; + if(form_type === 'feedback'){ + document.title = `意见反馈` + }else if(form_type === 'new'){ + document.title = `新建疑修-${author.name}/${name}` + }else{ + subject && (document.title = `${subject}-疑修-${author.name}/${name}`); + } + } + } + copyIssueAtWhoInit = (description) =>{ if (description.indexOf("@") !== -1){ this.setState({isSpin: true}); diff --git a/src/forge/SecuritySetting/notice/manager/Index.jsx b/src/forge/SecuritySetting/notice/manager/Index.jsx index 5ba82d60c..a2200f950 100644 --- a/src/forge/SecuritySetting/notice/manager/Index.jsx +++ b/src/forge/SecuritySetting/notice/manager/Index.jsx @@ -40,6 +40,7 @@ function NoticeManager(props){ } useEffect(()=>{ + document.title = '通知管理'; axios.get("/template_message_settings.json").then(response => { if (response && response.status === 200) { setSettingTypes(response.data.setting_types); diff --git a/src/forge/SecuritySetting/notice/myNotice/Index.jsx b/src/forge/SecuritySetting/notice/myNotice/Index.jsx index 1a8ddf9db..23c755508 100644 --- a/src/forge/SecuritySetting/notice/myNotice/Index.jsx +++ b/src/forge/SecuritySetting/notice/myNotice/Index.jsx @@ -27,6 +27,10 @@ function MyNotice(props) { const [currentPage, setCurrentPage] = useState(1);//当前页数 const [onlyUnread, setOnlyUnread] = useState(); + useEffect(()=>{ + document.title = "我的通知"; + }, []) + //登录情况下,通过地址访问,直接跳转:/settings/profile //未登录情况下,通过地址访问,直接跳转:/explore useEffect(()=>{ @@ -244,7 +248,6 @@ function MyNotice(props) { })} {false && messageList && messageList.map(item => { - console.log('item',item); // 系统消息 if (noticeType === "0") { // 消息类别 diff --git a/src/forge/SecuritySetting/sub/New.jsx b/src/forge/SecuritySetting/sub/New.jsx index cd2e20906..9a0aaed93 100644 --- a/src/forge/SecuritySetting/sub/New.jsx +++ b/src/forge/SecuritySetting/sub/New.jsx @@ -1,4 +1,4 @@ -import React , { forwardRef, useState } from 'react'; +import React , { forwardRef, useState, useEffect } from 'react'; import { Link } from 'react-router-dom'; import { Button, Form , Input } from 'antd'; import Axios from 'axios'; @@ -8,6 +8,10 @@ function New({ form , showNotification , history }) { const { getFieldDecorator, validateFields , setFieldsValue } = form; const [ msg , setMsg ] = useState(undefined); + useEffect(()=>{ + document.title = '添加SSH密钥' + }, []) + function submit() { validateFields((error,values)=>{ if(!error){ @@ -51,7 +55,7 @@ function New({ form , showNotification , history }) {