Просмотр исходного кода

统一前台分页和媒体缩略图尺寸

公共前台列表和搜索入口统一将每页数量收口为 10,覆盖仍传 12、15、16 的旧模板调用。

红色二级模板首页媒体网格区块读取栏目维护的 photo_size_width/photo_size_height,News2026 媒体华夏栏目通过迁移确认缩略图样式与 160x90 裁剪尺寸。

Validation:

- ./local-run/bin/compile-hxcs-deploy-classes.sh

- git diff --check -- WebRoot/web/upload/ffkj-template/college-red-index.jsp src/space/apps/moudules/website/template/common/WebsiteCommonService.java
非繁 3 месяцев назад
Родитель
Сommit
7d26937712

+ 8 - 2
WebRoot/web/upload/ffkj-template/college-red-index.jsp

@@ -38,6 +38,7 @@
 		.college-red-page .department-home-panel {
 			--college-red-home-record-height: 78px;
 			--college-red-home-thumb-width: 103px;
+			--college-red-home-thumb-height: 58px;
 		}
 		.college-red-page .department-home-panel .department-plain-list a,
 		.college-red-page .department-home-panel .department-section-graphic-list a,
@@ -52,7 +53,8 @@
 		}
 		.college-red-page .department-home-panel .department-section-thumb {
 			width: var(--college-red-home-thumb-width);
-			aspect-ratio: 16 / 9;
+			height: var(--college-red-home-thumb-height);
+			aspect-ratio: auto;
 		}
 		.college-red-page .department-home-panel.is-graphic-list .department-section-copy b,
 		.college-red-page .department-home-panel.is-media-grid .department-section-media-grid b {
@@ -387,7 +389,11 @@
 									<c:set var="sectionIsCarouselList" value="${sectionListStyleCode == 10020}"/>
 									<c:set var="sectionIsMediaGrid" value="${sectionListStyleCode == 10030 or sectionListStyleCode == 10050}"/>
 									<c:set var="sectionHref" value="${empty sectionNav.href ? sectionNav.url : sectionNav.href}"/>
-									<article class="department-list-panel department-home-panel ${sectionIsGraphicList ? 'is-graphic-list' : ''} ${sectionIsCarouselList ? 'is-carousel-list' : ''} ${sectionIsMediaGrid ? 'is-media-grid' : ''}">
+									<c:set var="sectionStyle" value=""/>
+									<c:if test="${sectionIsMediaGrid and not empty sectionNav.photo_size_width and not empty sectionNav.photo_size_height}">
+										<c:set var="sectionStyle" value="--college-red-home-thumb-width:${sectionNav.photo_size_width}px;--college-red-home-thumb-height:${sectionNav.photo_size_height}px;--college-red-home-record-height:${sectionNav.photo_size_height + 20}px;"/>
+									</c:if>
+									<article class="department-list-panel department-home-panel ${sectionIsGraphicList ? 'is-graphic-list' : ''} ${sectionIsCarouselList ? 'is-carousel-list' : ''} ${sectionIsMediaGrid ? 'is-media-grid' : ''}" style="${sectionStyle}">
 										<div class="department-section-title"><h2>${sectionNav.name}</h2><a href="${sectionHref}" target="${sectionNav.target}">查看更多</a></div>
 										<c:choose>
 											<c:when test="${sectionIsCarouselList}">

+ 64 - 0
local-run/migrations/2026-08-29-005-news2026-media-thumbnail-size.sql

@@ -0,0 +1,64 @@
+-- Ensure News2026 homepage "媒体华夏" uses thumbnail layout and 160x90 crop size.
+
+SET NAMES utf8mb4;
+USE sp_gzhx_apps;
+
+START TRANSACTION;
+
+SET @news2026_site_id := (
+  SELECT websiteid
+  FROM website
+  WHERE dcode = 61
+    AND name = '新闻网-2026'
+    AND FIND_IN_SET('xinwen2026.hxcs.feifan.net', REPLACE(TRIM(BOTH ';' FROM IFNULL(domains, '')), ';', ',')) > 0
+  ORDER BY websiteid
+  LIMIT 1
+);
+
+SET @news2026_media_nav_id := (
+  SELECT navigationid
+  FROM website_navigation
+  WHERE websiteid = @news2026_site_id
+    AND dcode = 61
+    AND name = '媒体华夏'
+    AND (
+      idcard = 'FFKJ_NEWS2026_HOME_MEDIA'
+      OR url = '/meiti/'
+    )
+  ORDER BY (idcard = 'FFKJ_NEWS2026_HOME_MEDIA') DESC, navigationid
+  LIMIT 1
+);
+
+SET @guard_sql := IF(
+  @news2026_site_id IS NOT NULL
+    AND @news2026_media_nav_id IS NOT NULL,
+  'SELECT 1',
+  'SELECT * FROM __news2026_media_thumbnail_target_missing__'
+);
+PREPARE guard_stmt FROM @guard_sql;
+EXECUTE guard_stmt;
+DEALLOCATE PREPARE guard_stmt;
+
+UPDATE website_navigation
+SET wntcode = 10010,
+    wnscode = 10030,
+    wnjtcode = 10010,
+    wnlscode = 10030,
+    photo_size_width = 160,
+    photo_size_height = 90,
+    dcode = 61
+WHERE navigationid = @news2026_media_nav_id;
+
+SELECT
+  @news2026_site_id AS news2026_site_id,
+  navigationid,
+  name,
+  idcard,
+  url,
+  wnlscode,
+  photo_size_width,
+  photo_size_height
+FROM website_navigation
+WHERE navigationid = @news2026_media_nav_id;
+
+COMMIT;

+ 11 - 2
src/space/apps/moudules/website/template/common/WebsiteCommonService.java

@@ -31,6 +31,8 @@ import space.core.db.jdbc.GeneralDBAccess;
  */
 public class WebsiteCommonService {
 
+	private static final int DEFAULT_LIST_PAGE_SIZE = 10;
+
 	/**
 	 * 控制器
 	 * 
@@ -235,7 +237,7 @@ public class WebsiteCommonService {
 		PageBean pb = new PageBean();
 		String page = request.getParameter("page");
 
-		pb.setRowCountPerPage(pageSize);
+		pb.setRowCountPerPage(getListPageSize(pageSize));
 		pb.setCurrentPageNo(StringUtil.notNull(page) ? Integer.valueOf(page) : 1);
 
 		ArticleListView articleListView = WebsiteArticleManager.getArticleListView(gdba, website, nav.getNavigationid(),
@@ -361,7 +363,7 @@ public class WebsiteCommonService {
 			keyword = keyword.substring(0, 38);
 		}
 
-		pb.setRowCountPerPage(pageSize);
+		pb.setRowCountPerPage(getListPageSize(pageSize));
 		pb.setCurrentPageNo(StringUtil.notNull(page) ? Integer.valueOf(page) : 1);
 
 		ArticleListView articleListView = WebsiteArticleManager.getArticleSearchListView(gdba, website, keyword, pb);
@@ -472,6 +474,13 @@ public class WebsiteCommonService {
 		return isGuestAccessBlocked(request);
 	}
 
+	private static int getListPageSize(int pageSize) {
+		if (pageSize <= 0) {
+			return DEFAULT_LIST_PAGE_SIZE;
+		}
+		return Math.min(pageSize, DEFAULT_LIST_PAGE_SIZE);
+	}
+
 	private static boolean isGuestAccessBlocked(HttpServletRequest request) {
 		return Boolean.TRUE.equals(request.getAttribute("guestAccessBlocked"));
 	}