diff --git a/app/controller/Article.php b/app/controller/Article.php index 3eaa26b..8ecaf54 100644 --- a/app/controller/Article.php +++ b/app/controller/Article.php @@ -49,4 +49,33 @@ class Article extends Base $this->data['categoryId'] = $categoryId; 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); + } } \ No newline at end of file diff --git a/app/controller/Index.php b/app/controller/Index.php index 8033217..d06e110 100644 --- a/app/controller/Index.php +++ b/app/controller/Index.php @@ -1,7 +1,7 @@ data['categoryId'] = $categoryId; $this->setSeo($this->system['seo_title'], $this->system['seo_keywords'], $this->system['seo_description']); - $this->data['blocks'] = Block::getByCategoryId($categoryId); + $blocks = Block::getByCategoryId($categoryId); + $blocks = Block::analysisBlock($blocks); + $this->data['blocks'] = $blocks; + // 网络营销栏目ID + $this->data['marketingCId'] = Category::$CIdList['marketing_network']; + // 关联产品中心 + $this->data['products'] = Article::getLatestByCategory(Category::$CIdList['products'], 4);; + // 关联企业新闻 + $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(); } } \ No newline at end of file diff --git a/app/controller/Page.php b/app/controller/Page.php index cfa0bb3..878e3b3 100644 --- a/app/controller/Page.php +++ b/app/controller/Page.php @@ -5,21 +5,41 @@ use app\model\{Category, Block}; class Page extends Base { - public function index($categoryId) + private function getPageCommonData($categoryId) { + $resp = true; $category = Category::getById($categoryId); if ($category) { $description = $category['description'] ? $category['description'] : $this->system['seo_description']; $this->setSeo($category['title'], $this->system['seo_keywords'], $description); } else { - return $this->error('错误页面'); + $resp = false; } $childCategory = Category::getChildrenByParentId($categoryId); - $this->data['categoryId'] = $categoryId; $this->data['category'] = $category; $this->data['childCategory'] = $childCategory; $this->data['blocks'] = Block::getByCategoryId($categoryId); - return $this->view($category['template_detail']); + return $resp; + } + + // 默认单页页面 + public function index($categoryId) + { + $resp = $this->getPageCommonData($categoryId); + if(!$resp) { + return $this->error('错误页面'); + } + return $this->view($this->data['category']['template_detail']); + } + + // 营销页面 + public function marketing($categoryId) + { + $resp = $this->getPageCommonData($categoryId); + if(!$resp) { + return $this->error('错误页面'); + } + return $this->view($this->data['category']['template_detail']); } } \ No newline at end of file diff --git a/app/model/Block.php b/app/model/Block.php index 3ae76ac..dc7b277 100644 --- a/app/model/Block.php +++ b/app/model/Block.php @@ -110,4 +110,19 @@ class Block extends Base } return $data; } + + // 解析单页块元素内容,把JSON化的内容转为数组格式 + public static function analysisBlock(array $items) + { + $arrayToJsonTypes = [4]; + if(count($items) > 0) { + foreach ($items as &$item) { + if(in_array($item['type'], $arrayToJsonTypes)) { + $item['value'] = empty($item['value']) ? [] : json_decode($item['value'], true); + } + } + unset($item); + } + return $items; + } } diff --git a/app/model/Category.php b/app/model/Category.php index 088524a..744aeaa 100644 --- a/app/model/Category.php +++ b/app/model/Category.php @@ -3,6 +3,14 @@ namespace app\model; class Category extends Base { + public static $CIdList = [ + 'marketing_network' => 16, // 网络营销 + 'products' => 2, // 产品中心 + 'news_enterprise' => 20, // 企业新闻 + 'news_industry' => 21, // 行业资讯 + 'news_dynamic' => 21, // 新闻动态 + ]; + //获取首页栏目ID public static function getIndex() { diff --git a/app/widget/Footer.php b/app/widget/Footer.php new file mode 100644 index 0000000..b4d14f2 --- /dev/null +++ b/app/widget/Footer.php @@ -0,0 +1,23 @@ + System::getSystem(), + 'footerMenus' => $menus, + ]; + return View::assign($data)->fetch('public/footer'); + } +} \ No newline at end of file diff --git a/app/widget/Menu.php b/app/widget/Menu.php index 6117e2a..5059535 100644 --- a/app/widget/Menu.php +++ b/app/widget/Menu.php @@ -8,9 +8,10 @@ class Menu { public function index($categoryId) { - $menus = Cache::get('rules'); + $menus = Cache::get('front_menus'); if(empty($menus)){ $menus = Category::getListForFrontMenu(); + Cache::set('front_menus', $menus, 3600 * 12); } $currentFirstId = 0; if (is_numeric($categoryId) && $categoryId > 0) { diff --git a/public/static/manager/css/ocms.css b/public/static/manager/css/ocms.css index 9ca8c59..c72f796 100644 --- a/public/static/manager/css/ocms.css +++ b/public/static/manager/css/ocms.css @@ -161,6 +161,8 @@ tr.table-lv2:nth-child(1){ border:none;} .layui-form-label{width: 90px; padding: 9px 0; text-align: left;} .layui-form-label em{ color: #f20000; font-size: 20px; font-weight: bold; font-style: normal; margin-left: 2px; height: 16px; line-height: 16px; display: inline-block;} .layui-input-block{margin-left: 90px;} +.form-w-120 .layui-form-label{width: 120px;} +.form-w-120 .layui-input-block{margin-left: 120px;} .search-form{display: inline-block} .search-form .layui-form-item{margin-bottom: 0} .search-form .layui-form-item .layui-inline{margin-bottom:0px;margin-right: 0px} diff --git a/route/app.php b/route/app.php index 86249aa..fca4837 100644 --- a/route/app.php +++ b/route/app.php @@ -12,4 +12,12 @@ use think\facade\Route; Route::get('article/:id', "article/detail"); Route::get('articles/:categoryId', "article/index"); -Route::get('page/:categoryId', "page/index"); \ No newline at end of file +Route::get('page/:categoryId', "page/index"); +// 新闻 +Route::get('news/detail/:newsId', "article/newsDetail"); +Route::get('news/:categoryId', "article/news"); +// 产品 +Route::get('product/detail/:productId', "article/productDetail"); +Route::get('product/:categoryId', "article/product"); +// 营销 +Route::get('marketing/:categoryId', "page/marketing"); \ No newline at end of file diff --git a/view/index/index.html b/view/index/index.html index 87f9209..f9f1de9 100644 --- a/view/index/index.html +++ b/view/index/index.html @@ -3,22 +3,18 @@ -
-
- -
-
-

- 四川超宇科技有限公司
- Sichuan Chaoyu
- Technology Co., Ltd. -

-

Copyright C2020蜀ICP备14003714号-1

-
-
-

电话/Tel: 028-8561 6928

-

邮箱/E-mail: 1825981925@qq.com

-

- 地址/Add:成都市双流区蛟龙工业港南河路318号
- No.318 Nanhe Road, Jiaolong Industrial Area
Shuangliu District, Chengdu ,Sichuan Province
-

-
-

微信二维码/Wechant

-
-
-
+ \ No newline at end of file diff --git a/view/manager/content/article.html b/view/manager/content/article.html index c074948..6f8b0a1 100644 --- a/view/manager/content/article.html +++ b/view/manager/content/article.html @@ -83,7 +83,7 @@ use app\service\Image as CImage; {$item.title} {$item.views} - {$item.create_time} + {$item.create_time|date='Y-m-d'} {$item.sort} {$item.top?'已置顶':''} {$item.hot?'已热门':''} {$item.recommend?'已推荐':''} diff --git a/view/manager/system/index.html b/view/manager/system/index.html index e0d3467..5301c58 100644 --- a/view/manager/system/index.html +++ b/view/manager/system/index.html @@ -8,20 +8,48 @@
-
+
公司信息
- +
- +
- +
- + +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+
@@ -33,7 +61,7 @@
- +
@@ -47,9 +75,9 @@
- +
- +
@@ -60,6 +88,12 @@ +
+ +
+ +
+
SEO信息
diff --git a/view/public/footer.html b/view/public/footer.html index 72b6ae8..32f1b98 100644 --- a/view/public/footer.html +++ b/view/public/footer.html @@ -1 +1,47 @@ -
{$system['statistics']??''}
\ No newline at end of file +
+
+
+
+
+ {if isset($footerMenus) && count($footerMenus) > 0} + {foreach footerMenus as $menu} + {php} + $aHref = 'javascript:;'; + if (!empty($menu['url'])) { + $aHref = $menu['url']; + } elseif ($menu['is_index']) { + $aHref = url('/'); + } elseif (!empty($menu['template_list'])) { + $aHref = url('/'.$menu['template_list'].'/'.$menu['id']); + } elseif (!empty($menu['template'])) { + $aHref = url('/'.$menu['template'].'/'.$menu['id']); + } + {/php} + {$menu['title']} + {/foreach} + {/if} +
+
+
+
+

+ {$system['company_name'] ?? ''}
+ {$system['company_name_en'] ?? ''}
+ {$system['company_type_en'] ?? ''} +

+

{$system['company_copyright'] ?? ''}{$system['company_copy'] ?? ''}

+
+
+

电话/Tel: {$system['company_tel'] ?? ''}

+

邮箱/E-mail: {$system['company_email'] ?? ''}

+

+ 地址/Add:{$system['company_addr'] ?? ''}
+ {$system['company_addr_detail_en'] ?? ''}
{$system['company_addr_en'] ?? ''}
+

+
+

微信二维码/Wechant

+
+
+
+ + \ No newline at end of file diff --git a/view/public/menu.html b/view/public/menu.html index d3d6752..895ad49 100644 --- a/view/public/menu.html +++ b/view/public/menu.html @@ -18,6 +18,8 @@ function getMenus($menus, $level = 1, $currentFirstId, $categoryId) { $aHref = $menu['url']; } elseif ($menu['is_index']) { $aHref = url('/'); + } elseif (!empty($menu['template_list'])) { + $aHref = url('/'.$menu['template_list'].'/'.$menu['id']); } elseif (!empty($menu['template'])) { $aHref = url('/'.$menu['template'].'/'.$menu['id']); }