Files
YwxAppThink/app/frontend/view/common/header.html
T

69 lines
3.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!-- 全站置顶公告条(方案 A -->
{notempty name="topNotices"}
<div class="site-notice-bar" id="siteNoticeBar">
{volist name="topNotices" id="nt"}
<div class="notice-item notice-type-{$nt.type}" data-id="{$nt.id}">
<span class="notice-badge">{$nt.type_text|default='公告'}</span>
<span class="notice-title">{$nt.title}</span>
<a href="{:url('notice/read', ['id'=>$nt.id])}" class="notice-link">查看详情</a>
<span class="notice-close" data-id="{$nt.id}" title="关闭">×</span>
</div>
{/volist}
</div>
<script>
(function () {
var KEY = 'closed_notices';
try {
var closed = JSON.parse(localStorage.getItem(KEY) || '[]');
document.querySelectorAll('#siteNoticeBar .notice-item').forEach(function (el) {
if (closed.indexOf(el.getAttribute('data-id')) > -1) el.style.display = 'none';
});
document.querySelectorAll('#siteNoticeBar .notice-close').forEach(function (btn) {
btn.addEventListener('click', function () {
var id = btn.getAttribute('data-id');
btn.closest('.notice-item').style.display = 'none';
var arr = JSON.parse(localStorage.getItem(KEY) || '[]');
if (arr.indexOf(id) === -1) { arr.push(id); localStorage.setItem(KEY, JSON.stringify(arr)); }
});
});
} catch (e) {}
})();
</script>
{/notempty}
<!-- 重构导航:彻底解决移动端Logo重合 -->
<header class="main-header">
<div class="layui-container header-container">
<div class="header-inner">
<div class="logo-box">
<a href="{:url('index/index')}" class=" ">
<span class="logo-text">{$siteConf.sitename|default='YwxApp'}</span>
</a>
</div>
<div class="nav-trigger" id="navToggle">
<span></span><span></span><span></span>
</div>
<ul class="nav-menu" id="navMenu">
{volist name="navMenus" id="m"}
<li class="nav-item {if $m.ctrl == $site.controller}active{/if}{if !empty($m.child)} has-child{/if}">
<a href="{if strpos($m.url,'http')===0}{$m.url}{else/}{:url($m.url)}{/if}">
{if !empty($m.icon)}<i class="layui-icon {$m.icon}"></i> {/if}{$m.title}
</a>
{if !empty($m.child)}
<ul class="sub-menu">
{volist name="m.child" id="c"}
<li class="sub-item {if $c.ctrl == $site.controller}active{/if}">
<a href="{if strpos($c.url,'http')===0}{$c.url}{else/}{:url($c.url)}{/if}">
{if !empty($c.icon)}<i class="layui-icon {$c.icon}"></i> {/if}{$c.title}
</a>
</li>
{/volist}
</ul>
{/if}
</li>
{/volist}
</ul>
</div>
</div>
</header>