Browse Source

列表页底部固定并增加页码分页

列表和目录页使用视口最少高度flex布局,内容不足时底部区域仍位于浏览器最下方;文章列表增加共几页、上一页、页码窗口、下一页和禁用态分页。\n\nValidation:\n- 融媒头条目录页和短列表页底部区域撑满视口\n- 校园新闻和视频列表显示分页控件\n- 单页列表显示共1页及禁用箭头
非繁 2 months ago
parent
commit
91b1191895

+ 11 - 0
WebRoot/main/ffkj-portal/news-red.css

@@ -344,3 +344,14 @@ body.screen-red-theme{--hx-red:#941c1e;--hx-red-dark:#580b0c;--hx-footer-soft:#f
 .article-list time{margin-left:auto;text-align:right}
 .article-list-graphic time{align-self:center;text-align:right}
 .article-list-media time{display:block;margin:0 18px 16px auto;text-align:right}
+
+
+/* 列表页底部固定到视口最下方并展示页码分页 */
+body.screen-list-page{min-height:100vh;display:flex;flex-direction:column}
+body.screen-list-page main{flex:1 0 auto}
+body.screen-list-page .footer-top{margin-top:auto}
+.news-pagination{flex-wrap:wrap}
+.news-pagination .page-summary{display:flex;align-items:center;margin-right:auto;color:#7f8993;font-size:14px;line-height:21px}
+.news-pagination .page-arrow,.news-pagination .page-ellipsis{display:grid;place-items:center;min-width:36px;height:36px;padding:0 12px;color:#5d6670;background:#fff;border:1px solid var(--line);text-decoration:none}
+.news-pagination .page-ellipsis{border-color:transparent;background:transparent}
+.news-pagination .page-arrow.is-disabled{color:#b9bec4;cursor:not-allowed}

+ 2 - 2
WebRoot/web/upload/ffkj-template/news-red-catalog.jsp

@@ -9,9 +9,9 @@
 	<meta charset="UTF-8">
 	<meta name="viewport" content="width=device-width, initial-scale=1">
 	<title>${navigation.name}_${website.seoTitle}</title>
-	<link rel="stylesheet" href="/main/ffkj-portal/news-red.css?v=20260918-news-red-catalog-border-bottom">
+	<link rel="stylesheet" href="/main/ffkj-portal/news-red.css?v=20260918-news-red-list-footer-pagination">
 </head>
-<body class="screen-red-theme">
+<body class="screen-red-theme screen-list-page">
 	<%@ include file="news-red-header.jsp"%>
 	<main>
 		<div class="news-breadcrumb"><div class="wrap"><a href="/">首页</a><c:forEach items="${crumbsNavList}" var="item"><span> / </span><a href="${item.url}">${item.name}</a></c:forEach></div></div>

+ 1 - 1
WebRoot/web/upload/ffkj-template/news-red-details.jsp

@@ -7,7 +7,7 @@
 	<meta name="viewport" content="width=device-width, initial-scale=1">
 	<meta name="description" content="${articleDescription}">
 	<title>${articleTitle}_${navigation.name}_${website.seoTitle}</title>
-	<link rel="stylesheet" href="/main/ffkj-portal/news-red.css?v=20260918-news-red-catalog-border-bottom">
+	<link rel="stylesheet" href="/main/ffkj-portal/news-red.css?v=20260918-news-red-list-footer-pagination">
 </head>
 <body class="screen-red-theme">
 	<%@ include file="news-red-header.jsp"%>

+ 1 - 1
WebRoot/web/upload/ffkj-template/news-red-index.jsp

@@ -12,7 +12,7 @@
 	<meta name="viewport" content="width=device-width, initial-scale=1">
 	<title>${website.seoTitle}</title>
 	<meta name="description" content="${website.seoDescription}">
-	<link rel="stylesheet" href="/main/ffkj-portal/news-red.css?v=20260918-news-red-catalog-border-bottom">
+	<link rel="stylesheet" href="/main/ffkj-portal/news-red.css?v=20260918-news-red-list-footer-pagination">
 </head>
 <body class="screen-red-theme">
 	<%@ include file="news-red-header.jsp"%>

+ 14 - 4
WebRoot/web/upload/ffkj-template/news-red-list.jsp

@@ -16,9 +16,9 @@
 	<meta charset="UTF-8">
 	<meta name="viewport" content="width=device-width, initial-scale=1">
 	<title>${navigation.name}_${website.seoTitle}</title>
-	<link rel="stylesheet" href="/main/ffkj-portal/news-red.css?v=20260918-news-red-catalog-border-bottom">
+	<link rel="stylesheet" href="/main/ffkj-portal/news-red.css?v=20260918-news-red-list-footer-pagination">
 </head>
-<body class="screen-red-theme">
+<body class="screen-red-theme screen-list-page">
 	<%@ include file="news-red-header.jsp"%>
 	<main>
 		<div class="news-breadcrumb"><div class="wrap"><a href="/">首页</a><c:forEach items="${crumbsNavList}" var="item"><span> / </span><a href="${item.url}">${item.name}</a></c:forEach></div></div>
@@ -57,8 +57,18 @@
 						</ul>
 					</c:otherwise>
 				</c:choose>
-				<c:if test="${pageCount > 1}">
-					<nav class="news-pagination" aria-label="分页"><c:if test="${curPageNo > 1}"><a href="${curHerf}?page=${curPageNo - 1}">上一页</a></c:if><a class="active" href="${curHerf}?page=${curPageNo}">${curPageNo}</a><c:if test="${curPageNo < pageCount}"><a href="${curHerf}?page=${curPageNo + 1}">下一页</a></c:if></nav>
+				<c:if test="${not empty articleList}">
+					<c:set var="pageWindowStart" value="${curPageNo - 2 < 1 ? 1 : curPageNo - 2}"/>
+					<c:set var="pageWindowEnd" value="${pageWindowStart + 4 > pageCount ? pageCount : pageWindowStart + 4}"/>
+					<c:set var="pageWindowStart" value="${pageWindowEnd - 4 < 1 ? 1 : pageWindowEnd - 4}"/>
+					<nav class="news-pagination" aria-label="分页">
+						<span class="page-summary">共 ${pageCount} 页</span>
+						<c:choose><c:when test="${curPageNo > 1}"><a class="page-arrow" href="${curHerf}?page=${curPageNo - 1}">上一页</a></c:when><c:otherwise><span class="page-arrow is-disabled">上一页</span></c:otherwise></c:choose>
+						<c:if test="${pageWindowStart > 1}"><a href="${curHerf}?page=1">1</a><c:if test="${pageWindowStart > 2}"><span class="page-ellipsis">…</span></c:if></c:if>
+						<c:forEach begin="${pageWindowStart}" end="${pageWindowEnd}" var="pageNo"><a class="${pageNo eq curPageNo ? 'active' : ''}" href="${curHerf}?page=${pageNo}">${pageNo}</a></c:forEach>
+						<c:if test="${pageWindowEnd < pageCount}"><c:if test="${pageWindowEnd < pageCount - 1}"><span class="page-ellipsis">…</span></c:if><a href="${curHerf}?page=${pageCount}">${pageCount}</a></c:if>
+						<c:choose><c:when test="${curPageNo < pageCount}"><a class="page-arrow" href="${curHerf}?page=${curPageNo + 1}">下一页</a></c:when><c:otherwise><span class="page-arrow is-disabled">下一页</span></c:otherwise></c:choose>
+					</nav>
 				</c:if>
 			</article>
 		</div></section>

+ 1 - 1
WebRoot/web/upload/ffkj-template/news-red-search.jsp

@@ -8,7 +8,7 @@
 	<meta charset="UTF-8">
 	<meta name="viewport" content="width=device-width, initial-scale=1">
 	<title>站内搜索_${website.seoTitle}</title>
-	<link rel="stylesheet" href="/main/ffkj-portal/news-red.css?v=20260918-news-red-catalog-border-bottom">
+	<link rel="stylesheet" href="/main/ffkj-portal/news-red.css?v=20260918-news-red-list-footer-pagination">
 </head>
 <body class="screen-red-theme">
 	<%@ include file="news-red-header.jsp"%>