Change Header Nav
This commit is contained in:
parent
ce950ea45c
commit
91fdeb9fd4
|
|
@ -50,7 +50,8 @@ class NewHeader extends Component {
|
|||
}
|
||||
}
|
||||
componentDidMount() {
|
||||
this.getAppdata();
|
||||
// this.getAppdata();
|
||||
this.geturlsdata();
|
||||
window._header_componentHandler = this;
|
||||
|
||||
//下拉框的显示隐藏
|
||||
|
|
@ -547,23 +548,19 @@ class NewHeader extends Component {
|
|||
geturlsdata = () => {
|
||||
let url = "/setting.json";
|
||||
axios.get(url).then((response) => {
|
||||
if (response) {
|
||||
if (response.data) {
|
||||
this.setState({
|
||||
mygetHelmetapi2: response.data.setting
|
||||
});
|
||||
localStorage.setItem('chromesetting', JSON.stringify(response.data.setting));
|
||||
localStorage.setItem('chromesettingresponse', JSON.stringify(response));
|
||||
try {
|
||||
if (response.data.setting.tab_logo_url) {
|
||||
this.gettablogourldata(response);
|
||||
} else {
|
||||
this.gettablogourlnull();
|
||||
}
|
||||
} catch (e) {
|
||||
if (response && response.data) {
|
||||
this.setState({ mygetHelmetapi2: response.data.setting }, () => {
|
||||
console.log('');
|
||||
});
|
||||
// localStorage.setItem('chromesetting', JSON.stringify(response.data.setting));
|
||||
// localStorage.setItem('chromesettingresponse', JSON.stringify(response));
|
||||
try {
|
||||
if (response.data.setting.tab_logo_url) {
|
||||
this.gettablogourldata(response);
|
||||
} else {
|
||||
this.gettablogourlnull();
|
||||
}
|
||||
} else {
|
||||
} catch (e) {
|
||||
this.gettablogourlnull();
|
||||
}
|
||||
} else {
|
||||
|
|
@ -571,29 +568,30 @@ class NewHeader extends Component {
|
|||
}
|
||||
}).catch((error) => {
|
||||
this.gettablogourlnull();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
matchpaths = (url) => {
|
||||
const { match } = this.props;
|
||||
if (url === '/forums' && match.path === '/forums') {
|
||||
return true
|
||||
} else if (url.startsWith('/projects') && match.path.startsWith('/projects')) {
|
||||
return true
|
||||
} else if (url.startsWith('/paths') && match.path.startsWith('/paths')) {
|
||||
return true
|
||||
} else if (url.startsWith('/courses') && match.path.startsWith('/courses')) {
|
||||
return true
|
||||
} else if (url.startsWith('/competitions') && match.path.startsWith('/competitions')) {
|
||||
return true
|
||||
} else if (url.startsWith('/statistics') && match.path.startsWith('/statistics')) {
|
||||
return true
|
||||
} else if (url.startsWith('/users') && match.path.startsWith('/users')) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
if(url){
|
||||
if (url === '/forums' && match.path === '/forums') {
|
||||
return true
|
||||
} else if (url.startsWith('/projects') && match.path.startsWith('/projects')) {
|
||||
return true
|
||||
} else if (url.startsWith('/paths') && match.path.startsWith('/paths')) {
|
||||
return true
|
||||
} else if (url.startsWith('/courses') && match.path.startsWith('/courses')) {
|
||||
return true
|
||||
} else if (url.startsWith('/competitions') && match.path.startsWith('/competitions')) {
|
||||
return true
|
||||
} else if (url.startsWith('/statistics') && match.path.startsWith('/statistics')) {
|
||||
return true
|
||||
} else if (url.startsWith('/users') && match.path.startsWith('/users')) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -724,12 +722,12 @@ class NewHeader extends Component {
|
|||
<GotoQQgroup {...this.state} {...this.props} setgoshowqqgtounp={(bool) => this.setgoshowqqgtounp(bool)}></GotoQQgroup>
|
||||
:""
|
||||
}
|
||||
<a href={"https://www.trustie.net/homes"} onClick={() => this.headtypesonClick("/", false)} className={"fl mr30"}>
|
||||
<a href={"http://39.105.176.215/"} onClick={() => this.headtypesonClick("/", false)} className={"fl mr30"}>
|
||||
{
|
||||
mygetHelmetapi2 && mygetHelmetapi2.nav_logo_url && mygetHelmetapi2.nav_logo_url ?
|
||||
<img alt="高校智能化教学与实训平台" className="logoimg" style={{ heigth: "40px" }} src={getImageUrl(mygetHelmetapi2.nav_logo_url)}></img>
|
||||
<img alt="可控开源社区" className="logoimg" style={{ heigth: "40px" }} src={getImageUrl(mygetHelmetapi2.nav_logo_url)}></img>
|
||||
:
|
||||
<img alt="高校智能化教学与实训平台" className="logoimg" style={{ heigth: "40px" }} src={getImageUrl("images/educoder/headNavLogo.png?1526520218")}></img>
|
||||
<img alt="可控开源社区" className="logoimg" style={{ heigth: "40px" }} src={getImageUrl("images/educoder/headNavLogo.png?1526520218")}></img>
|
||||
}
|
||||
</a>
|
||||
{
|
||||
|
|
@ -741,7 +739,7 @@ class NewHeader extends Component {
|
|||
var new_link = item.link;
|
||||
var user_login = this.props.user && this.props.user.login;
|
||||
var is_hidden = item.hidden
|
||||
if (new_link.indexOf("courses") > -1 || new_link.indexOf("contests") > -1) {
|
||||
if (new_link && (new_link.indexOf("courses") > -1 || new_link.indexOf("contests") > -1)) {
|
||||
if (user_login) {
|
||||
if (new_link.indexOf("courses") > -1) {
|
||||
new_link = new_link.replace(/courses/g, "users/" + user_login + "/courses")
|
||||
|
|
@ -752,7 +750,7 @@ class NewHeader extends Component {
|
|||
is_hidden = true
|
||||
}
|
||||
}
|
||||
if (user_login && new_link.indexOf("homes") > -1) {
|
||||
if (user_login && (new_link && new_link.indexOf("homes") > -1)) {
|
||||
new_link = new_link.replace(/homes/g, "users/" + user_login + "/user_activities")
|
||||
}
|
||||
return (
|
||||
|
|
@ -762,9 +760,6 @@ class NewHeader extends Component {
|
|||
)
|
||||
})
|
||||
}
|
||||
<li>
|
||||
<a href="https://www.trustie.net/forums/82/memos/3075" target="_blank" style={{color:"#FF6E21"}}>问题反馈</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
: ""
|
||||
|
|
@ -773,9 +768,9 @@ class NewHeader extends Component {
|
|||
{this.props.user && this.props.user.login ?
|
||||
<div className="edu-menu-panel">
|
||||
<i className="iconfont icon-tianjiafangda color-grey-3"></i>
|
||||
<div className="edu-menu-list" style={{ top: '46px', width: "240px" }}>
|
||||
<div className="edu-menu-list" style={{ top: '46px' }}>
|
||||
<div className="overPart"></div>
|
||||
<ul className={coursestypes === true && this.props.user && this.props.user.main_site === false ? "fl headwith100b edu-txt-center pr ul-leftline" : "fl with50 edu-txt-center pr ul-leftline"}>
|
||||
{/* <ul className={coursestypes === true && this.props.user && this.props.user.main_site === false ? "fl headwith100b edu-txt-center pr ul-leftline" : "fl with50 edu-txt-center pr ul-leftline"}>
|
||||
{
|
||||
mygetHelmetapi2 && mygetHelmetapi2.new_course && mygetHelmetapi2.new_course.new_syllabuses &&
|
||||
<li><a href={`${mygetHelmetapi2.new_course.new_syllabuses}`} target="_blank">新建课程</a></li>
|
||||
|
|
@ -784,10 +779,10 @@ class NewHeader extends Component {
|
|||
mygetHelmetapi2 && mygetHelmetapi2.new_course && mygetHelmetapi2.new_course.new_course &&
|
||||
<li><a href={`${mygetHelmetapi2.new_course.new_course}`} target="_blank">新建班级</a></li>
|
||||
}
|
||||
</ul>
|
||||
</ul> */}
|
||||
{
|
||||
coursestypes === true && this.props.user && this.props.user.main_site === false ? "" :
|
||||
<ul className="fl with50 edu-txt-center">
|
||||
<ul className="fl edu-txt-center">
|
||||
<li><Link to={"/projects/mirror/new"}>新建镜像项目</Link></li>
|
||||
<li><Link to={"/projects/deposit/new"}>新建托管项目</Link></li>
|
||||
</ul>
|
||||
|
|
@ -883,4 +878,3 @@ class NewHeader extends Component {
|
|||
}
|
||||
|
||||
export default NewHeader;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue