diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index 17ce9a8a1..c3e067eef 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -639,7 +639,7 @@ class Detail extends Component { render() { const { projectDetail, watchers_count, praises_count, forked_count, firstSync, secondSync, watched, praised, - project, open_devops, platform, defaultBranch, bannerList, forkSpin , mirror_status } = this.state; + project, open_devops, platform, defaultBranch, bannerList, forkSpin , mirror_status, isManager } = this.state; const url = this.props.history.location.pathname; const urlArr = url.split("/"); const urlFlag = (urlArr.length === 3); @@ -660,7 +660,7 @@ class Detail extends Component {
-
+
@@ -763,6 +763,8 @@ class Detail extends Component { projectsId={projectsId} pathname={pathname} state={state} + isManager={isManager} + project={project} projectDetail={projectDetail} open_devops={open_devops} platform={platform} diff --git a/src/forge/Main/sub/DetailBanner.jsx b/src/forge/Main/sub/DetailBanner.jsx index 1de9a5020..85909bc0d 100644 --- a/src/forge/Main/sub/DetailBanner.jsx +++ b/src/forge/Main/sub/DetailBanner.jsx @@ -6,7 +6,9 @@ import QuitBox from './quit'; import datasetImg from '../img/dataset.jpg'; import axios from 'axios'; -function DetailBanner({ history,list , owner , projectsId ,showNotification , url , pathname , state , urlFlag , projectDetail , platform ,open_devops ,current_user, showNpsModal }){ +function DetailBanner({ history,list , owner , projectsId ,showNotification , url , pathname , state , urlFlag , projectDetail , platform ,open_devops ,current_user, showNpsModal, project, isManager }){ + const {project_category_id} = project || {}; + const [ menuName , setMenuName ] = useState(list); const [ visible , setVisible ] = useState(false); useEffect(()=>{ @@ -19,6 +21,9 @@ function DetailBanner({ history,list , owner , projectsId ,showNotification , ur useEffect(()=>{ if(Array.isArray(list)){ + if([42, 43, 48, 50].includes(project_category_id)){ + return setMenuName(isManager ? [{menu_name: 'home'}, {menu_name: 'settings'}] : [{menu_name: 'home'}]) + } // 没有资源库banner但是通过连接进资源库页面时 let a = list.filter(item=>item.menu_name === "resources"); if((pathname && pathname==="source") && (a && a.length === 0)){ diff --git a/src/forge/Utils/utils.js b/src/forge/Utils/utils.js index 22f2c8772..f8b2cb097 100644 --- a/src/forge/Utils/utils.js +++ b/src/forge/Utils/utils.js @@ -53,3 +53,20 @@ export const getDefaultImage = (id) => { const defaultList = [default1, default2, default3, default4, default5, default6, default7, default8] return defaultList[ id % 8 ] } + +// 判断前一个路由是否是本站地址 +export const isPrevRouteSameSite = () => { + try { + // 获取当前域名 + const currentHost = window.location.host; + // 获取前一个页面的 URL + const prevUrl = document.referrer || ""; // 获取 state 中的 URL + const prevHost = new URL(prevUrl).host; // 获取前一个页面的域名 + // 判断前一个页面的域名是否与当前域名一致 + return prevHost === currentHost; + } catch (error) { + // 如果解析失败,返回 false + console.error("无法判断前一个路由是否是本站地址", error); + return false; + } +}; \ No newline at end of file diff --git a/src/forge/projectHome/explore/index.jsx b/src/forge/projectHome/explore/index.jsx index 074cd8f79..836cb0dc0 100644 --- a/src/forge/projectHome/explore/index.jsx +++ b/src/forge/projectHome/explore/index.jsx @@ -92,7 +92,7 @@ function ProjectHomePage(props) { if (result && result.data) { const { project_categories = [] } = result.data; setCateList(project_categories); - project_categories[0] && setCateID(project_categories[0].id); + // project_categories[0] && setCateID(project_categories[0].id); } }).catch(error => { }) } @@ -115,7 +115,7 @@ function ProjectHomePage(props) { params.topic_id = undefined } - cateID && axios.get(url, { params }).then(result => { + axios.get(url, { params }).then(result => { if (result && result.data) { setTotal(result.data.total_count); setProjectsList(result.data.projects); @@ -168,6 +168,7 @@ function ProjectHomePage(props) {
软件分类: + {setPage(1); setCateID(undefined); setTopicId(undefined) }}>全部 {cateList && !!cateList.length && cateList.map(cate => { const isActive = cate.id === cateID; return { setPage(1); setCateID(cate.id); setTopicId(undefined) }}>{cate.name} @@ -199,7 +200,7 @@ function ProjectHomePage(props) { {bannerProjects && !!bannerProjects.length &&
{bannerProjects.map(i => { - const url = i.author ? `/${i.author.login}/${i.identifier}${i.author.login === "gh_mirrors" ? "/about" : "/about"}` : `` + const url = i.author ? `/${i.author.login}/${i.identifier}${cateID === 39 ? "" : "/about"}` : `` return
@@ -246,7 +247,7 @@ function ProjectHomePage(props) {
{projectsList && !!projectsList.length ?
{projectsList.map(i => { - const url = i.author ? `/${i.author.login}/${i.identifier}` : `` + const url = i.author ? `/${i.author.login}/${i.identifier}${cateID === 39 ? "" : "/about"}` : `` return
{i.lesson_url && } diff --git a/src/modules/tpm/TPMIndex.css b/src/modules/tpm/TPMIndex.css index 81321dc73..6aaf90cd5 100644 --- a/src/modules/tpm/TPMIndex.css +++ b/src/modules/tpm/TPMIndex.css @@ -1,3 +1,4 @@ +@import url('../../animations.scss'); #root { /* ie兼容性 */ position: relative; @@ -444,3 +445,15 @@ body>.-task-title { } } } + +.header-none .newContainer>div:first-child{ + display: none; +} +.header-none .newHeaders{ + opacity: 0; + top: 0px; +} +.header-none .newHeaders:hover{ + animation: bgOpacity .6s ease-in-out 0s forwards; + animation-direction: reverse; +} \ No newline at end of file diff --git a/src/modules/tpm/TPMIndexHOC.js b/src/modules/tpm/TPMIndexHOC.js index 8af56cfca..0a07b5bcd 100644 --- a/src/modules/tpm/TPMIndexHOC.js +++ b/src/modules/tpm/TPMIndexHOC.js @@ -296,8 +296,10 @@ export function TPMIndexHOC(WrappedComponent) { }; let path =this.props.location.pathname; let pathCheck = path.indexOf("/zone")>-1 && path.indexOf("/newdetail")>-1 && isPhone(); + const headerNone = ['/explore'].includes(this.props.match.path) || ['/:OIdentifier', '/:username'].includes(this.props.match.path) && path.split('/').length>=3; + return ( -
+
{(!path || (path && !path.includes('glcc') )) && }