diff --git a/app/common.php b/app/common.php index 6f965b1..29ba2fc 100644 --- a/app/common.php +++ b/app/common.php @@ -1695,3 +1695,39 @@ if (!function_exists('getChildCategoriesContent')) { } } } + +// 函数名:getDescriptionSeparate (查询表 hc_category 中的字段 description 根据这个字段拆分成数组返回) +// 传入 cate_id 和 separate_str, 注意为空的判断; +if (!function_exists('getDescriptionSeparate')) { + function getDescriptionSeparate($cate_id) + { + if (empty($cate_id)) { + return []; + } + + try { + $description = \think\facade\Db::table('hc_category') + ->where('id', $cate_id) + ->value('description'); + + if (empty($description)) { + return []; + } + + // 使用正则提取所有以 http:// 或 https:// 开头的链接 + // 匹配规则:以http(s)开头,直到遇到空白符或中文字符"分隔符"为止 + preg_match_all('/https?:\/\/[^\s分隔符]+/', $description, $matches); + + $result = $matches[0] ?? []; + + // 过滤空值并重新索引 + $result = array_filter($result, function ($value) { + return !empty(trim($value)); + }); + + return array_values($result); + } catch (\Exception $e) { + return []; + } + } +} diff --git a/public/themes/dist_static/static/css/common.css b/public/themes/dist_static/static/css/common.css index 8d090f7..d4789f4 100644 --- a/public/themes/dist_static/static/css/common.css +++ b/public/themes/dist_static/static/css/common.css @@ -1443,7 +1443,7 @@ body { display: flex; flex-direction: column; gap: 0.5rem; - padding: 5rem; + padding: 3rem 5rem; border-right: 1px solid rgba(46, 53, 58, 0.1); }.nav-mega__cat { display: flex; @@ -1484,19 +1484,19 @@ body { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 3.5625rem; - padding: 5rem; + padding: 3rem 5rem; padding-right: 3.5625rem; min-width: 0; }.nav-mega__panels { min-width: 0; }.nav-mega__promo-side { - padding-top: 6.875rem; + padding-top: 4.875rem; flex-shrink: 0; }.nav-mega__heading { display: inline-flex; align-items: center; gap: 1rem; - margin-bottom: 5rem; + margin-bottom: 3rem; color: var(--color-text); font-family: "MiSans VF", "PingFang SC", sans-serif; font-size: var(--font-24); @@ -1622,7 +1622,7 @@ body { }.nav-mega__links { display: flex; flex-direction: column; - gap: 1.5rem; + gap: 1rem; margin: 0; padding: 0; list-style: none; diff --git a/public/themes/dist_static/static/css/product.css b/public/themes/dist_static/static/css/product.css index 1133079..ffdc28d 100644 --- a/public/themes/dist_static/static/css/product.css +++ b/public/themes/dist_static/static/css/product.css @@ -245,8 +245,8 @@ body.is-p-subnav .site-header { } .p-intro__gallery img { width: auto; - max-width: 100%; - max-height: 100%; + max-width: 80%; + max-height: 80%; height: 100%; object-fit: contain; } @@ -560,8 +560,8 @@ body.is-p-subnav .site-header { max-height: 35rem; } .p-download__visual img { - width: 100%; - height: 100%; + width: 80%; + height: 80%; object-fit: contain; display: block; } diff --git a/public/themes/dist_static/static/js/common.js b/public/themes/dist_static/static/js/common.js index 59fd44b..5c9dd1d 100644 --- a/public/themes/dist_static/static/js/common.js +++ b/public/themes/dist_static/static/js/common.js @@ -103,10 +103,12 @@ $(function() { $(this).attr("aria-expanded", String(!isExpanded)); }); - // nav-mega 子组:标题 / 箭头均可展开收起 + // nav-mega 子组:标题 / 箭头均可展开收起(同组互斥) $(document).on("click", ".nav-mega__subgroup-title, .nav-mega__subgroup-toggle", function() { const $subgroup = $(this).closest(".nav-mega__subgroup"); + const $siblings = $subgroup.siblings(".nav-mega__subgroup"); const isExpanded = !$subgroup.hasClass("is-expanded"); + $siblings.removeClass("is-expanded").find(".nav-mega__subgroup-toggle").attr("aria-expanded", false); $subgroup.toggleClass("is-expanded", isExpanded); $subgroup.find(".nav-mega__subgroup-toggle").attr("aria-expanded", isExpanded); }); diff --git a/public/themes/website/1/zh/demo/components/header.html b/public/themes/website/1/zh/demo/components/header.html index 7a664a4..3ff37c0 100644 --- a/public/themes/website/1/zh/demo/components/header.html +++ b/public/themes/website/1/zh/demo/components/header.html @@ -62,7 +62,13 @@ 官方微信 - + {php} + $content_arr = getDescriptionSeparate(707); + $douyin_url = $content_arr['0'] ?? ''; + $sina_url = $content_arr['1'] ?? ''; + $zhihu_url = $content_arr['2'] ?? ''; + {/php} + - + - + 查看选型表
- RA3系列伺服驱动器 + {$thumbnail_name}