品牌活动
parent
75f9dac254
commit
90b5d5b700
|
@ -158,5 +158,29 @@ class Article extends Base
|
|||
return $this->json(0, 'ok', $items);
|
||||
}
|
||||
|
||||
//文章列表接口,获取栏目下文章列表
|
||||
public function getList()
|
||||
{
|
||||
$categoryId = input('category_id/d', 0);
|
||||
$page = input('page/d', 1);
|
||||
$size = input('size/d', 10);
|
||||
|
||||
if ($categoryId <= 0) {
|
||||
return $this->json(1, '参数错误');
|
||||
}
|
||||
$category = Category::getById($categoryId);
|
||||
if (empty($category)) {
|
||||
return $this->json(2, '栏目不存在');
|
||||
}
|
||||
|
||||
$items = MArticle::findListByWhere(["category_id" => $categoryId], $page, $size);
|
||||
|
||||
foreach ($items as $item) {
|
||||
$item['uri'] = archiveGetUri($item);
|
||||
$item['create_date_d'] = date('d', $item['create_time']);
|
||||
$item['create_date_y_m'] = date('Y-m', $item['create_time']);
|
||||
}
|
||||
|
||||
return $this->json(0, 'ok', $items);
|
||||
}
|
||||
}
|
|
@ -192,7 +192,7 @@ class Article extends Base
|
|||
if (is_array($param) && count($param) > 0) {
|
||||
$pageParam['param'] = $param;
|
||||
foreach ($param as $vo) {
|
||||
if (in_array($vo, ['top', 'hot', 'recommend'], true)) {
|
||||
if (in_array($vo, ['top', 'hot', 'recommend', 'is_prev'], true)) {
|
||||
$whereMap[] = ["{$vo}", '=', 1];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@ class Category extends Base
|
|||
public const CATEGORY_COMPANY_EVENT = 37;
|
||||
// 企业荣誉
|
||||
public const CATEGORY_COMPANY_HONOR = 38;
|
||||
// 品牌活动
|
||||
public const CATEGORY_BRAND_ACTIVITY = 39;
|
||||
//关于我们
|
||||
public const CATEGORY_COMPANY = 2;
|
||||
//物业服务
|
||||
|
|
|
@ -192,6 +192,18 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{if $category['id'] == 39}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">活动预告</label>
|
||||
<div class="layui-inline new-inline">
|
||||
<select name="item[is_prev]">
|
||||
<option value="0" selected>否</option>
|
||||
<option value="1">是</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if !(in_array($category['id'],[37,38]))}
|
||||
{if !isset($allowContent) || $allowContent}
|
||||
|
||||
|
|
|
@ -208,6 +208,17 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{if $category['id'] == 39}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">活动预告</label>
|
||||
<div class="layui-inline new-inline">
|
||||
<select name="item[is_prev]">
|
||||
<option value="0" {if $item['is_prev'] == 0}selected{/if}>否</option>
|
||||
<option value="1" {if $item['is_prev']}selected{/if}>是</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if !(in_array($category['id'],[37,38]))}
|
||||
{if !isset($allowContent) || $allowContent}
|
||||
|
|
|
@ -68,6 +68,7 @@ use app\model\Category as VCategory;
|
|||
<col width="150px">
|
||||
{/if}
|
||||
<col width="75px">
|
||||
<col width="75px">
|
||||
<col width="390px">
|
||||
</colgroup>
|
||||
<thead>
|
||||
|
@ -84,6 +85,9 @@ use app\model\Category as VCategory;
|
|||
<td>属性</td>
|
||||
{/if}
|
||||
<td>状态</td>
|
||||
{if $category.id == 39}
|
||||
<td>活动预告</td>
|
||||
{/if}
|
||||
<td>操作</td>
|
||||
</thead>
|
||||
{foreach name="list" item="item"}
|
||||
|
@ -111,6 +115,9 @@ use app\model\Category as VCategory;
|
|||
<td>
|
||||
{$item.status ? '<span class="text-green">正常</span>':'<span class="text-warning">隐藏</span>'}
|
||||
</td>
|
||||
{if $category.id == 39}
|
||||
<td>{$item.is_prev == 1 ? '是' : '否'}</td>
|
||||
{/if}
|
||||
<td>
|
||||
<div style="width: 340px;">
|
||||
{if !empty($attributeList)}
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
{layout name="layout"/}
|
||||
{php}
|
||||
use app\model\Article;
|
||||
use app\model\Category;
|
||||
$childrenMenu = Category::getChildrenByParentId($topCategoryId);
|
||||
$items = Article::getList(Category::CATEGORY_BRAND_ACTIVITY, $category['number'] ?? 4);
|
||||
$previewList = Article::getList(Category::CATEGORY_BRAND_ACTIVITY, 10, null, ['is_prev']);
|
||||
{/php}
|
||||
|
||||
{include file="public/about_second" /}
|
||||
|
||||
<!-- 品牌活动 -->
|
||||
<div class="pull-section brand-activities-bg wow fadeInUp" data-wow-duration="0.8s" data-wow-delay="0">
|
||||
<div class="brand-activities w1360">
|
||||
<div class="profile-title culture-title honor-title activities-title">
|
||||
<p class="capitalize font-helvetica color-blue wow fadeInUp" data-wow-duration="0.8s" data-wow-delay="0">{$blocks['brand_activity']['value']}</p>
|
||||
<strong class="wow fadeInUp" data-wow-duration="0.8s" data-wow-delay="0.2s">{$blocks['brand_activity']['title']}</strong>
|
||||
</div>
|
||||
<div class="activities-list flex">
|
||||
{foreach $items as $item}
|
||||
<a href="/activity-detail.html?id={$item.id}" class="activities-item flex wow fadeInUp" data-wow-duration="0.8s" data-wow-delay="0">
|
||||
<div class="img"><img src="{$isMobile ? $item.src_mobile : $item.src}" alt="{$item.title}"></div>
|
||||
<div class="txt bg-col-f5">
|
||||
<h2 class="clips1">{$item.title}</h2>
|
||||
<p class="color-66 clips3">{$item.summary}</p>
|
||||
<span class="article-more-btn color-blue">查看详情<img src="__STATIC__/web/images/icon/icon-arrow-more.png" alt="查看详情"></span>
|
||||
</div>
|
||||
</a>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="text-align: center;margin-top: 15px;display: none" class="show-msg">没有更多了</div>
|
||||
<div class="load-more color-66 get-more-list" data-href="/article/getList?category_id={:Category::CATEGORY_BRAND_ACTIVITY}" data-page="2" data-size="{$category['number'] ?? 4}">点击加载更多</div>
|
||||
</div>
|
||||
|
||||
<!-- 活动预告 -->
|
||||
<div class="pull-section pull-content-bg bg-col-f5 wow fadeInUp" data-wow-duration="0.8s" data-wow-delay="0">
|
||||
<div class="profile-title culture-title honor-title activities-title w1360">
|
||||
<p class="capitalize font-helvetica color-blue wow fadeInUp" data-wow-duration="0.8s" data-wow-delay="0">{$blocks['event_preview']['value']}</p>
|
||||
<strong class="wow fadeInUp" data-wow-duration="0.8s" data-wow-delay="0.2s">{$blocks['event_preview']['title']}</strong>
|
||||
</div>
|
||||
<div class="event-preview">
|
||||
<div class="preview-swiper swiper">
|
||||
<div class="swiper-wrapper">
|
||||
{foreach $previewList as $prev}
|
||||
<a href="/activity-detail.html?id={$prev.id}" class="preview-item swiper-slide flex">
|
||||
<div class="img"><img src="{$isMobile ? $prev.src_mobile : $prev.src}" alt="{$prev.title}"></div>
|
||||
<div class="txt bg-col-white">
|
||||
<h2 class="clips1">{$prev.title}</h2>
|
||||
<p class="color-66 clips3">{$prev.summary}</p>
|
||||
<span class="article-more-btn color-blue">查看详情<img src="__STATIC__/web/images/icon/icon-arrow-more.png" alt="查看详情"></span>
|
||||
<em class="uppercase font-helvetica pc-show">Events</em>
|
||||
</div>
|
||||
</a>
|
||||
{/foreach}
|
||||
</div>
|
||||
<!-- 切换按钮 -->
|
||||
<div class="swiper-button-prev"><img src="__STATIC__/web/images/icon/icon-preview-btn.png" alt="向前"></div>
|
||||
<div class="swiper-button-next"><img src="__STATIC__/web/images/icon/icon-preview-btn.png" alt="向后"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$('body').on('click', '.get-more-list', function () {
|
||||
let that = $(this);
|
||||
let url = that.data('href');
|
||||
let page = that.data('page');
|
||||
let size = that.data('size');
|
||||
size = 10
|
||||
console.log(page, 'page')
|
||||
console.log(size, 'size')
|
||||
$.post(url, {page: page, size: size}, function (res) {
|
||||
if (res.code === 0) {
|
||||
if (!res.data || res.data.length <= 0) {
|
||||
$('.show-msg').show();
|
||||
setTimeout(function () {
|
||||
$('.show-msg').hide();
|
||||
}, 2000)
|
||||
return false;
|
||||
}
|
||||
let html = '';
|
||||
$.each(res.data, function (index, item) {
|
||||
html += `
|
||||
<a href="/activity-detail.html?id=${item.id}" class="activities-item flex wow fadeInUp" data-wow-duration="0.8s" data-wow-delay="0">
|
||||
<div class="img"><img src="${item.src}" alt="${item.title}"></div>
|
||||
<div class="txt bg-col-f5">
|
||||
<h2 class="clips1">${item.title}</h2>
|
||||
<p class="color-66 clips3">${item.summary}</p>
|
||||
<span class="article-more-btn color-blue">查看详情<img src="__STATIC__/web/images/icon/icon-arrow-more.png" alt="查看详情"></span>
|
||||
</div>
|
||||
</a>
|
||||
`;
|
||||
})
|
||||
page++;
|
||||
that.data('page', page)
|
||||
$('.activities-list').append(html);
|
||||
return false;
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
Loading…
Reference in New Issue