diff --git a/public/js/admin.js b/public/js/admin.js index f42f7cd..4711082 100644 --- a/public/js/admin.js +++ b/public/js/admin.js @@ -47,6 +47,22 @@ } } + // 平台订单详情页:当从仪表盘/列表跳转到某个治理锚点(例如 #add-payment-receipt)时,自动展开对应
。 + // 说明:避免“跳过去但面板是折叠的”,造成运营以为没跳到。 + (function () { + if (!window.location || !window.location.hash) { + return; + } + + var h = String(window.location.hash || ''); + if (h === '#add-payment-receipt') { + var d = qs('details#add-payment-receipt'); + if (d) { + d.open = true; + } + } + })(); + // 通用:表单提交后禁用按钮,避免运营重复点击造成重复请求 // 用法:form 标记 data-action="disable-on-submit"。 (function () { diff --git a/tests/Feature/AdminJsShouldAutoOpenAddPaymentReceiptDetailsWhenHashPresentTest.php b/tests/Feature/AdminJsShouldAutoOpenAddPaymentReceiptDetailsWhenHashPresentTest.php new file mode 100644 index 0000000..005a894 --- /dev/null +++ b/tests/Feature/AdminJsShouldAutoOpenAddPaymentReceiptDetailsWhenHashPresentTest.php @@ -0,0 +1,18 @@ +assertStringContainsString("h === '#add-payment-receipt'", $js); + $this->assertStringContainsString("qs('details#add-payment-receipt')", $js); + $this->assertStringContainsString('d.open = true', $js); + } +}