更新blog界面
This commit is contained in:
@@ -1909,9 +1909,38 @@ section,
|
||||
}
|
||||
|
||||
.blog-posts .post-img {
|
||||
max-height: 240px;
|
||||
height: 240px;
|
||||
margin: -30px -30px 15px -30px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.blog-posts .post-img img {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover; /* 居中裁剪,撑满容器 */
|
||||
object-position: center;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* 新结构:blog.php 中的预览图容器 */
|
||||
.blog-posts .post-media {
|
||||
height: 240px;
|
||||
margin: -30px -30px 15px -30px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.blog-posts .post-media-img {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
object-position: center;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.blog-posts .post-category {
|
||||
@@ -1921,11 +1950,15 @@ section,
|
||||
}
|
||||
|
||||
.blog-posts .title {
|
||||
height: 48px;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
padding: 0;
|
||||
margin: 0 0 20px 0;
|
||||
height: 48px;
|
||||
overflow: hidden;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
}
|
||||
|
||||
.blog-posts .title a {
|
||||
|
||||
@@ -13,7 +13,7 @@ if ($currentPage < 1) {
|
||||
$currentPage = 1;
|
||||
}
|
||||
|
||||
$pageSize = 4; // 每页展示 4 条(grid 中每条占 col-lg-6,所以刚好两行)
|
||||
$pageSize = 8; // 每页展示 8 条(grid 中每条占 col-lg-6,所以刚好四行)
|
||||
$totalCount = count($allNewsList);
|
||||
$totalPages = (int)ceil($totalCount / $pageSize);
|
||||
if ($totalPages < 1) {
|
||||
@@ -43,7 +43,7 @@ $newsListForPage = array_slice($allNewsList, ($currentPage - 1) * $pageSize, $pa
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-8">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<!-- Blog Posts Section -->
|
||||
<section id="blog-posts" class="blog-posts section">
|
||||
@@ -74,14 +74,15 @@ $newsListForPage = array_slice($allNewsList, ($currentPage - 1) * $pageSize, $pa
|
||||
$imgSrc = $baseUrl . "/themes/template3/assets/img/blog/blog-{$imgIndex}.jpg";
|
||||
}
|
||||
|
||||
$articleUrl = $apiUrl . '/article_detail/' . ($item['id'] ?? 0);
|
||||
// 文章详情链接必须走前台域名,否则 api.yunzer.cn 上租户解析不生效
|
||||
$articleUrl = $baseUrl . '/article_detail/' . ($item['id'] ?? 0);
|
||||
?>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<div class="col-lg-3 col-md-6">
|
||||
<article>
|
||||
|
||||
<div class="post-img">
|
||||
<img src="<?php echo htmlspecialchars($imgSrc); ?>" alt="" class="img-fluid">
|
||||
<div class="post-media">
|
||||
<img src="<?php echo htmlspecialchars($imgSrc); ?>" alt="" class="post-media-img" />
|
||||
</div>
|
||||
|
||||
<p class="post-category"><?php echo htmlspecialchars($category); ?></p>
|
||||
@@ -150,87 +151,7 @@ $newsListForPage = array_slice($allNewsList, ($currentPage - 1) * $pageSize, $pa
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4 sidebar">
|
||||
|
||||
<div class="widgets-container">
|
||||
|
||||
<!-- Search Widget -->
|
||||
<div class="search-widget widget-item">
|
||||
|
||||
<h3 class="widget-title">搜索</h3>
|
||||
<form action="">
|
||||
<input type="text">
|
||||
<button type="submit" title="Search"><i class="bi bi-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div><!--/Search Widget -->
|
||||
|
||||
<!-- Categories Widget -->
|
||||
<div class="categories-widget widget-item">
|
||||
|
||||
<h3 class="widget-title">分类</h3>
|
||||
<ul class="mt-3">
|
||||
<li><a href="#">General <span>(25)</span></a></li>
|
||||
<li><a href="#">Lifestyle <span>(12)</span></a></li>
|
||||
<li><a href="#">Travel <span>(5)</span></a></li>
|
||||
<li><a href="#">Design <span>(22)</span></a></li>
|
||||
<li><a href="#">Creative <span>(8)</span></a></li>
|
||||
<li><a href="#">Educaion <span>(14)</span></a></li>
|
||||
</ul>
|
||||
|
||||
</div><!--/Categories Widget -->
|
||||
|
||||
<!-- Recent Posts Widget -->
|
||||
<div class="recent-posts-widget widget-item">
|
||||
|
||||
<h3 class="widget-title">最新文章</h3>
|
||||
|
||||
<div class="post-item">
|
||||
<img src="<?php echo $baseUrl; ?>/themes/template3/assets/img/blog/blog-recent-1.jpg" alt="" class="flex-shrink-0">
|
||||
<div>
|
||||
<h4><a href="<?php echo $baseUrl; ?>/blog-details">Nihil blanditiis at in nihil autem</a></h4>
|
||||
<time datetime="2020-01-01">Jan 1, 2020</time>
|
||||
</div>
|
||||
</div><!-- End recent post item-->
|
||||
|
||||
<div class="post-item">
|
||||
<img src="<?php echo $baseUrl; ?>/themes/template3/assets/img/blog/blog-recent-2.jpg" alt="" class="flex-shrink-0">
|
||||
<div>
|
||||
<h4><a href="<?php echo $baseUrl; ?>/blog-details">Quidem autem et impedit</a></h4>
|
||||
<time datetime="2020-01-01">Jan 1, 2020</time>
|
||||
</div>
|
||||
</div><!-- End recent post item-->
|
||||
|
||||
<div class="post-item">
|
||||
<img src="<?php echo $baseUrl; ?>/themes/template3/assets/img/blog/blog-recent-3.jpg" alt="" class="flex-shrink-0">
|
||||
<div>
|
||||
<h4><a href="<?php echo $baseUrl; ?>/blog-details">Id quia et et ut maxime similique occaecati ut</a></h4>
|
||||
<time datetime="2020-01-01">Jan 1, 2020</time>
|
||||
</div>
|
||||
</div><!-- End recent post item-->
|
||||
|
||||
<div class="post-item">
|
||||
<img src="<?php echo $baseUrl; ?>/themes/template3/assets/img/blog/blog-recent-4.jpg" alt="" class="flex-shrink-0">
|
||||
<div>
|
||||
<h4><a href="<?php echo $baseUrl; ?>/blog-details">Laborum corporis quo dara net para</a></h4>
|
||||
<time datetime="2020-01-01">Jan 1, 2020</time>
|
||||
</div>
|
||||
</div><!-- End recent post item-->
|
||||
|
||||
<div class="post-item">
|
||||
<img src="<?php echo $baseUrl; ?>/themes/template3/assets/img/blog/blog-recent-5.jpg" alt="" class="flex-shrink-0">
|
||||
<div>
|
||||
<h4><a href="<?php echo $baseUrl; ?>/blog-details">Et dolores corrupti quae illo quod dolor</a></h4>
|
||||
<time datetime="2020-01-01">Jan 1, 2020</time>
|
||||
</div>
|
||||
</div><!-- End recent post item-->
|
||||
|
||||
</div><!--/Recent Posts Widget -->
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<a href="<?php echo $baseUrl; ?>/" class="logo d-flex align-items-center">
|
||||
<img src="<?php echo htmlspecialchars($homeInfo['normal']['logo']); ?>" alt="">
|
||||
</a>
|
||||
<p><?php echo htmlspecialchars($seoDescription); ?></p>
|
||||
<p><?php echo htmlspecialchars($homeInfo['normal']['description']); ?></p>
|
||||
<!-- <div class="social-links d-flex mt-4">
|
||||
<a href=""><i class="bi bi-twitter-x"></i></a>
|
||||
<a href=""><i class="bi bi-facebook"></i></a>
|
||||
|
||||
@@ -50,6 +50,13 @@ $newsUrl = $apiUrl . '/getCenterNews?baseUrl=' . urlencode($host);
|
||||
$newsRes = fetchApiData($newsUrl);
|
||||
$newsList = $newsRes['list'] ?? [];
|
||||
|
||||
// 调用 文章分类 接口
|
||||
$articleCategoryUrl = $apiUrl . '/getArticleCategories?baseUrl=' . urlencode($host);
|
||||
$articleCategoryRes = fetchApiData($articleCategoryUrl);
|
||||
$articleCategoryList = $articleCategoryRes['list'] ?? [];
|
||||
|
||||
print_r($articleCategoryList);
|
||||
|
||||
// 获取特色服务
|
||||
$servicesList = $homeInfo['services'] ?? [];
|
||||
|
||||
@@ -75,7 +82,7 @@ $seoKeywords = $pageKeywords ?? ($homeInfo['normal']['keywords'] ?? '');
|
||||
|
||||
<!-- 使用页面级 SEO 变量 -->
|
||||
<title><?php echo htmlspecialchars($seoTitle); ?></title>
|
||||
<meta name="description" content="<?php echo htmlspecialchars($seoDescription); ?>">
|
||||
<meta name="description" content="<?php echo htmlspecialchars($homeInfo['normal']['description']); ?>">
|
||||
<meta name="keywords" content="<?php echo htmlspecialchars($seoKeywords); ?>">
|
||||
|
||||
<link href="<?php echo $baseUrl; ?>/themes/template3/assets/img/favicon.png" rel="icon">
|
||||
|
||||
@@ -433,7 +433,8 @@ require_once __DIR__ . '/header.php';
|
||||
}
|
||||
|
||||
// 文章详情链接
|
||||
$articleUrl = $apiUrl . '/article_detail/' . ($item['id'] ?? 0);
|
||||
// 文章详情链接必须走前台域名,否则 api.yunzer.cn 上租户解析不生效
|
||||
$articleUrl = $baseUrl . '/article_detail/' . ($item['id'] ?? 0);
|
||||
|
||||
// 计算 AOS 动画延迟
|
||||
$delay = ($i % 4) * 200;
|
||||
|
||||
Reference in New Issue
Block a user