From 768a44f8b3a4ae56e2c1906a6f9daa841e025092 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= Date: Tue, 1 Mar 2022 15:52:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B4=E4=B8=AA=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E5=AF=BC=E8=88=AA=E6=9D=A1=E5=92=8C=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.js | 9 +++++-- src/forge/Main/IndexItem.js | 2 +- src/military/components/adminRouter/index.jsx | 2 -- src/modules/tpm/NewHeader.js | 26 ++++++++++++++++--- src/modules/tpm/css/headerExcess.css | 5 ++-- 5 files changed, 33 insertions(+), 11 deletions(-) diff --git a/src/App.js b/src/App.js index e93931c9..408abdbe 100644 --- a/src/App.js +++ b/src/App.js @@ -22,6 +22,7 @@ import { SnackbarHOC } from 'educoder'; import { initAxiosInterceptors } from './AppConfig' import { Provider } from 'react-redux'; import configureStore from './redux/stores/configureStore'; +import { indexOf } from 'lodash'; const store = configureStore(); window.marked = marked; const theme = createMuiTheme({ @@ -145,7 +146,7 @@ const Managements = Loadable({ // }) // 此处仅维护前端可能的一级路由,不用进行项目或者组织判断的字段。 -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", "login", "register", "resetPassword", "aboutus","educoder","task","notice"]; +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", "login", "register", "resetPassword", "aboutus","educoder","task","notice","managements","expert",]; class App extends Component { constructor(props) { @@ -196,7 +197,11 @@ class App extends Component { this.setState({ pathType: response.data.type || '404', pathName: pathname, - }) + }); + // 如果属于组织或者个人,那么存储该用户到sessionStorage中,作为判断是否为开源项目导航菜单的依据 + if(['User','Organization'].includes(response.data.type)){ + sessionStorage.setItem("pathname",pathname); + } } }); }else{ diff --git a/src/forge/Main/IndexItem.js b/src/forge/Main/IndexItem.js index 632f5556..fecadb13 100644 --- a/src/forge/Main/IndexItem.js +++ b/src/forge/Main/IndexItem.js @@ -83,7 +83,7 @@ class IndexItem extends Component {
- + {item.author.name}/{item.name} { !item.is_public && 私有 } diff --git a/src/military/components/adminRouter/index.jsx b/src/military/components/adminRouter/index.jsx index 8019dcee..767b6169 100644 --- a/src/military/components/adminRouter/index.jsx +++ b/src/military/components/adminRouter/index.jsx @@ -11,12 +11,10 @@ export default props => { const main_web_site_url =localStorage.chromesetting&& JSON.parse(localStorage.chromesetting).main_web_site_url; const current_main_site_url =localStorage.chromesetting&& JSON.parse(localStorage.chromesetting).current_main_site_url; - const [current,setCurrent]=useState(JSON.parse(sessionStorage.adminRouter||'[]')); const [title,setTitle]=useState(''); function handleClick (e){ - console.log(e) setCurrent([e.key]); setTitle(e.item.props.title); sessionStorage.setItem( 'adminRouter',JSON.stringify([e.key])); diff --git a/src/modules/tpm/NewHeader.js b/src/modules/tpm/NewHeader.js index b635dfb5..1c2d10da 100644 --- a/src/modules/tpm/NewHeader.js +++ b/src/modules/tpm/NewHeader.js @@ -581,11 +581,28 @@ class NewHeader extends Component { matchpaths = (url) => { const { match } = this.props; - + let pathname=sessionStorage.pathname; if(url){ - if (match.path.indexOf(url) > -1) { + if (url.indexOf('forums') > -1 && match.path.indexOf('forums') > -1) { return true - }else { + // 开源项目,路由改版后,比较麻烦,因此使用多个进行判断 + } else if (url.indexOf('explore') > -1 && match.path.indexOf('explore') > -1) { + return true + // 开源项目,路由改版后,比较麻烦,因此使用多个进行判断 + } else if (url.indexOf('explore') > -1 && match.url.indexOf(pathname) > -1) { + return true + // 公告 + } else if (url.indexOf('/notice') > -1 && match.path.indexOf('/notice') > -1) { + return true + // 创客 + } else if (url.indexOf('/task') > -1 && match.path.indexOf('/task') > -1) { + return true + // 管理 + } else if (url.indexOf('/managements') > -1 && match.path.indexOf('/managements') > -1) { + return true + } else if (['http://117.50.100.12:8080','https://osredm.com','http://111.8.36.180:8000','http://localhost:3007'].includes(url) && match.path === '/') { + return true + } else { return false } } @@ -727,7 +744,8 @@ class NewHeader extends Component { var wl = waiLian && waiLian.length>0; return (
  • this.headtypesonClick(item.link, true)} className={`${this.matchpaths(item.link) === true ? 'pr active' : 'pr'}`} style={!is_hidden ? { display: 'flex' } : { display: 'none' }}> - {item.name} + {item.name} + {/* target={wl ? "_self":"_blank"} */}
  • ) }) diff --git a/src/modules/tpm/css/headerExcess.css b/src/modules/tpm/css/headerExcess.css index 1dd4b0de..6c8c90ce 100644 --- a/src/modules/tpm/css/headerExcess.css +++ b/src/modules/tpm/css/headerExcess.css @@ -1,14 +1,15 @@ .head-nav ul#header-nav li:hover a, .head-nav ul#header-nav li.active a{ - color: #1484EF; + color: #466AFF; } .head-nav ul#header-nav li.active a::after{ content: ""; width: 100%; height:2px; - background-color: #1484EF; + background-color: #466AFF; left:0px; bottom: 12px; position: absolute; + margin-left: 0; } .login-box{ font-size: 15px;