From bcaa6c2d2d5227c8955d2fd0ce0bb4e978f503fc Mon Sep 17 00:00:00 2001 From: "zhangf@suq.cn" Date: Wed, 2 Sep 2026 13:10:04 +0800 Subject: [PATCH] =?UTF-8?q?feat(category):=20=E6=B7=BB=E5=8A=A0=E5=AD=90?= =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E6=95=B0=E9=87=8F=E8=8E=B7=E5=8F=96=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=B9=B6=E4=BC=98=E5=8C=96=E4=B8=8B=E8=BD=BD=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 getCategoryChildrenCount 函数用于获取子栏目数量 - 更新下载页面静态资源路径为 /themes/dist_static/ - 将下载页面标题和描述改为动态获取当前分类信息 - 实现分类层级结构的动态渲染和子分类下拉菜单 - 添加条件判断处理无子分类的平级展示逻辑 - 集成 hcTaglib 子分类标签库实现动态分类展示 - 优化页面结构支持无限级分类的数据处理需求 --- app/common.php | 14 ++++++++++ public/themes/website/1/zh/demo/download.html | 39 +++++++++++++-------------- 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/app/common.php b/app/common.php index 0a6aee1..a8350f1 100644 --- a/app/common.php +++ b/app/common.php @@ -1600,3 +1600,17 @@ if (!function_exists('getMixContentBySolutionName')) { } } +if (!function_exists('getCategoryChildrenCount')) { + + /** + * 获取子栏目数量(支持无限级) + * @param int $id 栏目ID + * @param array $data 栏目数据(一维数组) + * @return int 子栏目数量 + */ + function getCategoryChildrenCount($id) + { + $categoryModel = new \app\model\Category(); + return $categoryModel->where('parent_id', $id)->count(); + } +} \ No newline at end of file diff --git a/public/themes/website/1/zh/demo/download.html b/public/themes/website/1/zh/demo/download.html index f225b49..8b7617e 100644 --- a/public/themes/website/1/zh/demo/download.html +++ b/public/themes/website/1/zh/demo/download.html @@ -43,48 +43,47 @@ integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous"> - - - - + + + + {include file="components/header"} -
-

下载中心

-

最新企业介绍及产品相关资料

+

{$current_cate.title}

+

{$current_cate.description}

-
+ {volist name="sub_cates" id="vo"} + {php} + $count = getCategoryChildrenCount($vo['id']); + {/php} + {if $count > 0}
+ {hcTaglib:subcategory pid="$vo.id" item="child" sort=""} + {/hcTaglib:subcategory}
- - - - + {else} + + {/if} + {/volist}