武汉修改

This commit is contained in:
谢思 2026-01-21 18:35:21 +08:00
parent 24c5fae25d
commit 5f5182d030
6 changed files with 48 additions and 8 deletions

View File

@ -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 {
<div>
<div className="detailHeader-wrapper">
<div className="normal">
<div className="AlignTop" style={{ padding: "18px 0px 10px", justifyContent: "space-between" }}>
<div className="AlignTop" style={{ padding: "50px 0px 10px", justifyContent: "space-between" }}>
<div>
<div className="AlignTop">
<div className="projectallName">
@ -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}

View File

@ -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)){

View File

@ -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;
}
};

View File

@ -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) {
<div className="AlignCenter homepage_content_v3_1">
<div className="cate_list_box">
<span className={`font-15 font-bd`}>软件分类</span>
<span className={`cate_item font-15 ${cateID ? '' : 'active'}`} onClick={() => {setPage(1); setCateID(undefined); setTopicId(undefined) }}>全部</span>
{cateList && !!cateList.length && cateList.map(cate => {
const isActive = cate.id === cateID;
return <span key={cate.id} className={`cate_item font-15 ${isActive ? 'active' : ''}`} onClick={() => { setPage(1); setCateID(cate.id); setTopicId(undefined) }}>{cate.name}</span>
@ -199,7 +200,7 @@ function ProjectHomePage(props) {
{bannerProjects && !!bannerProjects.length && <div className="project_recommend mb20">
<Carousel autoplay ref={carouselEL} afterChange={setCurrent}>
{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 <div>
<div className="FlexAJ">
<div className="flex1">
@ -246,7 +247,7 @@ function ProjectHomePage(props) {
<div className="home_project_list_box">
{projectsList && !!projectsList.length ? <div className={`df home_project_list ${!topicsLength ? 'sixItemBox' : ''}`}>
{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 <div className="home_project">
<div className="df a-i-center mb5">
{i.lesson_url && <img src={getImageUrl(`${i.lesson_url}`)} alt="" className="author_img" />}

View File

@ -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;
}

View File

@ -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 (
<div className="indexHOC">
<div className={`indexHOC ${headerNone ? "header-none" : ""}`}>
{(!path || (path && !path.includes('glcc') )) && <SiderBar {...this.props} {...this.state}/>}
<SystemNotice
system_notification={mygetHelmetapi && mygetHelmetapi.system_notification}