更新:新闻和产品基本数据输出测试
parent
417ce665fc
commit
2b6ad4fe1f
|
@ -44,38 +44,24 @@ class Article extends Base
|
|||
$childCategory = Category::getChildrenByParentId($categoryId);
|
||||
$description = $category['description'] ? $category['description'] : $this->system['seo_description'];
|
||||
$this->setSeo($category['title'], $this->system['seo_keywords'], $description);
|
||||
$this->data['items'] = MArticle::getListPageByCategory($categoryId, $category['number'] ? $category['number'] : 20);
|
||||
$childList = [];
|
||||
$defaultList = [];
|
||||
// 若存在下级子栏目则优先分组显示子栏目内容
|
||||
if(!empty($childCategory)) {
|
||||
foreach ($childCategory as $child) {
|
||||
$childList[] = [
|
||||
'category' => $child,
|
||||
'items' => MArticle::getListPageByCategory($child['id'], $child['number'] ? $child['number'] : 20),
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$defaultList = MArticle::getListPageByCategory($categoryId, $category['number'] ? $category['number'] : 20);
|
||||
}
|
||||
$this->data['items'] = $defaultList;
|
||||
$this->data['childList'] = $childList;
|
||||
$this->data['category'] = $category;
|
||||
$this->data['categoryId'] = $categoryId;
|
||||
$this->data['childCategory'] = $childCategory;
|
||||
return $this->view($category['template_list'] ?? '');
|
||||
}
|
||||
|
||||
// //新闻列表
|
||||
// public function news($categoryId)
|
||||
// {
|
||||
// dump('新闻资讯');
|
||||
// dump($categoryId);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// //新闻详情
|
||||
// public function newsDetail($newsId)
|
||||
// {
|
||||
// dump('新闻资讯详情');
|
||||
// dump($newsId);
|
||||
// }
|
||||
//
|
||||
// // 产品列表
|
||||
//// public function product($categoryId)
|
||||
//// {
|
||||
//// dump('产品列表');
|
||||
//// dump($categoryId);
|
||||
//// }
|
||||
//
|
||||
// // 产品列表
|
||||
// public function productDetail($productId)
|
||||
// {
|
||||
// dump('产品详情');
|
||||
// dump($productId);
|
||||
// }
|
||||
}
|
|
@ -22,7 +22,6 @@ class Index extends Base
|
|||
$this->data['newsEnterprises'] = Article::getLatestByCategory(Category::$CIdList['news_enterprise'], 4);
|
||||
// 关联行业资讯
|
||||
$this->data['newsIndustries'] = Article::getLatestByCategory(Category::$CIdList['news_industry'], 4);;
|
||||
//dump($this->data);
|
||||
return $this->view();
|
||||
}
|
||||
}
|
|
@ -195,4 +195,21 @@ class Category extends Base
|
|||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
//根据栏目ID获取面包屑列表
|
||||
public static function getListForCrumbs($categoryId)
|
||||
{
|
||||
$categories = [];
|
||||
$category = self::getById($categoryId);
|
||||
if(!empty($category)){
|
||||
$categories[] = $category;
|
||||
if($category['parent_id'] != 0 ){
|
||||
$parents = self::getListForCrumbs($category['parent_id']);
|
||||
if(!empty($parents)){
|
||||
$categories = array_merge($categories, $parents);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $categories;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,9 @@ class Crumbs
|
|||
{
|
||||
public function index($categoryId)
|
||||
{
|
||||
$list = array_reverse(Category::getListForCrumbs($categoryId));
|
||||
$data = [
|
||||
'crumbs' => Category::getCatesCrumbs($categoryId)
|
||||
'crumbs' => $list
|
||||
];
|
||||
return View::assign($data)->fetch('public/crumbs');
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ input,select,textarea{outline:medium none; resize: none;}
|
|||
.foot-box .lower-box .ewm img{ width: 134px;}
|
||||
|
||||
.page-banner{ height: 40.625rem; position: relative; background-position: center; background-size: cover; position: relative; z-index: 2;}
|
||||
.page-banner .info{ width: 100%; position: absolute; left: 0; bottom: 2.5rem; color: #fff; padding-bottom: ;}
|
||||
.page-banner .info{ width: 100%; position: absolute; left: 0; bottom: 2.5rem; color: #fff;}
|
||||
.page-banner .info strong{ font-size: 3.125rem; text-shadow: 0 0 5px rgba(0,0,0,0.5);}
|
||||
.page-banner .info p{ font-size: 1.875rem; text-shadow: 0 0 5px rgba(0,0,0,0.5);}
|
||||
.page-banner .info .w-1200{ position: relative;}
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
{layout name="layout" /}
|
||||
|
||||
<div class="all_center_box">
|
||||
{php}
|
||||
$bgImg = '__IMG__/page_ban1.jpg'; // 默认背景图
|
||||
if (isset($category) && !empty(trim($category['src'])) && file_exists('./'.$category['src'])) {
|
||||
$bgImg = $category.src;
|
||||
}
|
||||
{/php}
|
||||
<div class="page_banner wf100">
|
||||
<div class="bg" style="background-image: url({$bgImg});"></div>
|
||||
</div>
|
||||
<div class="news_box w-100">
|
||||
<div class="crumbs_box w-1500">
|
||||
{:widget('crumbs/index', ['categoryId' => $categoryId])}
|
||||
</div>
|
||||
<div class="news_soso w-1500" aos="fade-up">
|
||||
<div class="center-block ">
|
||||
<input type="text" class="text" name="keyword" id="articleKeyword" placeholder="请输入关键字" />
|
||||
<input type="button" class="btns" value="搜索" id="sosSubmit"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="news_list w-100" aos="fade-up">
|
||||
{if isset($childList) && count($childList) > 0}
|
||||
{foreach $childList as $child}
|
||||
<hr/>
|
||||
<div class="news-child-title">{$child['category']['title'] ?? ''}</div>
|
||||
{if count($child['items']) > 0}
|
||||
<ul class="w-1500">
|
||||
{foreach $child['items'] as $item}
|
||||
{php}
|
||||
if (!empty($item['link'])){
|
||||
$url = $item['link'];
|
||||
$target = 'target="_blank"';
|
||||
} else {
|
||||
$url = url('article/detail', ['id'=>$item['id']]);
|
||||
$target = '';
|
||||
}
|
||||
$imgSrc = '__IMG__/article_bg.jpg';
|
||||
if (!empty(trim($item['src'])) && file_exists('./'.$item['src'])) {
|
||||
$imgSrc = $item['src'];
|
||||
}
|
||||
{/php}
|
||||
<li>
|
||||
<a href="{$url}" {$target}>
|
||||
<div class="imgs wf100">
|
||||
<img src="{$imgSrc}" alt="{$item['title']}" />
|
||||
<span><i {if $item['hot']}class="active"{/if}></i></span>
|
||||
</div>
|
||||
<div class="info w-100">
|
||||
<div class="box1">
|
||||
<span>{$item.create_time|date='Y.m.d'}</span>
|
||||
<span>{$item['category_title'] ?? ''}</span>
|
||||
</div>
|
||||
<div class="box2 w-100">
|
||||
<span>{$item['title']}</span>
|
||||
<p>{$item['summary']}</p>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
{/foreach}
|
||||
|
||||
{elseif isset($items) && count($items) > 0 /}
|
||||
<ul class="w-1500">
|
||||
{foreach $items as $item}
|
||||
{php}
|
||||
if (!empty($item['link'])){
|
||||
$url = $item['link'];
|
||||
$target = 'target="_blank"';
|
||||
} else {
|
||||
$url = url('article/detail', ['id'=>$item['id']]);
|
||||
$target = '';
|
||||
}
|
||||
$imgSrc = '__IMG__/article_bg.jpg';
|
||||
if (!empty(trim($item['src'])) && file_exists('./'.$item['src'])) {
|
||||
$imgSrc = $item['src'];
|
||||
}
|
||||
{/php}
|
||||
<li>
|
||||
<a href="{$url}" {$target}>
|
||||
<div class="imgs wf100">
|
||||
<img src="{$imgSrc}" alt="{$item['title']}" />
|
||||
<span><i {if $item['hot']}class="active"{/if}></i></span>
|
||||
</div>
|
||||
<div class="info w-100">
|
||||
<div class="box1">
|
||||
<span>{$item.create_time|date='Y.m.d'}</span>
|
||||
<span>{$item['category_title'] ?? ''}</span>
|
||||
</div>
|
||||
<div class="box2 w-100">
|
||||
<span>{$item['title']}</span>
|
||||
<p>{$item['summary']}</p>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,2 @@
|
|||
{layout name="layout" /}
|
||||
新闻详情
|
|
@ -0,0 +1,2 @@
|
|||
{layout name="layout" /}
|
||||
新闻详情
|
|
@ -0,0 +1,3 @@
|
|||
{layout name="layout" /}
|
||||
|
||||
新闻列表
|
|
@ -49,7 +49,7 @@
|
|||
<div class="w-1500">
|
||||
<div class="pull-left column-between">
|
||||
<div class="all-title-box1 w-100"><span>{$blocks['marketing_name']['value'] ?? ''}</span><p>{$blocks['marketing_describe']['value'] ?? ''}</p></div>
|
||||
<a href="{:url('article/index', ['categoryId'=>$marketingCId])}">了解详情+</a>
|
||||
<a href="{:url('article/index', ['category_id'=>$marketingCId])}">了解详情++</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<div class="address wf100" aos="fade-up">
|
||||
|
||||
<a href="/">首页</a>
|
||||
{foreach $crumbs as $crumb}
|
||||
> <a href="{:getUri($crumb)}">{$crumb.title}</a>
|
||||
{/foreach}
|
||||
</div>
|
Loading…
Reference in New Issue