From b15058d5462ee8cca5daaf9547ce4498c964748c Mon Sep 17 00:00:00 2001 From: yin5th <541304803@qq.com> Date: Mon, 18 Nov 2024 19:40:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=96=B0=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/en/Article.php | 160 ++++++++++++ app/controller/en/Base.php | 52 ++++ app/controller/en/BaseController.php | 193 ++++++++++++++ app/controller/en/Error.php | 48 ++++ app/controller/en/Index.php | 36 +++ app/controller/en/Message.php | 42 ++++ app/controller/en/Page.php | 145 +++++++++++ view/article/news.html | 106 ++++---- view/article/news_center.html | 198 +++++++-------- view/article/news_detail.html | 70 +++--- view/article/product.html | 108 ++++---- view/article/products.html | 138 +++++----- view/index/index.html | 262 +++++++++---------- view/page/about.html | 362 +++++++++++++-------------- view/public/menu.html | 156 ++++++------ 15 files changed, 1376 insertions(+), 700 deletions(-) create mode 100755 app/controller/en/Article.php create mode 100755 app/controller/en/Base.php create mode 100755 app/controller/en/BaseController.php create mode 100755 app/controller/en/Error.php create mode 100755 app/controller/en/Index.php create mode 100755 app/controller/en/Message.php create mode 100755 app/controller/en/Page.php diff --git a/app/controller/en/Article.php b/app/controller/en/Article.php new file mode 100755 index 0000000..17435a4 --- /dev/null +++ b/app/controller/en/Article.php @@ -0,0 +1,160 @@ +error('错误页面'); + } + $category = Category::getById($categoryId); + if(empty($category)){ + return $this->error('错误页面'); + } + $description = $category['description'] ? $category['description'] : $this->system['seo_description']; + $this->setSeo($category['title'], $this->system['seo_keywords'], $description); + + $this->data['category'] = $category; + $this->data['categoryId'] = $categoryId; + $this->templateAssign($category); + return $this->view($category['template_list'] ?? ''); + } + + //详情 + public function detail($id=0) + { + if($id <= 0){ + return $this->error('错误页面'); + } + $article = MArticle::getById($id); + if(empty($article)){ + return $this->error('无此文章'); + } + MArticle::updateById($id, ['views' => $article['views'] + 1]); + $category = Category::getById($article['category_id']); + $keywords = $article['seo_keywords'] ? $article['seo_keywords'] : $this->system['seo_keywords']; + $description = $article['seo_description'] ? $article['seo_description'] : $this->system['seo_description']; + $this->setSeo($article['title'], $keywords, $description); + + $this->data['article'] = $article; + $this->data['category'] = $category; + $this->data['categoryId'] = $category['id']; + $this->templateDetailAssign($article, $category); + return $this->view($category['template_detail'] ?? ''); + } + + // 列表数据绑定 + private function templateAssign($category) + { + $template = strtolower($category['template_list'] ?? ''); + $TopCId = Category::firstGradeById($category['id']); + if($TopCId == $category['id']) { + $topCategory = $category; + } else { + $topCategory = Category::getById($TopCId); + } + $categoryChildren = Category::getChildrenByParentId($topCategory['id']); + $this->data['topCategory'] = $topCategory; + $this->data['categoryChildren'] = $categoryChildren; + switch($template) { + case 'products' : + $this->assignProducts($topCategory, $category, $categoryChildren); + break; + case 'news_center' : + case 'news' : + $this->assignNews($topCategory, $category, $categoryChildren); + break; + default : + $this->data['items'] = MArticle::getListPageByCategory($category['id'], $category['number'] ? $category['number'] : 20); + } + } + + // 详情数据绑定 + private function templateDetailAssign($article, $category) + { + $template = strtolower($category['template_detail'] ?? ''); + $TopCId = Category::firstGradeById($category['id']); + if($TopCId == $category['id']) { + $topCategory = $category; + } else { + $topCategory = Category::getById($TopCId); + } + $this->data['topCategory'] = $topCategory; + switch ($template) { + case 'product': + $this->assignDetailForProduct($article, $topCategory); + break; + default : + $this->data['prev'] = MArticle::getPrevArticleByIdAndCategories($article['id'], [$article['category_id']], true, $article['sort'], true); + $this->data['next'] = MArticle::getNextArticleByIdAndCategories($article['id'], [$article['category_id']], true, $article['sort'], true); + } + + } + + // 产品 - 展示当前分类和所有子类产品 + private function assignProducts($topCategory, $category, $categoryChildren) + { + $keyword = input('param.keyword', ''); + $cateIds[] = $category['id']; + if($topCategory['id'] == $category['id']) { + $children = $categoryChildren; + } else { + $children = Category::getChildrenByParentId($category['id']); + } + foreach ($children as $child) { + $cateIds[] = $child['id']; + } + $items = MArticle::getListPageByCategories($cateIds, $category['number'] ? $category['number'] : 20, $keyword); + $items->appends(['category_id'=>$category['id']]); + $this->data['items'] = $items; + $this->data['keyword'] = $keyword; + } + + // 新闻 + private function assignNews($topCategory, $category, $categoryChildren) + { + if($topCategory['id'] == $category['id']) { + // 新闻中心 + $cateList = []; + $newsChildrenFlip = array_flip(Category::$CIdList['news_children']); + foreach ($categoryChildren as $cate) { + $num = 3; + if($cate['id'] == Category::$CIdList['news_children']['dynamics']) { + $num = 4; + } + $cate['items'] = MArticle::getLatestByCategory($cate['id'], $num, 1); + $cateList[$newsChildrenFlip[$cate['id']]] = $cate; + } + $this->data['cateList'] = $cateList; + } else { + // 新闻子栏目 + $keyword = input('param.keyword', ''); + $this->data['items'] = MArticle::getListPageByCategory($category['id'], $category['number'] ? $category['number'] : 20, $keyword); + $this->data['keyword'] = $keyword; + } + } + + // 产品详情 + private function assignDetailForProduct($article, $topCategory) + { + $cateIds[] = $article['category_id']; + $currentCateId = input('param.source', 0); + $categoryList = Category::getChildrenByParentId($topCategory['id']); + if($currentCateId == $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; + } + + +} \ No newline at end of file diff --git a/app/controller/en/Base.php b/app/controller/en/Base.php new file mode 100755 index 0000000..630b76c --- /dev/null +++ b/app/controller/en/Base.php @@ -0,0 +1,52 @@ +middleware = ['csrf']; + $this->system = System::getSystem(); + $this->data['system'] = $this->system; + $this->setCsrfToken(); + } + + //设置SEO信息 + protected function setSeo($title, $keywords, $description) + { + $this->data['seoTitle'] = $title; + $this->data['seoKeywords'] = $keywords; + $this->data['seoDescription'] = $description; + } + + //设置默认SEO信息 + protected function setDefaultSeo() + { + $this->data['seoTitle'] = $this->system['seo_title']; + $this->data['seoKeywords'] = $this->system['seo_keywords']; + $this->data['seoDescription'] = $this->system['seo_description']; + } + + //模板 + protected function view($template = '') + { + return view($template)->assign($this->data); + } + + protected function setCsrfToken() + { + $this->data['_token'] = session('_token') ?? ''; + } +} diff --git a/app/controller/en/BaseController.php b/app/controller/en/BaseController.php new file mode 100755 index 0000000..8163ec7 --- /dev/null +++ b/app/controller/en/BaseController.php @@ -0,0 +1,193 @@ +app = $app; + $this->request = $this->app->request; + + // 控制器初始化 + $this->initialize(); + } + + // 初始化 + protected function initialize() + { + } + + /** + * 验证数据 + * @access protected + * @param array $data 数据 + * @param string|array $validate 验证器名或者验证规则数组 + * @param array $message 提示信息 + * @param bool $batch 是否批量验证 + * @return array|string|true + * @throws ValidateException + */ + protected function validate(array $data, $validate, array $message = [], bool $batch = false) + { + if (is_array($validate)) { + $v = new Validate(); + $v->rule($validate); + } else { + if (strpos($validate, '.')) { + // 支持场景 + list($validate, $scene) = explode('.', $validate); + } + $class = false !== strpos($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate); + $v = new $class(); + if (!empty($scene)) { + $v->scene($scene); + } + } + + $v->message($message); + + // 是否批量验证 + if ($batch || $this->batchValidate) { + $v->batch(true); + } + + return $v->failException(true)->check($data); + } + + /** + * 操作成功跳转的快捷方法 + * @access protected + * @param mixed $msg 提示信息 + * @param string $url 跳转的URL地址 + * @param mixed $data 返回的数据 + * @param integer $wait 跳转等待时间 + * @param array $header 发送的Header信息 + * @return void + */ + protected function success($msg = '', string $url = null, $data = '', int $wait = 3, array $header = []) + { + if (is_null($url) && isset($_SERVER["HTTP_REFERER"])) { + $url = $_SERVER["HTTP_REFERER"]; + } elseif ($url) { + $url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : $this->app->route->buildUrl($url); + } + + $result = [ + 'code' => 1, + 'msg' => $msg, + 'data' => $data, + 'url' => $url, + 'wait' => $wait, + ]; + return $this->redirect(url('error/jump',$result)); + } + + /** + * 操作错误跳转的快捷方法 + * @access protected + * @param mixed $msg 提示信息 + * @param string $url 跳转的URL地址 + * @param mixed $data 返回的数据 + * @param integer $wait 跳转等待时间 + * @param array $header 发送的Header信息 + * @return void + */ + protected function error($msg = '', string $url = null, $data = '', int $wait = 3) + { + if (is_null($url)) { + $referer = $_SERVER['HTTP_REFERER'] ?? null; + if (empty($referer)) { + $url = $this->request->isAjax() ? '' : '/'; + } else { + $url = $this->request->isAjax() ? '' : 'javascript:history.back(-1);'; + } + } elseif ($url) { + $url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : $this->app->route->buildUrl($url); + } + $result = [ + 'code' => 0, + 'msg' => $msg, + 'data' => $data, + 'url' => $url, + 'wait' => $wait, + ]; + + return $this->redirect(url('error/jump', $result)); + } + + /** + * 返回封装后的API数据到客户端 + * 以json格式抛出异常 + * @access protected + * @param mixed $data 要返回的数据 + * @param integer $code 返回的code + * @param mixed $msg 提示信息 + * @param string $type 返回数据格式 + * @param array $header 发送的Header信息 + * @return void + */ + protected function json($code = 0, $msg = 'ok', $data= []) + { + $result = [ + 'code' => $code, + 'msg' => $msg, + 'time' => time(), + 'data' => $data + ]; + return json($result); + } + + /** + * URL重定向 + * @access protected + * @param string $url 跳转的URL表达式 + * @param array|integer $params 其它URL参数 + * @param integer $code http code + * @param array $with 隐式传参 + * @return void + */ + protected function redirect($url) + { + if(!is_string($url)){ + $url = $url->__toString(); + } + return redirect($url); + } +} \ No newline at end of file diff --git a/app/controller/en/Error.php b/app/controller/en/Error.php new file mode 100755 index 0000000..efd36aa --- /dev/null +++ b/app/controller/en/Error.php @@ -0,0 +1,48 @@ +isAjax()) { + return $this->json(404, 'error request!'); + } else { + $referer = $_SERVER['HTTP_REFERER'] ?? null; + if (empty($referer)) { + $url = '/'; + } else { + $domain = $this->request->domain(); + $urlInfo = parse_url($referer); + $scheme = $urlInfo['scheme'] ?? ''; + $requestSrc = ''; + if (!empty($scheme)) { + $requestSrc = $scheme.'://'.($urlInfo['host'] ?? ''); + } + if($domain != $requestSrc) { + $url = '/'; + } else { + $url = 'javascript:history.back(-1);'; + } + } + $result = [ + 'code' => 404, + 'msg' => 'Invalid request! No related resources found.', + 'data' => [], + 'url' => $url, + 'wait' => 5, + ]; + return view('error/400')->assign($result); + } + } + + + public function jump() + { + $param = request()->param(); + return view()->assign($param); + } +} \ No newline at end of file diff --git a/app/controller/en/Index.php b/app/controller/en/Index.php new file mode 100755 index 0000000..2ee4e15 --- /dev/null +++ b/app/controller/en/Index.php @@ -0,0 +1,36 @@ +data['categoryId'] = $categoryId; + $this->setSeo($this->system['seo_title'], $this->system['seo_keywords'], $this->system['seo_description']); + $blocks = Block::getByCategoryId($categoryId); + $blocks = Block::analysisBlock($blocks); + $this->data['blocks'] = $blocks; + // 轮播图 + $this->data['slides'] = Slide::getList(); + // 营销网络栏目ID + $this->data['marketingCId'] = Category::$CIdList['marketing']; + // 关联产品分类 + $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']]; + $newsList = Category::getListByIds($newsCIdList); + foreach ($newsList as &$cate) { + $cate['items'] = Article::getLatestByCategory($cate['id'], 4, 1); + } + unset($cate); + $this->data['newsList'] = $newsList; + return $this->view(); + } +} \ No newline at end of file diff --git a/app/controller/en/Message.php b/app/controller/en/Message.php new file mode 100755 index 0000000..de66a50 --- /dev/null +++ b/app/controller/en/Message.php @@ -0,0 +1,42 @@ +isPost()) { + $msgData = [ + 'company_name' => trim(input('post.company_name', '')), + 'name' => trim(input('post.name', '')), + 'phone' => trim(input('post.phone', '')), + 'email' => trim(input('post.email', '')), + 'content' => trim(input('post.content', '')), + ]; + // 安全过滤 + $msgData = array_map('strip_tags', $msgData); + try { + validate(VMessage::class)->check($msgData); + $msgData['ip'] = request()->ip(); + $msgData['create_time'] = time(); + MMessage::create($msgData); + return $this->json(); + } catch (ValidateException $e) { + return $this->json(2, $e->getError()); + } + } else { + return $this->json(1, '非法请求'); + } + } +} + diff --git a/app/controller/en/Page.php b/app/controller/en/Page.php new file mode 100755 index 0000000..bb23e44 --- /dev/null +++ b/app/controller/en/Page.php @@ -0,0 +1,145 @@ +system['seo_description']; + $this->setSeo($category['title'], $this->system['seo_keywords'], $description); + } else { + return $this->error('页面错误'); + } + + $this->data['categoryId'] = $categoryId; + $this->data['category'] = $category; + $this->data['blocks'] = Block::getByCategoryId($categoryId); + $this->templateDetailAssign($category); + + return $this->view($category['template_detail']); + } + + private function templateDetailAssign($category) + { + $template = $category['template_detail'] ?? ''; + $TopCId = Category::firstGradeById($category['id']); + if($TopCId == $category['id']) { + $topCategory = $category; + } else { + $topCategory = Category::getById($TopCId); + } + $childCategory = Category::getChildrenByParentId($topCategory['id']); + + $this->data['topCategory'] = $topCategory; + $this->data['childCategory'] = $childCategory; + switch ($template) { + case 'about' : + $this->assignAbout($childCategory); + break; + case 'service' : + $this->assignService($childCategory); + break; + case 'marketing' : + $this->assignMarketing($childCategory); + break; + case 'contact' : + $this->assignContact($childCategory); + break; + default : + $this->data['blocks'] = Block::getByCategoryId($category['id']); + } + } + + // 获取单页栏目IDs + private function getBlockCateIds($categoryItems) + { + $blockCateIds = []; + foreach ($categoryItems as $cate) { + if($cate['model_id'] == Model::PAGE) { + $blockCateIds[] = $cate['id']; + } + } + return $blockCateIds; + } + + // 走进超宇 + private function assignAbout($childCategory) + { + $honorTopCId = Category::$CIdList['honors_manage'] ?? 0; + $historyCId = Category::$CIdList['history_manage'] ?? 0; + $historyCate = Category::getById($historyCId); + $honors = []; + $blocks = []; + $blockCateIds = $this->getBlockCateIds($childCategory); + if($honorTopCId) { + $honors = Category::getChildrenByParentId($honorTopCId); + foreach ($honors as &$honor) { + $honor['items'] = Article::getListByCategoryIds([$honor['id']], $honor['number'] ? $honor['number'] : 20, '', [], 1); + } + unset($honor); + } + $blockList = Block::getByCategoryIds($blockCateIds); + $aboutChildrenFlip = array_flip(Category::$CIdList['about_children']); + foreach ($childCategory as $cate) { + $blocks[$aboutChildrenFlip[$cate['id']]] = $blockList[$cate['id']] ?? []; + } + + $this->data['blocks'] = $blocks; + $this->data['honors'] = $honors; + $this->data['historyList'] = array_reverse(History::getByCategoryId($historyCId, true, $historyCate['number'] ?? -1)); + } + + // 品质与服务 + private function assignService($childCategory) + { + $blocks = []; + $blockCateIds = $this->getBlockCateIds($childCategory); + $blockList = Block::getByCategoryIds($blockCateIds); + $serviceChildrenFlip = array_flip(Category::$CIdList['service_children']); + foreach ($childCategory as $cate) { + $blocks[$serviceChildrenFlip[$cate['id']]] = $blockList[$cate['id']] ?? []; + } + + $this->data['blocks'] = $blocks; + } + + // 营销网络 + private function assignMarketing($childCategory) + { + $blocks = []; + $blockCateIds = $this->getBlockCateIds($childCategory); + $blockList = Block::getByCategoryIds($blockCateIds); + $marketingChildrenFlip = array_flip(Category::$CIdList['marketing_children']); + foreach ($childCategory as $cate) { + $blocks[$marketingChildrenFlip[$cate['id']]] = $blockList[$cate['id']] ?? []; + } + $achievementCate = Category::getById(Category::$CIdList['achievement_manage']); + $achievementList = []; + if ($achievementCate) { + $achievementList = Achievement::getListByCategoryId($achievementCate['id'], $achievementCate['number'] ? $achievementCate['number'] : 10, true); + } + $this->data['blocks'] = $blocks; + $this->data['achievementList'] = $achievementList; + } + + // 联系我们 + private function assignContact($childCategory) + { + $blocks = []; + $blockCateIds = $this->getBlockCateIds($childCategory); + $blockList = Block::getByCategoryIds($blockCateIds); + $contactChildrenFlip = array_flip(Category::$CIdList['contact_children']); + foreach ($childCategory as $cate) { + $blocks[$contactChildrenFlip[$cate['id']]] = $blockList[$cate['id']] ?? []; + } + $jobsCate = Category::getById(Category::$CIdList['jobs_manage']); + $jobList = Article::getLatestByCategory($jobsCate['id'], $jobsCate['number'] ? $jobsCate['number'] : 10, 1); + $this->data['blocks'] = $blocks; + $this->data['jobList'] = $jobList; + } +} \ No newline at end of file diff --git a/view/article/news.html b/view/article/news.html index 22c7bc5..20659c2 100755 --- a/view/article/news.html +++ b/view/article/news.html @@ -1,54 +1,54 @@ -{layout name="layout" /} - - -
-
-
- {$category.title ?? ''} -

{:nl2br($category.description ?? '')}

-
-
-
- -
-
- -
- {if isset($items)} - -
- {$items->render()|raw} -
-
- {$items->render(5)|raw} -
- {/if} -
-
+{layout name="layout" /} + + +
+
+
+ {$category.title ?? ''} +

{:nl2br($category.description ?? '')}

+
+
+
+ +
+
+ +
+ {if isset($items)} + +
+ {$items->render()|raw} +
+
+ {$items->render(5)|raw} +
+ {/if} +
+
\ No newline at end of file diff --git a/view/article/news_center.html b/view/article/news_center.html index c94371b..f6c7a5a 100755 --- a/view/article/news_center.html +++ b/view/article/news_center.html @@ -1,99 +1,99 @@ -{layout name="layout"} - - -
-
-
- {$topCategory.title ?? ''} -

{:nl2br($topCategory.description ?? '')}

-
-
-
- -
- - {if isset($cateList['enterprise']) && !empty($cateList['enterprise'])} -
-
-
{$cateList['enterprise']['title'] ?? ''}

{$cateList['enterprise']['description'] ?? ''}

-
- -
- -
-
- {/if} - - {if isset($cateList['industry']) && !empty($cateList['industry'])} -
-
-
{$cateList['industry']['title'] ?? ''}

{$cateList['industry']['description'] ?? ''}

-
- -
- -
-
- {/if} - - {if isset($cateList['dynamics']) && !empty($cateList['dynamics'])} -
-
-
-
{$cateList['dynamics']['title'] ?? ''}

{$cateList['dynamics']['description'] ?? ''}

-
- -
-
- -
-
- {/if} -
+{layout name="layout"} + + +
+
+
+ {$topCategory.title ?? ''} +

{:nl2br($topCategory.description ?? '')}

+
+
+
+ +
+ + {if isset($cateList['enterprise']) && !empty($cateList['enterprise'])} +
+
+
{$cateList['enterprise']['title'] ?? ''}

{$cateList['enterprise']['description'] ?? ''}

+
+ +
+ +
+
+ {/if} + + {if isset($cateList['industry']) && !empty($cateList['industry'])} +
+
+
{$cateList['industry']['title'] ?? ''}

{$cateList['industry']['description'] ?? ''}

+
+ +
+ +
+
+ {/if} + + {if isset($cateList['dynamics']) && !empty($cateList['dynamics'])} +
+
+
+
{$cateList['dynamics']['title'] ?? ''}

{$cateList['dynamics']['description'] ?? ''}

+
+ +
+
+ +
+
+ {/if} +
diff --git a/view/article/news_detail.html b/view/article/news_detail.html index c0f7a1f..7bad2dc 100755 --- a/view/article/news_detail.html +++ b/view/article/news_detail.html @@ -1,36 +1,36 @@ -{layout name="layout" /} -
-
-
- {$category.title ?? ''} -

{:nl2br($category.description ?? '')}

-
-
-
- - -
-
-
-
- {$article.title} -

{$article.create_time|date="Y/m/d"}

-
-
- {:nl2br($article.content)} -
-
-

- {if isset($prev) && count($prev) >0} - 上一篇 - {/if} - {if (isset($prev) && count($prev) >0) && (isset($next) && count($next) >0)} / {/if} - {if isset($next) && count($next) >0} - 下一篇 - {/if} -

- 返回 -
-
-
+{layout name="layout" /} +
+
+
+ {$category.title ?? ''} +

{:nl2br($category.description ?? '')}

+
+
+
+ + +
+
+
+
+ {$article.title} +

{$article.create_time|date="Y/m/d"}

+
+
+ {:nl2br($article.content)} +
+
+

+ {if isset($prev) && count($prev) >0} + 上一篇 + {/if} + {if (isset($prev) && count($prev) >0) && (isset($next) && count($next) >0)} / {/if} + {if isset($next) && count($next) >0} + 下一篇 + {/if} +

+ 返回 +
+
+
\ No newline at end of file diff --git a/view/article/product.html b/view/article/product.html index a5f274c..f1766ce 100755 --- a/view/article/product.html +++ b/view/article/product.html @@ -1,55 +1,55 @@ -{layout name="layout" /} - - -
-
-
- {$topCategory.title ?? ''} -

{:nl2br($topCategory.description ?? '')}

-
-
-
- - -
-
-
- {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} - - {/foreach} - {/if} -
-
-
- {$article.title} -

{$article.create_time|date="Y/m/d"}

-
-
- {:nl2br($article.content)} -
-
-

- {if isset($prev) && count($prev) >0} - 上一篇 - {/if} - {if (isset($prev) && count($prev) >0) && (isset($next) && count($next) >0)}/{/if} - {if isset($next) && count($next) >0} - 下一篇 - {/if} -

- 返回 -
-
-
+{layout name="layout" /} + + +
+
+
+ {$topCategory.title ?? ''} +

{:nl2br($topCategory.description ?? '')}

+
+
+
+ + +
+
+
+ {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} + + {/foreach} + {/if} +
+
+
+ {$article.title} +

{$article.create_time|date="Y/m/d"}

+
+
+ {:nl2br($article.content)} +
+
+

+ {if isset($prev) && count($prev) >0} + 上一篇 + {/if} + {if (isset($prev) && count($prev) >0) && (isset($next) && count($next) >0)}/{/if} + {if isset($next) && count($next) >0} + 下一篇 + {/if} +

+ 返回 +
+
+
\ No newline at end of file diff --git a/view/article/products.html b/view/article/products.html index 51e3691..0123e4e 100755 --- a/view/article/products.html +++ b/view/article/products.html @@ -1,70 +1,70 @@ -{layout name="layout" /} - - -
-
-
- {$category.title ?? ''} -

{:nl2br($category.description ?? '')}

-
-
-
- -
-
- -
- {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} - - {/foreach} - {/if} -
-
- {if isset($items)} -
- -
-
- {$items->render()|raw} -
-
- {$items->render(5)|raw} -
- {/if} -
-
+{layout name="layout" /} + + +
+
+
+ {$category.title ?? ''} +

{:nl2br($category.description ?? '')}

+
+
+
+ +
+
+ +
+ {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} + + {/foreach} + {/if} +
+
+ {if isset($items)} +
+ +
+
+ {$items->render()|raw} +
+
+ {$items->render(5)|raw} +
+ {/if} +
+
\ No newline at end of file diff --git a/view/index/index.html b/view/index/index.html index e86402e..d0eef31 100755 --- a/view/index/index.html +++ b/view/index/index.html @@ -1,132 +1,132 @@ -{layout name="layout" /} - - - - -
- -
-
-
{$productsCenter['title'] ?? '产品中心'} -

{$productsCenter['description'] ?? 'product center'}

-
- {if isset($products) && count($products) > 0} -
    - {foreach $products as $idx => $product} -
  • -
    -
    - {$product['title']} -

    {$product['description']}

    -
    -
    - 了解详情+ - {:str_pad($idx + 1, 2, '0', STR_PAD_LEFT)} -
    -
    -
  • - {/foreach} -
- {/if} -
-
-
- -
-
-
-
{$blocks['marketing_name']['value'] ?? ''} -

{:nl2br($blocks['marketing_describe']['value'] ?? '')}

- {php} - $marketingLink = url('page/index', ['category_id'=>$marketingCId]); - if(isset($blocks['marketing_background']['link']) && !empty($blocks['marketing_background']['link'])) { - $marketingLink = $blocks['marketing_background']['link']; - } - {/php} - 了解详情++ -
-
-
- -
-
-
{$newsCenter['title'] ?? '新闻动态'}{$newsCenter['description'] ?? ''}
-
- {if isset($newsList) && count($newsList) > 0} - {foreach $newsList as $newsCate} - - {/foreach} - {/if} -
-
-
-
- - - \ No newline at end of file diff --git a/view/page/about.html b/view/page/about.html index 6182440..e7ee730 100755 --- a/view/page/about.html +++ b/view/page/about.html @@ -1,182 +1,182 @@ -{layout name="layout"} - -
-
-
- {$topCategory.title} -

{:nl2br($topCategory.description ?? '')}

-
-
-
- -
-
-
-
-
-
{$blocks['company']['title']['value'] ?? ''}

{$blocks['company']['subtitle']['value'] ?? ''}

-
{:nl2br($blocks['company']['description']['value'] ?? '')}
-
-
-
- - -
-
-
-
{$blocks['honor']['title']['value'] ?? ''}

{$blocks['honor']['subtitle']['value'] ?? ''}

-
- {if isset($honors) && count($honors) > 0} - {foreach $honors as $k => $honor} - {$honor.title} - {/foreach} - {/if} -
-
- {if isset($honors) && count($honors) > 0} - {foreach $honors as $k => $honor} -
-
-
-
    - {foreach $honor.items as $item} -
  • - {/foreach} -
-
-
-
    - {foreach $honor.items as $item} -
  • {$item.title}
  • - {/foreach} -
-
-
-
-
-
- {foreach $honor.items as $item} -

{$item.title}

- {/foreach} -
-
-
-
- {/foreach} - {/if} -
-
-
-
- - -
-
- - -
-
-
-
{$blocks['structure']['title']['value'] ?? ''}

{$blocks['structure']['subtitle']['value'] ?? ''}

-
- -
-
-
-
- - -
-
-
{$blocks['history']['title']['value'] ?? ''}

{$blocks['history']['subtitle']['value'] ?? ''}

-
-
-
- {if isset($historyList) && count($historyList) > 0} - {foreach $historyList as $history} -

{$history.title}  /  年

- {/foreach} - {/if} -
-
-
-
- {if isset($historyList) && count($historyList) > 0} - {foreach $historyList as $history} -
- {foreach $history['info'] as $k => $info} -

{if $k > 0}


{/if}{:nl2br($info['title'] ?? '')}

- {/foreach} -
- {/foreach} - {/if} -
-
-
-
- 点击前后翻看 -
-
-
-
-
-
- - -
-
-
-
- - + +
+
+
+
{$blocks['structure']['title']['value'] ?? ''}

{$blocks['structure']['subtitle']['value'] ?? ''}

+
+ +
+
+
+
+ + +
+
+
{$blocks['history']['title']['value'] ?? ''}

{$blocks['history']['subtitle']['value'] ?? ''}

+
+
+
+ {if isset($historyList) && count($historyList) > 0} + {foreach $historyList as $history} +

{$history.title}  /  年

+ {/foreach} + {/if} +
+
+
+
+ {if isset($historyList) && count($historyList) > 0} + {foreach $historyList as $history} +
+ {foreach $history['info'] as $k => $info} +

{if $k > 0}


{/if}{:nl2br($info['title'] ?? '')}

+ {/foreach} +
+ {/foreach} + {/if} +
+
+
+
+ 点击前后翻看 +
+
+
+
+
+
+ + +
+
+
+
+ + \ No newline at end of file diff --git a/view/public/menu.html b/view/public/menu.html index e1220f7..cc38295 100755 --- a/view/public/menu.html +++ b/view/public/menu.html @@ -1,79 +1,79 @@ -{php} -//dump($menus); -function getMenus($menus, $level = 1, $currentFirstId, $categoryId) { - $menuHtml = ''; - $levelList = ['nav-first','nav-second','nav-third']; - $navClass = $levelList[$level - 1] ?? ''; - if (count($menus) > 0) { - $menuHtml .= ''; - if($level > 1) { - $menuHtml .= '
'; - } - - - foreach ($menus as $menu) { - $activeClass = ''; - if ($currentFirstId == $menu['id'] || $categoryId == $menu['id'] || ($currentFirstId == 0 && $menu['is_index'])) { - $activeClass = ' active'; - } - $aHref = getUri($menu); - $aHref = empty($aHref) ? 'javascript:;' : $aHref; - $spanClass = ''; - $hasChild = false; - if (isset($menu['children']) && count($menu['children']) > 0) { - $hasChild = true; - $spanClass = 'class="cur"'; - } - if($level == 1) { - $menuHtml .= '
  • '; - $menuHtml .= ''.$menu['title'].''; - if ($hasChild) { - $menuHtml .= getMenus($menu['children'], $level + 1, $currentFirstId, $categoryId); - } - $menuHtml .= '
  • '; - } else { - if($menu['template_list']=='products'){ - $menuHtml .= ''; - }else if($menu['template_list']=='news'){ - $menuHtml .= ''; - }else - { - $menuHtml .= ''; - } - $menuHtml .= ''.$menu['title'].''; - if ($hasChild) { - $menuHtml .= getMenus($menu['children'], $level + 1, $currentFirstId, $categoryId); - } - $menuHtml .= ''; - } - } - if($level > 1) { - $menuHtml .= '
    '; - } - } - return $menuHtml; -} -{/php} - -
    -
    -
    - - - - -
    -
    +{php} +//dump($menus); +function getMenus($menus, $level = 1, $currentFirstId, $categoryId) { + $menuHtml = ''; + $levelList = ['nav-first','nav-second','nav-third']; + $navClass = $levelList[$level - 1] ?? ''; + if (count($menus) > 0) { + $menuHtml .= ''; + if($level > 1) { + $menuHtml .= '
    '; + } + + + foreach ($menus as $menu) { + $activeClass = ''; + if ($currentFirstId == $menu['id'] || $categoryId == $menu['id'] || ($currentFirstId == 0 && $menu['is_index'])) { + $activeClass = ' active'; + } + $aHref = getUri($menu); + $aHref = empty($aHref) ? 'javascript:;' : $aHref; + $spanClass = ''; + $hasChild = false; + if (isset($menu['children']) && count($menu['children']) > 0) { + $hasChild = true; + $spanClass = 'class="cur"'; + } + if($level == 1) { + $menuHtml .= '
  • '; + $menuHtml .= ''.$menu['title'].''; + if ($hasChild) { + $menuHtml .= getMenus($menu['children'], $level + 1, $currentFirstId, $categoryId); + } + $menuHtml .= '
  • '; + } else { + if($menu['template_list']=='products'){ + $menuHtml .= ''; + }else if($menu['template_list']=='news'){ + $menuHtml .= ''; + }else + { + $menuHtml .= ''; + } + $menuHtml .= ''.$menu['title'].''; + if ($hasChild) { + $menuHtml .= getMenus($menu['children'], $level + 1, $currentFirstId, $categoryId); + } + $menuHtml .= ''; + } + } + if($level > 1) { + $menuHtml .= '
    '; + } + } + return $menuHtml; +} +{/php} + +
    +
    +
    + + + + +
    +
    \ No newline at end of file