更新:产品页面显示所有产品分类,样式待调整
parent
bc710ece5c
commit
337cb0b40d
|
@ -144,12 +144,13 @@ class Article extends Base
|
|||
{
|
||||
$cateIds[] = $article['category_id'];
|
||||
$currentCateId = input('param.source', 0);
|
||||
$categoryList = Category::getChildrenByParentId($topCategory['id']);
|
||||
if($currentCateId == $topCategory['id']) {
|
||||
$categoryList = Category::getChildrenByParentId($topCategory['id']);
|
||||
foreach ($categoryList as $cate) {
|
||||
$cateIds[] = $cate['id'];
|
||||
}
|
||||
}
|
||||
$this->data['categoryChildren'] = $categoryList;
|
||||
$this->data['prev'] = MArticle::getPrevArticleByIdAndCategories($article['id'], $cateIds, true, $article['sort'], true);
|
||||
$this->data['next'] = MArticle::getNextArticleByIdAndCategories($article['id'], $cateIds, true, $article['sort'], true);
|
||||
$this->data['currentCateId'] = $currentCateId;
|
||||
|
|
|
@ -16,19 +16,12 @@ class Index extends Base
|
|||
$this->data['blocks'] = $blocks;
|
||||
// 轮播图
|
||||
$this->data['slides'] = Slide::getList();
|
||||
// 网络营销栏目ID
|
||||
// 营销网络栏目ID
|
||||
$this->data['marketingCId'] = Category::$CIdList['marketing'];
|
||||
// 关联产品中心
|
||||
$productsCId = Category::$CIdList['products'];
|
||||
$productChildren = Category::getChildrenByParentId($productsCId);
|
||||
$productsCIds[] = $productsCId;
|
||||
foreach ($productChildren as $cate) {
|
||||
$productsCIds[] = $cate['id'];
|
||||
}
|
||||
$this->data['products'] = [
|
||||
'category' => Category::getById($productsCId),
|
||||
'items' => Article::getListByCategoryIds($productsCIds, 4, '', [], 1, ['create_time'=>'desc'])
|
||||
];
|
||||
// 关联产品分类
|
||||
$productsCenterCId = Category::$CIdList['products'];
|
||||
$this->data['productsCenter'] = Category::getById($productsCenterCId);
|
||||
$this->data['products'] = Category::getChildrenByParentId($productsCenterCId);
|
||||
// 关联新闻
|
||||
$this->data['newsCenter'] = Category::getById(Category::$CIdList['news']);
|
||||
$newsCIdList = [Category::$CIdList['news_children']['enterprise'], Category::$CIdList['news_children']['industry']];
|
||||
|
|
|
@ -13,6 +13,23 @@
|
|||
<!-- -->
|
||||
<div class="all-center-box">
|
||||
<div class="news-info w-100">
|
||||
<div class="w-1200 product-title-box">
|
||||
{if isset($categoryChildren) && count($categoryChildren) >0}
|
||||
{foreach $categoryChildren as $idx => $cate}
|
||||
{php}
|
||||
$active = '';
|
||||
if($categoryId == $cate['id']) {
|
||||
$active = 'active';
|
||||
} elseif ($categoryId == $topCategory['id'] && $idx == 0) {
|
||||
$active = 'active';
|
||||
}
|
||||
{/php}
|
||||
<div class="product-item {$active}">
|
||||
<a href="{:url('article/index', ['category_id'=>$cate.id])}">{$cate.title}</a>
|
||||
</div>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</div>
|
||||
<div class="w-1200">
|
||||
<div class="top-box w-100">
|
||||
<span>{$article.title}</span>
|
||||
|
|
|
@ -28,6 +28,23 @@
|
|||
</form>
|
||||
</div>
|
||||
-->
|
||||
<div class="w-1200 product-title-box">
|
||||
{if isset($categoryChildren) && count($categoryChildren) >0}
|
||||
{foreach $categoryChildren as $idx => $cate}
|
||||
{php}
|
||||
$active = '';
|
||||
if($categoryId == $cate['id']) {
|
||||
$active = 'active';
|
||||
} elseif ($categoryId == $topCategory['id'] && $idx == 0) {
|
||||
$active = 'active';
|
||||
}
|
||||
{/php}
|
||||
<div class="product-item {$active}">
|
||||
<a href="{:url('article/index', ['category_id'=>$cate.id])}">{$cate.title}</a>
|
||||
</div>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</div>
|
||||
<div class="w-1200">
|
||||
{if isset($items)}
|
||||
<div class="center-block w-100">
|
||||
|
|
|
@ -30,22 +30,23 @@
|
|||
</div>
|
||||
|
||||
<div class="all-center-box">
|
||||
<!-- products -->
|
||||
<div class="home-box1 w-100">
|
||||
<div class="w-1500">
|
||||
<div class="all-title-box1 w-100"><span>{$products['category']['title'] ?? '产品中心'}</span>
|
||||
<p>{$products['category']['description'] ?? 'product center'}</p></div>
|
||||
<div class="all-title-box1 w-100"><span>{$productsCenter['title'] ?? '产品中心'}</span>
|
||||
<p>{$productsCenter['description'] ?? 'product center'}</p></div>
|
||||
<div class="center-block w-100">
|
||||
{if isset($products) && count($products['items']) > 0}
|
||||
{if isset($products) && count($products) > 0}
|
||||
<ul>
|
||||
{foreach $products['items'] as $idx => $product}
|
||||
{foreach $products as $idx => $product}
|
||||
<li {if $idx == 0}class="active"{/if}>
|
||||
<div class="box-info" style="background-image: url({$product['src']});">
|
||||
<div class="box1">
|
||||
<span>{$product['title']}</span>
|
||||
<p>{$product['summary']|raw}</p>
|
||||
<p>{$product['description']}</p>
|
||||
</div>
|
||||
<div class="box2">
|
||||
<a href="{:url('article/detail', ['id'=>$product['id']])}">了解详情+</a>
|
||||
<a href="{:url('article/index', ['category_id'=>$product['id']])}">了解详情+</a>
|
||||
<i>{:str_pad($idx + 1, 2, '0', STR_PAD_LEFT)}</i>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -56,6 +57,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- marketing -->
|
||||
<div class="home-box2 w-100" style="background-image: url({$blocks['marketing_background']['value'] ?? ''});">
|
||||
<div class="w-1500">
|
||||
<div class="pull-left column-between">
|
||||
|
@ -71,6 +73,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- news -->
|
||||
<div class="home-box3 w-100">
|
||||
<div class="w-1200">
|
||||
<div class="top-box w-100"><div class="between-bottom"><span>{$newsCenter['title'] ?? '新闻动态'}</span><i>{$newsCenter['description'] ?? ''}</i></div></div>
|
||||
|
|
Loading…
Reference in New Issue