zzwy2/view/page/history.html

104 lines
3.2 KiB
HTML
Executable File

{layout name="layout"/}
{php}
use app\model\Article;
use app\model\Category;
$childrenMenu = Category::getChildrenByParentId(Category::CATEGORY_COMPANY);
$items = Article::getList(Category::CATEGORY_COMPANY_EVENT, 1000);
$items = $items->toArray();
$items = $items['data'];
$years = array_unique(array_column($items, 'title'));
rsort($years);
$yearList = [];
foreach ($items as $item) {
foreach($years as $year) {
if (!isset($yearList[$item['title']])) {
$yearList[$item['title']] = [];
}
if (!isset($yearList[$item['title']][$item['sub_title']])) {
$yearList[$item['title']][$item['sub_title']] = [];
}
$yearList[$item['title']][$item['sub_title']] = $item;
}
}
//dd($yearList[2022]);exit;
{/php}
{include file="public/about_second" /}
<!-- 内容 -->
<div class="pull-section pull-content-bg content-bg-white wow fadeInUp" data-wow-duration="0.8s" data-wow-delay="0">
<div class="profile-title history-title history-title-wap w1360">
<p class="capitalize font-helvetica color-blue wow fadeInUp" data-wow-duration="0.8s" data-wow-delay="0">{$blocks['company_event']['value']}</p>
<strong class="wow fadeInUp" data-wow-duration="0.8s" data-wow-delay="0.2s">{$blocks['company_event']['title']}</strong>
<span class="color-blue pc-show wow fadeInUp" data-wow-duration="0.8s" data-wow-delay="0.4s">
{$blocks['company_event_desc']['value']|raw}
</span>
</div>
<div class="history flex w1360">
<div class="txt">
<div class="history-swiper-bg">
<!-- 向前 -->
<div class="swiper-button-prev">
<span class="bg-col-white flex"><img src="__STATIC__/web/images/icon/icon-arrow-prev.png" alt="向前"></span>
</div>
<div class="history-swiper swiper">
<div class="swiper-wrapper">
{foreach $yearList as $year => $months}
<div class="swiper-slide flex">
<div class="history-time">
<p class="bg-col-blue color-white">{$year ?? ''}</p>
<span><em></em></span>
</div>
<div class="history-txt">
{foreach $months as $month => $info}
<p>
<strong>{$month ?? ''}月</strong>
<span>
{php}
$eventList = json_decode($info['imgs'], true);
{/php}
{foreach $eventList as $event}
<span style="cursor: pointer" data-src="{$event.src ?? ''}" class="show-event-img">
{$event.title ??''}
</span><br>
{/foreach}
</span>
</p>
{/foreach}
</div>
</div>
{/foreach}
</div>
</div>
<!-- 向后 -->
<div class="swiper-button-next">
<span class="bg-col-white flex"><img src="__STATIC__/web/images/icon/icon-arrow-next.png" alt="向后"></span>
</div>
</div>
</div>
<div class="img">
{foreach $yearList as $year => $months}
{foreach $months as $month => $info}
{php}
$eventList = json_decode($info['imgs'], true);
{/php}
{foreach $eventList as $k => $event}
{if ($k == 0) }
<span><img id="event-img" src="{$event.src ?? ''}" alt="{$event.title ?? ''}"></span>
{php}break;{/php}
{/if}
{/foreach}
{/foreach}
{/foreach}
</div>
</div>
</div>
<script>
$('body').on('click', '.show-event-img',function () {
let src = $(this).attr('data-src');
$('#event-img').attr('src', src);
})
</script>