refactor: 首页品牌故事年份显示问题

This commit is contained in:
2025-05-14 11:24:02 +08:00
parent 7f0547ff61
commit 80c549a72f
2 changed files with 12 additions and 4 deletions

View File

@@ -19,6 +19,7 @@ class Index extends Common
*/
public function index()
{
// 获取banner数据
$banner = $this->getBannerData();
View::assign('focus_images', $banner['focus_images']);
@@ -26,7 +27,14 @@ class Index extends Common
View::assign('featured_topics', $banner['featured_topics']);
View::assign('video', array_shift($banner['video']));
View::assign('scenes', $banner['scenes']);
View::assign('brand_story', $banner['brand_story']);
View::assign('brand_story', array_map(function($item) {
$item['year'] = '';
$arr = explode('-', $item['title']);
if (count($arr) > 1) {
$item['year'] = $arr[0];
}
return $item;
}, $banner['brand_story']??null));
View::assign('data_statistics', $banner['data_statistics']);
// 获取明星产品/热点产品

View File

@@ -167,9 +167,9 @@
<div class="bs_swcontainer">
<div class="swiper-pagination bs_pagination"></div>
<hr>
<!-- <span class="time1">2021</span> -->
<!-- <span class="time2">2022</span> -->
<!-- <span class="time3">2023</span> -->
{volist name="brand_story" id="story" key="k"}
<span class="time{$k}">{$story.year}</span>
{/volist}
</div>
<div class="swiper-container bs_bts">
<img class="slideshow-btn swiper-button-next" src="static/index/temp_images/rightcheck.png" alt="" />