diff --git a/public/js/admin.js b/public/js/admin.js index 7221990..7da6f4a 100644 --- a/public/js/admin.js +++ b/public/js/admin.js @@ -68,6 +68,33 @@ } })(); + // 平台订单列表页:当从批次页等入口带 #filters 跳转过来时,自动展开筛选面板并定位。 + // 说明:筛选面板会记忆折叠状态(localStorage);若运营之前手动收起,再跳转回来可能看不到筛选条件。 + (function () { + if (!window.location || String(window.location.hash || '') !== '#filters') { + return; + } + + var d = qs('#filters'); + if (!d) { + return; + } + + // 若是
,确保展开 + if (String(d.tagName || '').toLowerCase() === 'details') { + d.open = true; + } + + // 轻量定位(不强依赖 smooth) + try { + d.scrollIntoView({ behavior: 'smooth', block: 'start' }); + } catch (e) { + try { + d.scrollIntoView(); + } catch (e2) {} + } + })(); + // 通用:表单提交后禁用按钮,避免运营重复点击造成重复请求 // 用法:form 标记 data-action="disable-on-submit"。 (function () { diff --git a/tests/Feature/AdminJsShouldIncludeAutoOpenPlatformOrderFiltersOnAnchorTest.php b/tests/Feature/AdminJsShouldIncludeAutoOpenPlatformOrderFiltersOnAnchorTest.php new file mode 100644 index 0000000..b538f17 --- /dev/null +++ b/tests/Feature/AdminJsShouldIncludeAutoOpenPlatformOrderFiltersOnAnchorTest.php @@ -0,0 +1,23 @@ +assertIsString($js); + + // 关键口径:hash=#filters 时,自动展开 #filters(details) + $this->assertStringContainsString("#filters", $js); + $this->assertStringContainsString("location.hash", $js); + $this->assertStringContainsString("d.open = true", $js); + } +}