Files
YschcmsService/src/main/resources/templates/themes/campus-glow/fragments/header.html
T

71 lines
3.9 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.
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<!-- 公共头部:顶条(日期+专业院系) + 品牌行(校徽/站名/搜索) + 栏目导航(数据契约与 default 一致,仅换皮) -->
<header class="cg-header" th:fragment="header">
<a class="cg-skip-link" href="#main-content">跳到主要内容</a>
<div class="cg-topbar">
<div class="cg-container cg-topbar-inner">
<span class="cg-topbar-date" id="siteDate" th:aria-label="'今日日期'">加载日期…</span>
<div class="cg-topbar-side" th:if="${!site.colleges.isEmpty()}"
th:with="collegesLabel=${site.config['colleges_label'] ?: '专业院系'}">
<div class="cg-colleges">
<span class="cg-colleges-toggle">
<a href="javascript:void(0)" th:text="${collegesLabel}">专业院系</a>
<i class="cg-colleges-arrow" aria-hidden="true">▾</i>
</span>
<ul class="cg-colleges-menu">
<li th:each="col : ${site.colleges}" th:classappend="${col.path == site.path} ? 'active'">
<a th:href="${url.siteHome(col.path, col.publicBaseUrl)}"
th:title="${col.name}" th:text="${col.name}">学院名称</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="cg-container cg-brand-row">
<div class="cg-site-brand">
<img th:if="${site.config['logo'] != null}" class="cg-site-logo"
th:src="${url.upload(site.config['logo'])}" th:alt="${site.name}">
<a class="cg-site-name" th:href="${url.home()}" th:text="${site.name}">站点名称</a>
</div>
<!-- D-10(docs/20):searchStyle=overlay 换全屏搜索浮层;none 隐藏;inline/缺省保留原表单。
坑④:th:replace 优先级(100)先于 th:if(300)——条件必须放外层 th:block,replace 放子元素 -->
<th:block th:if="${themeParams != null and themeParams['searchStyle'] == 'overlay'}">
<th:block th:replace="~{'themes/common/fragments/search' :: overlay(${url})}" />
</th:block>
<th:block th:if="${themeParams == null or themeParams['searchStyle'] == null or themeParams['searchStyle'] == 'inline'}">
<form class="cg-site-search"
th:action="${url.search('', null)}" method="get" role="search">
<input type="text" name="q" placeholder="站内搜索" aria-label="站内搜索">
<button type="submit">搜索</button>
</form>
</th:block>
</div>
<nav class="cg-nav" aria-label="栏目导航">
<ul class="cg-container">
<li th:classappend="${currentCategoryId == null and navServiceActive == null} ? 'active'">
<a th:href="${url.home()}">首页</a>
</li>
<li th:each="cat : ${navCategories}"
th:classappend="${(currentCategoryId == cat.id ? 'active' : '') + (!cat.children.isEmpty() ? ' has-sub' : '')}">
<a th:if="${cat.type == 3}" th:href="${cat.linkUrl}" target="_blank" rel="noopener"
th:text="${cat.name}">栏目</a>
<a th:unless="${cat.type == 3}" th:href="${url.category(cat.id)}"><span th:text="${cat.name}">栏目</span><i th:if="${!cat.children.isEmpty()}" class="cg-caret" aria-hidden="true">▾</i></a>
<ul class="cg-sub-nav" th:if="${!cat.children.isEmpty()}">
<li th:each="sub : ${cat.children}">
<a th:if="${sub.type == 3}" th:href="${sub.linkUrl}" target="_blank" rel="noopener"
th:text="${sub.name}">子栏目</a>
<a th:unless="${sub.type == 3}" th:href="${url.category(sub.id)}" th:text="${sub.name}">子栏目</a>
</li>
</ul>
</li>
</ul>
</nav>
</header>
</html>