From 90b5d5b70032e2e3a8df3459f09313dba74fd80c Mon Sep 17 00:00:00 2001 From: yin5th <541304803@qq.com> Date: Tue, 11 Oct 2022 13:58:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=93=81=E7=89=8C=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/Article.php | 24 +++++++ app/model/Article.php | 2 +- app/model/Category.php | 2 + view/manager/article/add.html | 12 ++++ view/manager/article/edit.html | 11 ++++ view/manager/content/article.html | 7 ++ view/page/activity.html | 103 ++++++++++++++++++++++++++++++ 7 files changed, 160 insertions(+), 1 deletion(-) create mode 100755 view/page/activity.html diff --git a/app/controller/Article.php b/app/controller/Article.php index 9f1b025..7c9a380 100755 --- a/app/controller/Article.php +++ b/app/controller/Article.php @@ -158,5 +158,29 @@ class Article extends Base return $this->json(0, 'ok', $items); } + //文章列表接口,获取栏目下文章列表 + public function getList() + { + $categoryId = input('category_id/d', 0); + $page = input('page/d', 1); + $size = input('size/d', 10); + if ($categoryId <= 0) { + return $this->json(1, '参数错误'); + } + $category = Category::getById($categoryId); + if (empty($category)) { + return $this->json(2, '栏目不存在'); + } + + $items = MArticle::findListByWhere(["category_id" => $categoryId], $page, $size); + + foreach ($items as $item) { + $item['uri'] = archiveGetUri($item); + $item['create_date_d'] = date('d', $item['create_time']); + $item['create_date_y_m'] = date('Y-m', $item['create_time']); + } + + return $this->json(0, 'ok', $items); + } } \ No newline at end of file diff --git a/app/model/Article.php b/app/model/Article.php index 94063b5..2f57b27 100755 --- a/app/model/Article.php +++ b/app/model/Article.php @@ -192,7 +192,7 @@ class Article extends Base if (is_array($param) && count($param) > 0) { $pageParam['param'] = $param; foreach ($param as $vo) { - if (in_array($vo, ['top', 'hot', 'recommend'], true)) { + if (in_array($vo, ['top', 'hot', 'recommend', 'is_prev'], true)) { $whereMap[] = ["{$vo}", '=', 1]; } } diff --git a/app/model/Category.php b/app/model/Category.php index 5804d84..fff3459 100755 --- a/app/model/Category.php +++ b/app/model/Category.php @@ -20,6 +20,8 @@ class Category extends Base public const CATEGORY_COMPANY_EVENT = 37; // 企业荣誉 public const CATEGORY_COMPANY_HONOR = 38; + // 品牌活动 + public const CATEGORY_BRAND_ACTIVITY = 39; //关于我们 public const CATEGORY_COMPANY = 2; //物业服务 diff --git a/view/manager/article/add.html b/view/manager/article/add.html index 734fdd1..93a015d 100755 --- a/view/manager/article/add.html +++ b/view/manager/article/add.html @@ -192,6 +192,18 @@ + {if $category['id'] == 39} +
+ +
+ +
+
+ {/if} + {if !(in_array($category['id'],[37,38]))} {if !isset($allowContent) || $allowContent} diff --git a/view/manager/article/edit.html b/view/manager/article/edit.html index e994d80..afe0624 100755 --- a/view/manager/article/edit.html +++ b/view/manager/article/edit.html @@ -208,6 +208,17 @@ + {if $category['id'] == 39} +
+ +
+ +
+
+ {/if} {if !(in_array($category['id'],[37,38]))} {if !isset($allowContent) || $allowContent} diff --git a/view/manager/content/article.html b/view/manager/content/article.html index 9d78550..618382e 100755 --- a/view/manager/content/article.html +++ b/view/manager/content/article.html @@ -68,6 +68,7 @@ use app\model\Category as VCategory; {/if} + @@ -84,6 +85,9 @@ use app\model\Category as VCategory; 属性 {/if} 状态 + {if $category.id == 39} + 活动预告 + {/if} 操作 {foreach name="list" item="item"} @@ -111,6 +115,9 @@ use app\model\Category as VCategory; {$item.status ? '正常':'隐藏'} + {if $category.id == 39} + {$item.is_prev == 1 ? '是' : '否'} + {/if}
{if !empty($attributeList)} diff --git a/view/page/activity.html b/view/page/activity.html new file mode 100755 index 0000000..a270312 --- /dev/null +++ b/view/page/activity.html @@ -0,0 +1,103 @@ +{layout name="layout"/} +{php} +use app\model\Article; +use app\model\Category; +$childrenMenu = Category::getChildrenByParentId($topCategoryId); +$items = Article::getList(Category::CATEGORY_BRAND_ACTIVITY, $category['number'] ?? 4); +$previewList = Article::getList(Category::CATEGORY_BRAND_ACTIVITY, 10, null, ['is_prev']); +{/php} + +{include file="public/about_second" /} + + +
+
+
+

{$blocks['brand_activity']['value']}

+ {$blocks['brand_activity']['title']} +
+
+ {foreach $items as $item} + +
{$item.title}
+
+

{$item.title}

+

{$item.summary}

+ 查看详情查看详情 +
+
+ {/foreach} +
+
+ + +
点击加载更多
+
+ + +
+
+

{$blocks['event_preview']['value']}

+ {$blocks['event_preview']['title']} +
+
+
+
+ {foreach $previewList as $prev} + +
{$prev.title}
+
+

{$prev.title}

+

{$prev.summary}

+ 查看详情查看详情 + Events +
+
+ {/foreach} +
+ +
向前
+
向后
+
+
+
+ + \ No newline at end of file