'));
}
$('#header-if > .wf-header-shadow').fadeIn();
if(window.__logo_theme_name) {
document.getElementsByClassName('wf-header')[0].style.background = '#e66145'
}
}
function hideHeaderShadow() {
$('#header-if > .wf-header-shadow').fadeOut('normal', function (){
if(window.__logo_theme_name) {
document.getElementsByClassName('wf-header')[0].style.background = 'none'
}
});
}
navItemHaspopup.on('click', '> h2', function (e) {
e.stopPropagation(); // 阻止事件冒泡到文档层面
var $menuItem = $(e.delegateTarget);
// 收起其他菜单
navItemHaspopup.not($menuItem).removeClass('active').attr('aria-expanded', 'false');
navSubMenus.slideUp();
if($('#suggestionForm').is(':visible')) {
handleSuggestionFormVisible && handleSuggestionFormVisible(e)
}
// 切换当前菜单状态
if ($menuItem.hasClass('active')) {
// 如果当前菜单已展开,则收起
hideHeaderShadow();
$menuItem.removeClass('active').attr('aria-expanded', 'false');
} else {
// 如果当前菜单未展开,则展开
topshowHeaderShadow();
$menuItem.addClass('active').attr('aria-expanded', 'true');
if($menuItem.hasClass('wf-client-support')) {
handleSuggestionFormVisible && handleSuggestionFormVisible(e)
} else {
$menuItem.find('.wf-header-nav-sub').slideDown();
}
}
});
$(document).on('click', function (e) {
// 如果点击区域不在活动菜单内,则关闭所有菜单
if (
!$(e.target).closest('.wf-header-nav-item.active').length &&
!$(e.target).closest('#suggestionForm').length &&
!$(e.target).closest('.ntalk-window-containter').length
) {
hideHeaderShadow();
navItemHaspopup.removeClass('active').attr('aria-expanded', 'false');
navSubMenus.slideUp();
if($('#suggestionForm').is(':visible')) {
handleSuggestionFormVisible && handleSuggestionFormVisible(e)
}
}
});
// 客户支持弹窗
var showSuggestionNew = true;
function handleSuggestionFormVisible() {
var content = $('#suggestionForm').html();
if (content.length === 0 && showSuggestionNew) {
$.ajax({
url: 'https://my.wanfangdata.com.cn/user/suggestion/suggestionForm',
beforeSend: function () {
showSuggestionNew = false;
},
success: function (result) {
if(result) {
$('#suggestionForm').html('' + result);
}
showSuggestionNew = true;
},
error: function (data) {
showSuggestionNew = true;
},
});
}
$('#suggestionForm').fadeToggle();
}
// 客户支持弹窗关闭按钮点击事件
$(document).on('click', '#suggestionFormClose', function (e) {
hideHeaderShadow();
navItemHaspopup.removeClass('active').attr('aria-expanded', 'false');
navSubMenus.slideUp();
if($('#suggestionForm').is(':visible')) {
handleSuggestionFormVisible && handleSuggestionFormVisible(e)
}
})
'));
}
if ($('#header-if > .wf-header-shadow').is(':visible')) {
$('#header-if > .wf-header-shadow').fadeOut();
} else {
$('.wf-header-shadow').fadeIn();
if(window.__logo_theme_name) {
document.getElementsByClassName('wf-header')[0].style.background = '#e66145'
}
}
}
// function hideHeaderShadow() {
// $('#header-if > .wf-header-shadow').fadeOut();
// }
//反馈
$('#feedback').click(function (e) {
window._czc && window._czc.push(['_trackEvent', '个人版首页-【侧边栏-反馈】', '点击', '']);
e.stopPropagation(); // 阻止事件冒泡到文档层面
handleSuggestionFormVisible(e);
showHeaderShadow();
})
// 客户支持弹窗
var showSuggestionNew = true;
function handleSuggestionFormVisible() {
var content = $('#suggestionForm').html();
if (content.length === 0 && showSuggestionNew) {
$.ajax({
url: 'https://my.wanfangdata.com.cn/user/suggestion/suggestionForm',
beforeSend: function () {
showSuggestionNew = false;
},
success: function (result) {
if(result) {
$('#suggestionForm').html('' + result);
}
showSuggestionNew = true;
},
error: function (data) {
showSuggestionNew = true;
},
});
}
$('#suggestionForm').fadeToggle();
}
// 客户支持弹窗关闭按钮点击事件
$(document).on('click', '#suggestionFormClose', function (e) {
$('#suggestionForm').fadeOut();
$('.wf-header-shadow').fadeOut();
})
if(document.cookie.indexOf('zhiyanClose=1') == -1) {
$('#zhiyanDialog').css('display', 'block')
}
// 智妍弹框跳转入口
$('#zhiyanButton').click(function() {
let accountIds = window.__userContext.context.accountIds
let isPersonLogin = accountIds.some(function(item){return item.includes('Person')})
if(isPersonLogin) {
window.open("");
} else {
window.open('https://my.wanfangdata.com.cn/auth/user/login.do?service=' + encodeURIComponent(""));
}
})
// 关闭弹框
$('#zhiyanClose').click(function() {
document.cookie='zhiyanClose=1;domain=.wanfangdata.com.cn;expires='+new Date(new Date().getTime() + 604800000).toGMTString()
$('#zhiyanDialog').hide()
})