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

使用校园新闻图片作为顶部红色区域底图

首页顶部红色区域动态使用校园新闻焦点文章缩略图,其他页面回退同一校园图;背景使用居中cover通铺并保留红色遮罩,避免图片变形。\n\nValidation:\n- 图片响应200且Content-Type为image/jpeg\n- background-size包含cover,background-position为50% 50%\n- 390px和1440px均生效
非繁 2 месяцев назад
Родитель
Сommit
9b0c5ba867

+ 1 - 1
WebRoot/main/ffkj-portal/news-red.css

@@ -1,6 +1,6 @@
 :root{--red:#9b1a30;--text:#222;--muted:#7f8993;--line:#e4e3e0;--page:min(1200px,calc(100vw - 40px))}
     *{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;color:var(--text);background:#fff;font-family:Arial,Helvetica,"Microsoft YaHei","PingFang SC",sans-serif;font-size:16px;line-height:24px}
-    button,input{font:inherit}.hero-head{height:405px;color:#fff;background:linear-gradient(90deg,rgba(143,12,33,.98),rgba(153,29,48,.83)),url("news-red/header-bg.jpg") center/cover;position:relative;overflow:hidden}
+    button,input{font:inherit}.hero-head{--hero-bg:url("news-red/hero-building.jpg");height:405px;color:#fff;background:linear-gradient(90deg,rgba(143,12,33,.78),rgba(153,29,48,.42)),var(--hero-bg) center center/cover no-repeat;position:relative;overflow:hidden}
     .head-inner{width:var(--page);height:100%;margin:auto;position:relative;padding-top:132px}.brand{font-size:62px;letter-spacing:3px;white-space:nowrap}.brand small{font-size:39px;margin-left:28px;letter-spacing:1px}.motto{margin-top:42px;display:flex;gap:46px;font-size:25px;letter-spacing:8px}.top-links{position:absolute;top:38px;right:0;font-family:Arial,sans-serif;font-size:18px;opacity:.92}.top-links a{color:#fff;text-decoration:none}.top-links b{padding:0 18px;font-weight:normal}.search{position:absolute;right:0;top:105px;width:485px;height:76px;background:#fff;border-radius:42px;display:flex;align-items:center;padding:0 28px;color:#9aa0a7;font-family:Arial,sans-serif}.search input{border:0;outline:0;flex:1;font-size:20px;color:#555;background:transparent}.search button{border:0;background:none;color:var(--red);font-weight:700;cursor:pointer}.slogan{position:absolute;right:32px;bottom:86px;font-size:27px;line-height:1.75;letter-spacing:7px;text-align:center}
     .main-nav{height:115px;border-bottom:1px solid var(--line);background:#fff}.main-nav ul{width:var(--page);height:100%;margin:auto;padding:0;display:flex;align-items:center;justify-content:center;gap:74px;list-style:none} .main-nav a{display:flex;align-items:center;height:100%;padding:0 4px;border-bottom:5px solid transparent;color:#253344;font-size:25px;text-decoration:none;white-space:nowrap}.main-nav a.active,.main-nav a:hover{color:var(--red);border-color:var(--red)}
     main{width:var(--page);margin:0 auto;padding-bottom:78px}.section{margin-top:57px}.section-title{height:70px;border-bottom:1px solid var(--line);display:flex;align-items:center;gap:17px;position:relative}.section-title:before{content:"";width:10px;height:43px;background:var(--red);display:block}.section-title h2{margin:0;font-size:36px;font-weight:500;letter-spacing:1px}.section-title em{font:18px Arial,sans-serif;color:#8a9097;letter-spacing:1px;font-style:normal}.more{margin-left:auto;color:#8a929b;text-decoration:none;font-size:21px}.more:hover{color:var(--red)}

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

@@ -8,7 +8,7 @@
 	<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-mobile-slogan-gap20">
+	<link rel="stylesheet" href="/main/ffkj-portal/news-red.css?v=20260918-news-red-header-campus-bg">
 </head>
 <body class="screen-red-theme">
 	<%@ include file="news-red-header.jsp"%>

+ 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-mobile-slogan-gap20">
+	<link rel="stylesheet" href="/main/ffkj-portal/news-red.css?v=20260918-news-red-header-campus-bg">
 </head>
 <body class="screen-red-theme">
 	<%@ include file="news-red-header.jsp"%>

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

@@ -1,6 +1,7 @@
 <%@ page pageEncoding="UTF-8"%>
 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
-<header class="hero-head">
+<c:set var="headerBackgroundImage" value="${empty newsRedCampusNmv.articleList[0].thumbnail ? '/main/ffkj-portal/news-red/hero-building.jpg' : newsRedCampusNmv.articleList[0].thumbnail}"/>
+<header class="hero-head" style="--hero-bg:url('${headerBackgroundImage}')">
 	<div class="head-inner">
 		<div class="top-links">
 			<c:choose>

+ 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-mobile-slogan-gap20">
+	<link rel="stylesheet" href="/main/ffkj-portal/news-red.css?v=20260918-news-red-header-campus-bg">
 </head>
 <body class="screen-red-theme">
 	<%@ include file="news-red-header.jsp"%>

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

@@ -15,7 +15,7 @@
 	<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-mobile-slogan-gap20">
+	<link rel="stylesheet" href="/main/ffkj-portal/news-red.css?v=20260918-news-red-header-campus-bg">
 </head>
 <body class="screen-red-theme">
 	<%@ include file="news-red-header.jsp"%>

+ 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-mobile-slogan-gap20">
+	<link rel="stylesheet" href="/main/ffkj-portal/news-red.css?v=20260918-news-red-header-campus-bg">
 </head>
 <body class="screen-red-theme">
 	<%@ include file="news-red-header.jsp"%>