{% set maxDisplayMessage = 99 %}
{% if app.user.islogin|default %}
{% set user = data('HomeCurrentUserLearnData',{}) %}
{% do script(['app/js/default/header/index.js', 'app/js/header/index.js']) %}
<div class="header-right navbar-user {% if setting('esBar.enabled', 0) %}left{% endif %} hidden-xs">
<ul class="nav user-nav">
<li>
<form class="navbar-form navbar-right nav-search-bar-wrap hidden-xs hidden-sm" id="js-nav-search-bar-wrap" action="{{ editing ? 'javascript:;' : path('search') }}" method="get">
<div class="form-group" id="js-move-search">
<i class="ct-icon ct-icon-a-ser search-icon js-search-icon text-20" style="line-height: 22px;" id="js-search-icon"></i>
<input class="form-control input-search js-search" id="js-search" name="q" placeholder="{{ 'homepage.header.search'|trans }}">
</div>
</form>
</li>
<li class="js-qcode-hover hidden-xs hidden-sm qcode-hover {% if setting('mobile.enabled') == 0 %}hidden{% endif %}" id="js-qcode-hover" data-url="{{ path('mobile_qrcode_ajax') }}">
<a class="qcode-link" href="javascript:;"><i class="ct-icon ct-icon-app text-20"></i></a>
<div class="qcode-content">
<div class="js-inform-loading qcode-loading"></div>
<div class="qcode-text-wrap">
<div class="qcode-text mbs mtm">
<span class="va-mid">{{ 'homepage.header.app_tips'|trans }}</span><i class="es-icon es-icon-tishi va-mid mls color-warning" data-toggle="tooltip" data-placement="top" data-title="{{ 'homepage.header.app_tips_warn'|trans }}"></i>
</div>
<a class="link-gray" href="{{ editing ? 'javascript:;' : path('mobile') }}">{{ 'homepage.header.app_tips_link_text'|trans }}</a>
</div>
</div>
</li>
{% if setting('magic.enable_language_switch') %}
<li class='nav-hover hidden-xs'>
<a href='javascript:;' class='more-lan' data-lan="{{ app.request.locale }}">
<span class='show_lan js-show-lan'></span>
</a>
<ul class="dropdown-menu lan-menu" role="menu">
<li><a href="{{ editing ? 'javascript:;' : path('switch_language',{'language':'zh_CN', '_target_path':app.request.uri}) }}">中文</a></li>
<li><a href="{{ editing ? 'javascript:;' : path('switch_language',{'language':'en', '_target_path':app.request.uri}) }}">English</a></li>
</ul>
</li>
{% endif %}
<li class="visible-lg nav-hover">
{% set messageNum = app.user.newMessageNum + app.user.newNotificationNum %}
{% if setting('esBar.enabled', 0) and app.user.newMessageNum > 0 %}
<a class="user-nav-mes hasmessage">
<i class="ct-icon ct-icon-Bell text-20"></i>
<span class="num">{{ messageNum > maxDisplayMessage ? 'homepage.header.max_display_messages'|trans : messageNum }}</span>
</a>
{% elseif (not setting('esBar.enabled', 0)) and (app.user.newNotificationNum > 0 or app.user.newMessageNum > 0) %}
<a class="user-nav-mes hasmessage">
<i class="ct-icon ct-icon-Bell text-20"></i>
<span class="num">{{ messageNum > maxDisplayMessage ? 'homepage.header.max_display_messages'|trans : messageNum }}</span>
</a>
{% else %}
<a class="user-nav-mes"><i class="ct-icon ct-icon-Bell text-20"></i></a>
{% endif %}
<ul class="dropdown-menu dropdown-menu_message" role="menu">
{% if not setting('esBar.enabled', 0) %}
<li>
<a href="{{ editing ? 'javascript:;' : path('notification') }}">
<i class="ct-icon ct-icon-tongzhi"></i>{{ 'homepage.header.notice'|trans }}
{% if app.user.newNotificationNum > 0 %}
<span class="pull-right num">
{{ app.user.newNotificationNum > maxDisplayMessage ? 'homepage.header.max_display_messages'|trans : app.user.newNotificationNum }}
</span>
{% endif %}
</a>
</li>
{% endif %}
<li>
<a href="{{ editing ? 'javascript:;' : path('message') }}">
<i class="ct-icon ct-icon-sixin"></i>{{ 'homepage.header.message'|trans }}
{% if app.user.newMessageNum > 0 %}
<span class="pull-right num">
{{ app.user.newMessageNum > maxDisplayMessage ? 'homepage.header.max_display_messages'|trans : app.user.newMessageNum }}
</span>
{% endif %}
</a>
</li>
</ul>
</li>
<li class="user-avatar-li nav-hover">
<a href="javascript:;" class="dropdown-toggle"><img class="c-hover-user__avatar" src="{{ filepath(user.largeAvatar|default(), 'avatar.png') }}"></i></a>
<ul class="dropdown-menu" role="menu">
{% set profile = data('UserProfile', {userId: app.user.id}) %}
<li role="presentation" class="dropdown-header">
{{ profile.truename|default(app.user.nickname) }}
</li>
<li>
<a href="{{ editing ? 'javascript:;' : path('user_show', {id:app.user.uuid}) }}">
<i class="es-icon es-icon-home"></i>{{ 'homepage.header.personal_menu'|trans }}
</a>
</li>
<li>
<a href="{{ editing ? 'javascript:;' : path('settings') }}">
<i class="es-icon es-icon-person"></i>{{ 'homepage.header.profile_center_menu'|trans }}
</a>
</li>
<li class="hidden-lg">
<a href="{{ editing ? 'javascript:;' : path('notification') }}">
<i class="ct-icon ct-icon-tongzhi"></i>{{ 'homepage.header.notice'|trans }}
{% if app.user.newNotificationNum > 0 %}
<span class="pull-right num">
{{ app.user.newNotificationNum > maxDisplayMessage ? 'homepage.header.max_display_messages'|trans : app.user.newNotificationNum }}
</span>
{% endif %}
</a>
</li>
<li class="hidden-lg">
<a href="{{ editing ? 'javascript:;' : path('message') }}">
<i class="ct-icon ct-icon-sixin"></i>{{ 'homepage.header.message'|trans }}
{% if app.user.newMessageNum > 0 %}
<span class="pull-right num">
{{ app.user.newMessageNum > maxDisplayMessage ? 'homepage.header.max_display_messages'|trans : app.user.newMessageNum }}
</span>
{% endif %}
</a>
</li>
{% if mobile|default(false) %}
<li class="mobile-switch js-switch-pc visible-xs">
<a href="javascript:;">
<i class="es-icon es-icon-qiehuan"></i>{{ 'homepage.header.switch_pc'|trans }}
</a>
</li>
{% elseif setting('wap.enabled') == 1 %}
<li class="mobile-switch js-switch-mobile visible-xs">
<a href="javascript:;">
<i class="es-icon es-icon-qiehuan"></i>{{ 'homepage.header.switch_mobile'|trans }}
</a>
</li>
{% endif %}
<li class="user-nav-li-logout">
<a href="{{ editing ? 'javascript:;' : path('logout') }}">
<i class="es-icon es-icon-power"></i>{{ 'homepage.header.logout'|trans }}
</a>
</li>
</ul>
</li>
{% if has_permission('admin') %}
<li class="text-link hidden-xs hidden-sm nav-hover workbench">
<a href='javascript:;' class="text-16 dropdown-toggle"><i class="ct-icon ct-icon-a-dash mr-8 text-20"></i><span>{{ 'homepage.header.basic_menu'|trans }}</span>{% if reviewPendingTotalNum|default(0) > 0 %}<span class="dot js-workbench-dot"></span>{% endif %}</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="{{ path('review_center') }}"><i class="ct-icon ct-icon-piyuezhongxin"></i>{{ 'homepage.header.review_center'|trans }}
{% if reviewPendingTotalNum|default(0) > 0 %}
<span class="num js-review-pending-num">
{{ reviewPendingTotalNum > maxDisplayMessage ? 'homepage.header.max_display_messages'|trans : reviewPendingTotalNum }}
</span>
{% endif %}
</a>
</li>
<li>
<a href="{{ editing ? 'javascript:;' : path('admin') }}"><i class="ct-icon ct-icon-guanlihoutai"></i>{{ 'homepage.header.manage_backstage'|trans }}</a>
</li>
</ul>
</li>
{% else %}
<li class="workbench">
<a href="{{ path('review_center') }}" class="text-16"><i class="ct-icon ct-icon-piyuezhongxin mr-8 text-20"></i>{{ 'homepage.header.review_center'|trans }}
{% if reviewPendingTotalNum|default(0) > 0 %}
<span class="work-num js-review-pending-num">
{{ reviewPendingTotalNum > maxDisplayMessage ? 'homepage.header.max_display_messages'|trans : reviewPendingTotalNum }}
</span>
{% endif %}
</a>
</li>
{% endif %}
{# <li>
<a class="btn-primary btn-text-centre"
href="{{ editing ? 'javascript:;' : path('study_center_work_record') }}">{{ 'homepage.user_info.link_learn_center'|trans }}</a>
</li> #}
</ul>
<a class="btn-primary btn-text-centre" href="{{ editing ? 'javascript:;' : path('study_center_work_record') }}">{{ 'homepage.user_info.link_learn_center'|trans }}</a>
</div>
{% else %}
{% if setting('magic.enable_language_switch') %}
{% do script(['app/js/header/index.js']) %}
<div class="header-right navbar-user {% if setting('esBar.enabled', 0) %}left{% endif %} hidden-xs">
<ul class="nav user-nav">
<li class='nav-hover hidden-xs'>
<a href="javascript:;" class="more-lan" data-lan="{{ app.request.locale }}">
<span class='show_lan js-show-lan'></span>
<i class='es-icon es-icon-keyboardarrowdown'></i>
</a>
<ul class="dropdown-menu lan-menu" role="menu">
<li><a href="{{ path('switch_language', {'language':'zh_CN', '_target_path':app.request.uri}) }}">中文</a>
</li>
<li><a href="{{ path('switch_language', {'language':'en', '_target_path':app.request.uri}) }}">English</a>
</li>
</ul>
</li>
</ul>
</div>
{% endif %}
{% endif %}
<style>
.header-right {
position: initial;
flex: none;
}
.header-right .nav.user-nav {
float: none;
display: flex;
align-items: center;
}
.header-right .nav.user-nav > li > a {
float: none;
padding: 0 !important;
margin-right: 24px;
height: 72px;
}
.header-right .nav.user-nav .navbar-form {
margin: 0 0 8px 0;
}
.header-right .nav.user-nav .qcode-hover {
width: initial;
}
.header-right .nav.user-nav .qcode-hover .qcode-link {
margin: 0 24px 0 16px;
}
.header-right .nav.user-nav .show_lan {
line-height: initial;
font-size: 16px;
}
.header-right .nav.user-nav > li .dropdown-menu > li .num {
margin-top: 2px;
}
.header-right .nav.user-nav .dropdown-menu.dropdown-menu_message {
min-width: 180px;
}
.header-right .nav.user-nav .user-nav-mes {
width: 40px;
margin-right: 4px;
}
.header-right .nav.user-nav .user-nav-mes .num {
right: 10px;
width: auto;
}
.header-right .nav.user-nav .workbench {
padding: 8px;
}
.header-right .nav.user-nav .workbench .dot {
width: 5px;
height: 5px;
position: absolute;
top: 24px;
right: -4px;
background-color: #ed3e3e;
border-radius: 50%;
}
.header-right .nav.user-nav .workbench .dropdown-menu {
min-width: 160px;
}
.header-right .nav.user-nav .workbench .dropdown-menu .num {
position: absolute;
top: 12px;
right: 10px;
width: auto;
}
.header-right .nav.user-nav .workbench .work-num {
position: absolute;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
min-width: 20px;
height: 18px;
padding: 2px 6px;
border-radius: 8px;
color: #fff;
background-color: #e34d59;
top: 20px;
right: -20px;
font-size: 12px;
}
.header-right .nav.user-nav .more-lan .show_lan .ct-icon {
font-size: 20px !important;
}
</style>