This commit is contained in:
caishi 2021-11-08 15:12:12 +08:00
parent a2ea832208
commit 3085e40426
1 changed files with 92 additions and 95 deletions

View File

@ -16,7 +16,6 @@ import './header.scss';
import NoticeContent from './NoticeContent';
const $ = window.$
// TODO 这部分脚本从公共脚本中直接调用
const { Search } = Input;
let old_url;
window._header_componentHandler = null;
@ -56,26 +55,26 @@ class NewHeader extends Component {
window._header_componentHandler = this;
//下拉框的显示隐藏
var hoverTimeout;
var hoveredPanel;
$(".edu-menu-panel").hover(function () {
if (hoverTimeout) { // 一次只显示一个panel
if (hoveredPanel && hoveredPanel !== this) {
$(hoveredPanel).find(".edu-menu-list").hide()
}
clearTimeout(hoverTimeout);
hoverTimeout = null;
}
hoveredPanel = this;
$(this).find(".edu-menu-list").show();
}, function () {
var that = this;
// 延迟hide
hoverTimeout = setTimeout(function () {
$(that).find(".edu-menu-list").hide();
}, 800)
// var hoverTimeout;
// var hoveredPanel;
// $(".edu-menu-panel").hover(function () {
// if (hoverTimeout) { // 一次只显示一个panel
// if (hoveredPanel && hoveredPanel !== this) {
// $(hoveredPanel).find(".edu-menu-list").hide()
// }
// clearTimeout(hoverTimeout);
// hoverTimeout = null;
// }
// hoveredPanel = this;
// $(this).find(".edu-menu-list").show();
// }, function () {
// var that = this;
// // 延迟hide
// hoverTimeout = setTimeout(function () {
// $(that).find(".edu-menu-list").hide();
// }, 800)
});
// });
//获取游览器地址
try {
window.sessionStorage.setItem("yslgeturls", JSON.stringify(window.location.href))
@ -279,92 +278,90 @@ class NewHeader extends Component {
};
render() {
const { match ,resetUserInfo ,showNotification,publicNav} = this.props;
const { resetUserInfo ,showNotification,publicNav} = this.props;
let current_user = this.props.user;
let {
AccountProfiletype,
user,
isRender,
headtypesonClickbool,
headtypess,
settings,
visible,
} = this.state;
/*用户名称 用户头像url*/
let activeIndex = false;
let activeForums = false;
let activeShixuns = false;
let activePaths = false;
let coursestype = false;
let activePackages = false;
let activeMoopCases = false;
let activeCompetitions = false;
// let activeIndex = false;
// let activeForums = false;
// let activeShixuns = false;
// let activePaths = false;
// let coursestype = false;
// let activePackages = false;
// let activeMoopCases = false;
// let activeCompetitions = false;
if (match.path === '/forums') {
activeForums = true;
} else if (match.path.startsWith('/shixuns')) {
activeShixuns = true;
} else if (match.path.startsWith('/paths')) {
activePaths = true;
} else if (match.path.startsWith('/courses')) {
coursestype = true;
} else if (match.path.startsWith('/crowdsourcing')) {
activePackages = true;
} else if (match.path.startsWith('/moop_cases')) {
activeMoopCases = true;
} else if (match.path.startsWith('/competitions')) {
activeCompetitions = true;
} else {
activeIndex = true;
}
// if (match.path === '/forums') {
// activeForums = true;
// } else if (match.path.startsWith('/shixuns')) {
// activeShixuns = true;
// } else if (match.path.startsWith('/paths')) {
// activePaths = true;
// } else if (match.path.startsWith('/courses')) {
// coursestype = true;
// } else if (match.path.startsWith('/crowdsourcing')) {
// activePackages = true;
// } else if (match.path.startsWith('/moop_cases')) {
// activeMoopCases = true;
// } else if (match.path.startsWith('/competitions')) {
// activeCompetitions = true;
// } else {
// activeIndex = true;
// }
let headtypes = '/';
if (settings) {
if (settings.navbar) {
if (settings.navbar.length > 0) {
if (match.path === '/') {
if (headtypesonClickbool === false) {
headtypes = undefined;
} else {
headtypes = headtypess;
}
} else {
for (var i = 0; i < settings.navbar.length; i++) {
if (match.path === settings.navbar[i].link) {
headtypes = settings.navbar[i].link;
break;
}
}
}
}
}
}
let shixuntype = false;
let pathstype = false;
let coursestypes = false;
if (this.props && this.props.mygetHelmetapi != null) {
let shixun = "/shixuns";
let paths = "/paths";
let courses = "/courses";
this.props.mygetHelmetapi && this.props.mygetHelmetapi.navbar && this.props.mygetHelmetapi.navbar.map((item, key) => {
var reg = RegExp(item.link);
if (shixun.match(reg)) {
if (item.hidden === true) {
shixuntype = true
}
}
if (paths.match(reg)) {
if (item.hidden === true) {
pathstype = true
}
}
if (courses.match(reg)) {
if (item.hidden === true) {
coursestypes = true
}
}
})
}
// let headtypes = '/';
// if (settings) {
// if (settings.navbar) {
// if (settings.navbar.length > 0) {
// if (match.path === '/') {
// if (headtypesonClickbool === false) {
// headtypes = undefined;
// } else {
// headtypes = headtypess;
// }
// } else {
// for (var i = 0; i < settings.navbar.length; i++) {
// if (match.path === settings.navbar[i].link) {
// headtypes = settings.navbar[i].link;
// break;
// }
// }
// }
// }
// }
// }
// let shixuntype = false;
// let pathstype = false;
// let coursestypes = false;
// if (this.props && this.props.mygetHelmetapi != null) {
// let shixun = "/shixuns";
// let paths = "/paths";
// let courses = "/courses";
// this.props.mygetHelmetapi && this.props.mygetHelmetapi.navbar && this.props.mygetHelmetapi.navbar.map((item, key) => {
// var reg = RegExp(item.link);
// if (shixun.match(reg)) {
// if (item.hidden === true) {
// shixuntype = true
// }
// }
// if (paths.match(reg)) {
// if (item.hidden === true) {
// pathstype = true
// }
// }
// if (courses.match(reg)) {
// if (item.hidden === true) {
// coursestypes = true
// }
// }
// })
// }
let search_url = settings && settings.common && settings.common.search;
return (