活动列表完善、媒体报道完善
parent
4ea0fd60a2
commit
3408ccb752
|
@ -65,7 +65,8 @@ class Index extends Base
|
|||
// 案例
|
||||
private function cases()
|
||||
{
|
||||
$casesList = CasesModel::where('home', 1)->order('sort', 'desc')->order('id', 'desc')->select();
|
||||
$casesList = CasesModel::where('home', 1)->order('sort', 'desc')
|
||||
->order('id', 'desc')->limit(4)->select();
|
||||
|
||||
$this->data['casesList'] = $casesList;
|
||||
}
|
||||
|
|
|
@ -212,6 +212,74 @@ class Article extends Base
|
|||
->paginate($paginate, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $where
|
||||
* @return \think\Paginator
|
||||
* @throws \think\db\exception\DbException
|
||||
*/
|
||||
public static function getListByWhere(array $where)
|
||||
{
|
||||
$categoryId = $where['category_id'];
|
||||
$per = $where['size'];
|
||||
$keyword = $where['keyword'] ?? '';
|
||||
$param = $where['param'] ?? [];
|
||||
$status = $where['status'] ?? -1;
|
||||
$orderList = $where['order'] ?? ['sort' => 'desc'];
|
||||
$onlyChild = $where['only_child'] ?? true;
|
||||
$whereList = $where['where'] ?? [];
|
||||
|
||||
$whereMap = [];
|
||||
$pageParam = [];
|
||||
|
||||
if (!empty($whereList)) {
|
||||
foreach ($whereList as $w) {
|
||||
$whereMap[] = $w;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_numeric($categoryId) && $categoryId > 0) {
|
||||
$children = Category::getChildrenByParentId($categoryId, $onlyChild);
|
||||
if (!empty($children)) {
|
||||
$categoryIds = [$categoryId];
|
||||
foreach ($children as $child) {
|
||||
if ($child['model_id'] == Model::MODEL_ARTICLE) {
|
||||
$categoryIds[] = $child['id'];
|
||||
}
|
||||
}
|
||||
$whereMap[] = ['category_id', 'in', $categoryIds];
|
||||
} else {
|
||||
$whereMap[] = ['category_id', '=', $categoryId];
|
||||
}
|
||||
$pageParam['category_id'] = $categoryId;
|
||||
}
|
||||
if (!empty($keyword)) {
|
||||
$whereMap[] = ['title', 'like', '%'.$keyword.'%'];
|
||||
$pageParam['keyword'] = $keyword;
|
||||
}
|
||||
if (is_array($param) && count($param) > 0) {
|
||||
$pageParam['param'] = $param;
|
||||
foreach ($param as $vo) {
|
||||
if (in_array($vo, ['top', 'hot', 'recommend', 'is_prev'], true)) {
|
||||
$whereMap[] = ["{$vo}", '=', 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
$paginate = [
|
||||
'list_rows' => $per,
|
||||
'query' => $pageParam
|
||||
];
|
||||
|
||||
return self::with(["archivesCategory"])
|
||||
->when(count($whereMap) > 0, function ($query) use ($whereMap) {
|
||||
$query->where($whereMap);
|
||||
})
|
||||
->when($status != -1, function ($query) use ($status) {
|
||||
$query->where('status', $status);
|
||||
})
|
||||
->order($orderList)
|
||||
->paginate($paginate, false);
|
||||
}
|
||||
|
||||
//获取文章涉及到的图片
|
||||
public static function getFilesInUse()
|
||||
{
|
||||
|
|
|
@ -40,6 +40,7 @@ if (!$topNews->isEmpty()) {
|
|||
<div class="pull-section pull-content-bg news-list-bg bg-col-f5 wow fadeInUp" data-wow-duration="0.8s" data-wow-delay="0">
|
||||
<div class="news-list w1360">
|
||||
{foreach $items as $item}
|
||||
{if $item['id'] != ($topNews['id'] ?? 0)}
|
||||
<a href="/news/{$item.id}.html" class="news-item bg-col-white 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 wow fadeInUp" data-wow-duration="0.8s" data-wow-delay="0">
|
||||
|
@ -56,6 +57,7 @@ if (!$topNews->isEmpty()) {
|
|||
</div>
|
||||
</div>
|
||||
</a>
|
||||
{/if}
|
||||
{/foreach}
|
||||
|
||||
<div style="text-align: center;margin-top: 15px;display: none" class="show-msg">没有更多了</div>
|
||||
|
|
|
@ -3,7 +3,11 @@
|
|||
use app\model\Article;
|
||||
use app\model\Category;
|
||||
$childrenMenu = Category::getChildrenByParentId($topCategoryId);
|
||||
$items = Article::getList(Category::CATEGORY_BRAND_ACTIVITY, $category['number'] ?? 4);
|
||||
$where = [];
|
||||
$where['category_id'] = Category::CATEGORY_BRAND_ACTIVITY;
|
||||
$where['size'] = $category['number'] ?? 4;
|
||||
$where['where'] = [['is_prev', '=',0]];
|
||||
$items = Article::getListByWhere($where);
|
||||
$previewList = Article::getList(Category::CATEGORY_BRAND_ACTIVITY, 10, null, ['is_prev']);
|
||||
{/php}
|
||||
|
||||
|
@ -16,8 +20,11 @@ $previewList = Article::getList(Category::CATEGORY_BRAND_ACTIVITY, 10, null, ['i
|
|||
<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>
|
||||
{foreach $items as $k => $item}
|
||||
{if $k%4==0}
|
||||
|
||||
<div class="activities-list flex">
|
||||
{foreach $items as $item}
|
||||
{/if}
|
||||
<a href="/activity/{$item.id}.html" 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">
|
||||
|
@ -26,8 +33,8 @@ $previewList = Article::getList(Category::CATEGORY_BRAND_ACTIVITY, 10, null, ['i
|
|||
<span class="article-more-btn color-blue">查看详情<img src="__STATIC__/web/images/icon/icon-arrow-more.png" alt="查看详情"></span>
|
||||
</div>
|
||||
</a>
|
||||
{/foreach}
|
||||
</div>
|
||||
{/foreach}
|
||||
{if $k%3 == 0 || ($k == count($items) - 1)}</div>{/if}
|
||||
</div>
|
||||
|
||||
<div style="text-align: center;margin-top: 15px;display: none" class="show-msg">没有更多了</div>
|
||||
|
@ -79,6 +86,10 @@ $previewList = Article::getList(Category::CATEGORY_BRAND_ACTIVITY, 10, null, ['i
|
|||
}
|
||||
let html = '';
|
||||
$.each(res.data, function (index, item) {
|
||||
console.log(index,'sdfdasfs')
|
||||
if (index%4 === 0) {
|
||||
html += `<div class="activities-list flex">`;
|
||||
}
|
||||
html += `
|
||||
<a href="/activity/id=${item.id}.html" 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>
|
||||
|
@ -89,10 +100,14 @@ $previewList = Article::getList(Category::CATEGORY_BRAND_ACTIVITY, 10, null, ['i
|
|||
</div>
|
||||
</a>
|
||||
`;
|
||||
if (index === 3 || index=== (res.data.length - 1)) {
|
||||
html += `</div>`;
|
||||
}
|
||||
})
|
||||
page++;
|
||||
that.data('page', page)
|
||||
$('.activities-list').append(html);
|
||||
that.data('page', page);
|
||||
$('.brand-activities').append(html);
|
||||
html = '';
|
||||
return false;
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue