125 lines
7.2 KiB
HTML
125 lines
7.2 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
|
||
<head th:replace="~{${themeBase} + '/fragments/head' :: head}"></head>
|
||
<body>
|
||
<header th:replace="~{${themeBase} + '/fragments/header' :: header}"></header>
|
||
|
||
<main class="sp-home" id="main-content">
|
||
<!-- 首页轮播位(cms_banner position=home;设计尺寸见 theme.json bannerSize) -->
|
||
<section class="sp-banner" th:if="${!#lists.isEmpty(banners)}" aria-label="焦点图片">
|
||
<div class="sp-banner-slides">
|
||
<a class="sp-banner-slide" th:each="b, stat : ${banners}"
|
||
th:classappend="${stat.first} ? 'active'"
|
||
th:href="${b.linkUrl}" th:title="${b.title}">
|
||
<img th:src="${b.imageUrl}" th:alt="${b.title}">
|
||
<span class="sp-banner-title" th:text="${b.title}">标题</span>
|
||
</a>
|
||
</div>
|
||
<button class="sp-banner-arrow prev" type="button" aria-label="上一张" th:if="${#lists.size(banners) > 1}">‹</button>
|
||
<button class="sp-banner-arrow next" type="button" aria-label="下一张" th:if="${#lists.size(banners) > 1}">›</button>
|
||
<div class="sp-banner-dots" th:if="${#lists.size(banners) > 1}">
|
||
<button th:each="b, stat : ${banners}" th:classappend="${stat.first} ? 'active'"
|
||
th:aria-label="${'第' + (stat.count) + '张'}"></button>
|
||
</div>
|
||
</section>
|
||
|
||
<!-- 头条区:头条推荐(置顶优先) + 图片新闻(有封面文章) -->
|
||
<section class="sp-section sp-container" aria-label="头条与图片新闻">
|
||
<div class="sp-headline">
|
||
<div class="sp-headline-card" th:if="${!#lists.isEmpty(topArticles)}">
|
||
<div class="sp-block-head">
|
||
<h2>头条推荐</h2>
|
||
<i class="sp-block-tick" aria-hidden="true"></i>
|
||
</div>
|
||
<ul class="sp-headline-list">
|
||
<li class="sp-headline-lead" th:with="lead=${topArticles[0]}">
|
||
<a class="sp-lead-title" th:href="${url.article(lead.id)}" th:text="${lead.title}">头条标题</a>
|
||
<div class="sp-lead-meta">
|
||
<span class="sp-top-badge" th:if="${lead.topmost == 1}">置顶</span>
|
||
<time th:if="${lead.publishTime != null}"
|
||
th:text="${#temporals.format(lead.publishTime, 'yyyy-MM-dd')}">2026-01-01</time>
|
||
</div>
|
||
</li>
|
||
<li th:each="item, stat : ${topArticles}" th:if="${stat.index > 0}">
|
||
<span class="sp-top-badge" th:if="${item.topmost == 1}">置顶</span>
|
||
<a th:href="${url.article(item.id)}" th:text="${item.title}">文章标题</a>
|
||
<time th:if="${item.publishTime != null}"
|
||
th:text="${#temporals.format(item.publishTime, 'yyyy-MM-dd')}">2026-01-01</time>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div class="sp-focus-card" th:if="${!#lists.isEmpty(focusArticles)}">
|
||
<div class="sp-block-head">
|
||
<h2>图片新闻</h2>
|
||
<i class="sp-block-tick" aria-hidden="true"></i>
|
||
</div>
|
||
<a class="sp-focus-lead" th:with="cover=${focusArticles[0]}"
|
||
th:href="${url.article(cover.id)}">
|
||
<span class="sp-focus-cover">
|
||
<img th:src="${url.upload(cover.coverImage)}" th:alt="${cover.title}">
|
||
</span>
|
||
<span class="sp-focus-title" th:text="${cover.title}">图片新闻标题</span>
|
||
</a>
|
||
<ul class="sp-focus-rows">
|
||
<li th:each="row, stat : ${focusArticles}" th:if="${stat.index > 0}">
|
||
<a th:href="${url.article(row.id)}">
|
||
<span class="sp-row-cover"><img th:src="${url.upload(row.coverImage)}" th:alt="${row.title}"></span>
|
||
<span class="sp-row-title" th:text="${row.title}">图片新闻标题</span>
|
||
</a>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<!-- 一级栏目区块(聚合列表型子孙栏目 top 8) -->
|
||
<section class="sp-section sp-container" aria-label="栏目区块">
|
||
<div class="sp-blocks">
|
||
<div class="sp-block" th:each="block : ${categoryBlocks}">
|
||
<div class="sp-block-head sp-block-head--bar">
|
||
<h2 th:text="${block.category.name}">栏目名</h2>
|
||
<a class="sp-more" th:href="${block.moreUrl}">更多 ›</a>
|
||
</div>
|
||
<ul class="sp-block-list" th:if="${!#lists.isEmpty(block.items)}">
|
||
<!-- 区块头条:有封面则图文,无封面则带摘要纯文 -->
|
||
<li class="sp-block-featured" th:with="feat=${block.items[0]}">
|
||
<a th:href="${url.article(feat.id)}">
|
||
<span class="sp-feat-cover" th:if="${feat.coverImage != null}">
|
||
<img th:src="${url.upload(feat.coverImage)}" th:alt="${feat.title}">
|
||
</span>
|
||
<span class="sp-feat-body">
|
||
<span class="sp-feat-title" th:text="${feat.title}">头条标题</span>
|
||
<span class="sp-feat-summary" th:if="${!#strings.isEmpty(feat.summary)}"
|
||
th:text="${feat.summary}">摘要</span>
|
||
<span class="sp-feat-meta">
|
||
<span class="sp-top-badge" th:if="${feat.topmost == 1}">置顶</span>
|
||
<time th:if="${feat.publishTime != null}"
|
||
th:text="${#temporals.format(feat.publishTime, 'yyyy-MM-dd')}">2026-01-01</time>
|
||
</span>
|
||
</span>
|
||
</a>
|
||
</li>
|
||
<li class="sp-block-item" th:each="item, stat : ${block.items}" th:if="${stat.index > 0}">
|
||
<span class="sp-date-chip" th:if="${item.publishTime != null}"
|
||
th:with="d=${item.publishTime}">
|
||
<b th:text="${#temporals.format(d, 'dd')}">01</b>
|
||
<i th:text="${#temporals.format(d, 'yyyy-MM')}">2026-01</i>
|
||
</span>
|
||
<a class="sp-block-item-title" th:href="${url.article(item.id)}" th:text="${item.title}">文章标题</a>
|
||
<span class="sp-top-badge" th:if="${item.topmost == 1}">置顶</span>
|
||
</li>
|
||
</ul>
|
||
<div class="sp-empty" th:if="${#lists.isEmpty(block.items)}">
|
||
<p>栏目暂无内容</p>
|
||
<p class="sp-empty-hint">内容发布后将在此展示</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
</main>
|
||
|
||
<footer th:replace="~{${themeBase} + '/fragments/footer' :: footer}"></footer>
|
||
<script th:src="${url.asset('js/main.js')}"></script>
|
||
</body>
|
||
</html>
|