diff --git a/public/themes/dist_static/static/js/announce.js b/public/themes/dist_static/static/js/announce.js index 721cca9..412951b 100644 --- a/public/themes/dist_static/static/js/announce.js +++ b/public/themes/dist_static/static/js/announce.js @@ -41,6 +41,13 @@ function initFilterDropdown() { $btn.addClass("is-selected"); } closeDropdown(); + const params = new URLSearchParams(); + const keywords = $("[data-tab-search] [name='keywords']").val().trim(); + const tabId = $item.attr("data-tab") || ""; + if (tabId) params.set("cid", tabId); + if (keywords) params.set("keywords", keywords); + const query = params.toString(); + window.location.href = query ? `${window.location.pathname}?${query}` : window.location.pathname; }); $(document).on("click", function(event) { if (!$(event.target).closest("[data-filter-trigger], [data-filter-dropdown]").length) closeDropdown(); diff --git a/public/themes/dist_static/static/js/download.js b/public/themes/dist_static/static/js/download.js index 45b46eb..539c2e7 100644 --- a/public/themes/dist_static/static/js/download.js +++ b/public/themes/dist_static/static/js/download.js @@ -36,6 +36,12 @@ $(function() { const query = params.toString(); return query ? `${window.location.pathname}?${query}` : window.location.pathname; }; + const runSearch = (tabId = getActiveTabId()) => { + window.location.href = buildQueryUrl({ + tabId, + keywords: getKeywords() + }); + }; const activateTabById = (tabId) => { if (!tabId) return; const $dropdownItem = $(`.d-tabs__dropdown-item[data-tab="${tabId}"]`).first(); @@ -55,6 +61,7 @@ $(function() { $(".d-tabs__dropdown-item").removeClass("is-active"); activateTab($(this)); closeDropdowns(); + runSearch($(this).attr("data-tab") || ""); }); $("[data-dropdown-trigger]").on("click", function() { const $btn = $(this); @@ -74,16 +81,14 @@ $(function() { $trigger.find("span").text($item.text()); activateTab($trigger); closeDropdowns(); + runSearch($item.attr("data-tab") || ""); }); $(document).on("click", function(event) { if (!$(event.target).closest(".d-tabs__group").length) closeDropdowns(); }); $("[data-tab-search]").on("submit", function(event) { event.preventDefault(); - window.location.href = buildQueryUrl({ - tabId: getActiveTabId(), - keywords: $(this).find('[name="keywords"]').val().trim() - }); + runSearch(); }); const searchParams = new URLSearchParams(window.location.search); const tabParam = searchParams.get("cid"); diff --git a/public/themes/dist_static/static/js/faq.js b/public/themes/dist_static/static/js/faq.js index ac2d890..3ce160d 100644 --- a/public/themes/dist_static/static/js/faq.js +++ b/public/themes/dist_static/static/js/faq.js @@ -22,15 +22,21 @@ function activateTabById(tabId) { if ($target.length) activateFaqTab($target); } function initTabKeywordsSearch() { - $("[data-tab-search]").on("submit", function(event) { - event.preventDefault(); + const runSearch = (tabId = getActiveTabId()) => { const params = new URLSearchParams(); - const keywords = $(this).find('[name="keywords"]').val().trim(); - const tabId = getActiveTabId(); + const keywords = $("[data-tab-search] [name='keywords']").val().trim(); if (tabId) params.set("cid", tabId); if (keywords) params.set("keywords", keywords); const query = params.toString(); window.location.href = query ? `${window.location.pathname}?${query}` : window.location.pathname; + }; + $("[data-tab-search]").on("submit", function(event) { + event.preventDefault(); + runSearch(); + }); + $(".f-tabs__item").on("click", function() { + activateFaqTab($(this)); + runSearch($(this).attr("data-tab") || ""); }); const searchParams = new URLSearchParams(window.location.search); const tabParam = searchParams.get("cid"); @@ -40,9 +46,6 @@ function initTabKeywordsSearch() { } $(function() { setActiveNav(); - $(".f-tabs__item").on("click", function() { - activateFaqTab($(this)); - }); $(".f-item__trigger").on("click", function() { const $item = $(this).closest(".f-item"); const willOpen = !$item.hasClass("is-open"); diff --git a/public/themes/dist_static/static/js/video.js b/public/themes/dist_static/static/js/video.js index 866a544..bab372d 100644 --- a/public/themes/dist_static/static/js/video.js +++ b/public/themes/dist_static/static/js/video.js @@ -82,6 +82,13 @@ function initFilterDropdown() { $btn.addClass("is-selected"); } closeDropdown(); + const params = new URLSearchParams(); + const keywords = $("[data-tab-search] [name='keywords']").val().trim(); + const tabId = $item.attr("data-tab") || ""; + if (tabId) params.set("cid", tabId); + if (keywords) params.set("keywords", keywords); + const query = params.toString(); + window.location.href = query ? `${window.location.pathname}?${query}` : window.location.pathname; }); $(document).on("click", function(event) { if (!$(event.target).closest("[data-filter-trigger], [data-filter-dropdown]").length) closeDropdown(); diff --git a/public/themes/website/1/en/demo/announce.html b/public/themes/website/1/en/demo/announce.html index e0ac04c..bdaf87b 100644 --- a/public/themes/website/1/en/demo/announce.html +++ b/public/themes/website/1/en/demo/announce.html @@ -64,23 +64,42 @@
+ {php} + $filter_cid = (string)input('cid', ''); + $filter_all_id = (string)($current_cate['id'] ?? ''); + if ($filter_cid === '') { + $filter_cid = $filter_all_id; + } + $filter_keywords = (string)input('keywords', ''); + $filter_is_all = ($filter_cid === $filter_all_id); + $filter_label = 'Filter by product'; + if (!$filter_is_all && !empty($sub_cates)) { + foreach ($sub_cates as $sc) { + if ((string)($sc['id'] ?? '') === $filter_cid) { + $filter_label = $sc['title'] ?? $filter_label; + break; + } + } + } + {/php}
-
diff --git a/public/themes/website/1/en/demo/download.html b/public/themes/website/1/en/demo/download.html index 31729be..6d3278b 100644 --- a/public/themes/website/1/en/demo/download.html +++ b/public/themes/website/1/en/demo/download.html @@ -67,21 +67,34 @@
{php} $download_cid = (string)input('cid', ''); + $download_all_id = (string)($current_cate['id'] ?? ''); if ($download_cid === '') { - $download_cid = (string)($current_cate['id'] ?? ''); + $download_cid = $download_all_id; } - $download_all_id = (string)($current_cate['id'] ?? ''); + $download_keywords = (string)input('keywords', ''); {/php} {volist name="sub_cates" id="vo"} {php} $count = getCategoryChildrenCount($vo['id']); $vo_id = (string)($vo['id'] ?? ''); + $group_active = false; + $group_label = $vo['title'] ?? ''; + if ($count > 0) { + $group_children = (new \app\model\Category())->where('parent_id', $vo['id'])->field('id,title')->select()->toArray(); + foreach ($group_children as $gc) { + if ((string)($gc['id'] ?? '') === $download_cid) { + $group_active = true; + $group_label = $gc['title'] ?? $group_label; + break; + } + } + } {/php} {if $count > 0}
-
diff --git a/public/themes/website/1/en/demo/faq.html b/public/themes/website/1/en/demo/faq.html index 59c37c2..dc0d7de 100644 --- a/public/themes/website/1/en/demo/faq.html +++ b/public/themes/website/1/en/demo/faq.html @@ -64,15 +64,24 @@
+ {php} + $filter_cid = (string)input('cid', ''); + $filter_all_id = (string)($current_cate['id'] ?? ''); + if ($filter_cid === '') { + $filter_cid = $filter_all_id; + } + $filter_keywords = (string)input('keywords', ''); + {/php}
- + {volist name="sub_cates" id="vo"} - + {php}$vo_id = (string)($vo['id'] ?? '');{/php} + {/volist}
diff --git a/public/themes/website/1/en/demo/video.html b/public/themes/website/1/en/demo/video.html index 1b742b6..407b8df 100644 --- a/public/themes/website/1/en/demo/video.html +++ b/public/themes/website/1/en/demo/video.html @@ -64,23 +64,42 @@
+ {php} + $filter_cid = (string)input('cid', ''); + $filter_all_id = (string)($current_cate['id'] ?? ''); + if ($filter_cid === '') { + $filter_cid = $filter_all_id; + } + $filter_keywords = (string)input('keywords', ''); + $filter_is_all = ($filter_cid === $filter_all_id); + $filter_label = 'Filter by product'; + if (!$filter_is_all && !empty($sub_cates)) { + foreach ($sub_cates as $sc) { + if ((string)($sc['id'] ?? '') === $filter_cid) { + $filter_label = $sc['title'] ?? $filter_label; + break; + } + } + } + {/php}
-
diff --git a/public/themes/website/1/zh/demo/announce.html b/public/themes/website/1/zh/demo/announce.html index 861543a..cd76e73 100644 --- a/public/themes/website/1/zh/demo/announce.html +++ b/public/themes/website/1/zh/demo/announce.html @@ -64,23 +64,42 @@
+ {php} + $filter_cid = (string)input('cid', ''); + $filter_all_id = (string)($current_cate['id'] ?? ''); + if ($filter_cid === '') { + $filter_cid = $filter_all_id; + } + $filter_keywords = (string)input('keywords', ''); + $filter_is_all = ($filter_cid === $filter_all_id); + $filter_label = '按产品筛选'; + if (!$filter_is_all && !empty($sub_cates)) { + foreach ($sub_cates as $sc) { + if ((string)($sc['id'] ?? '') === $filter_cid) { + $filter_label = $sc['title'] ?? $filter_label; + break; + } + } + } + {/php}
-
diff --git a/public/themes/website/1/zh/demo/download.html b/public/themes/website/1/zh/demo/download.html index ad0ce52..3fb126c 100644 --- a/public/themes/website/1/zh/demo/download.html +++ b/public/themes/website/1/zh/demo/download.html @@ -67,21 +67,34 @@
{php} $download_cid = (string)input('cid', ''); + $download_all_id = (string)($current_cate['id'] ?? ''); if ($download_cid === '') { - $download_cid = (string)($current_cate['id'] ?? ''); + $download_cid = $download_all_id; } - $download_all_id = (string)($current_cate['id'] ?? ''); + $download_keywords = (string)input('keywords', ''); {/php} {volist name="sub_cates" id="vo"} {php} $count = getCategoryChildrenCount($vo['id']); $vo_id = (string)($vo['id'] ?? ''); + $group_active = false; + $group_label = $vo['title'] ?? ''; + if ($count > 0) { + $group_children = (new \app\model\Category())->where('parent_id', $vo['id'])->field('id,title')->select()->toArray(); + foreach ($group_children as $gc) { + if ((string)($gc['id'] ?? '') === $download_cid) { + $group_active = true; + $group_label = $gc['title'] ?? $group_label; + break; + } + } + } {/php} {if $count > 0}
-
diff --git a/public/themes/website/1/zh/demo/faq.html b/public/themes/website/1/zh/demo/faq.html index 9be2bb0..66fe77e 100644 --- a/public/themes/website/1/zh/demo/faq.html +++ b/public/themes/website/1/zh/demo/faq.html @@ -64,15 +64,24 @@
+ {php} + $filter_cid = (string)input('cid', ''); + $filter_all_id = (string)($current_cate['id'] ?? ''); + if ($filter_cid === '') { + $filter_cid = $filter_all_id; + } + $filter_keywords = (string)input('keywords', ''); + {/php}
- + {volist name="sub_cates" id="vo"} - + {php}$vo_id = (string)($vo['id'] ?? '');{/php} + {/volist}
diff --git a/public/themes/website/1/zh/demo/video.html b/public/themes/website/1/zh/demo/video.html index 5103c27..a7af67b 100644 --- a/public/themes/website/1/zh/demo/video.html +++ b/public/themes/website/1/zh/demo/video.html @@ -64,23 +64,42 @@
+ {php} + $filter_cid = (string)input('cid', ''); + $filter_all_id = (string)($current_cate['id'] ?? ''); + if ($filter_cid === '') { + $filter_cid = $filter_all_id; + } + $filter_keywords = (string)input('keywords', ''); + $filter_is_all = ($filter_cid === $filter_all_id); + $filter_label = '按产品筛选'; + if (!$filter_is_all && !empty($sub_cates)) { + foreach ($sub_cates as $sc) { + if ((string)($sc['id'] ?? '') === $filter_cid) { + $filter_label = $sc['title'] ?? $filter_label; + break; + } + } + } + {/php}
-