From 7d291a7906e9ad339c043f4f964447fada07669d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Mon, 16 Mar 2026 01:40:28 +0800 Subject: [PATCH] chore(admin-ui): unify list table empty state styling and class usage --- public/css/admin-components.css | 6 +++ resources/views/admin/plans/index.blade.php | 2 +- .../admin/platform_orders/index.blade.php | 2 +- .../admin/site_subscriptions/index.blade.php | 2 +- ...sEmptyRowsShouldUseTableEmptyClassTest.php | 41 +++++++++++++++++++ ...ardTableEmptyStateShouldBeCenteredTest.php | 34 +++++++++++++++ 6 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 tests/Feature/AdminBillingListsEmptyRowsShouldUseTableEmptyClassTest.php create mode 100644 tests/Feature/AdminComponentsCssListCardTableEmptyStateShouldBeCenteredTest.php diff --git a/public/css/admin-components.css b/public/css/admin-components.css index 5c325ea..9b3d9da 100644 --- a/public/css/admin-components.css +++ b/public/css/admin-components.css @@ -178,6 +178,12 @@ background:var(--adm-table-row-hover-bg, rgba(22, 119, 255, .04)); } +.list-card-table .table-empty{ + padding:24px 12px; + text-align:center; + background:rgba(15, 23, 42, .02); +} + /* 可复用:PageHeader(参考 Ant Design Pro:标题区 + 描述 + 右侧操作区) */ .page-header{ width:100%; diff --git a/resources/views/admin/plans/index.blade.php b/resources/views/admin/plans/index.blade.php index 2aea5b7..3cd6d54 100644 --- a/resources/views/admin/plans/index.blade.php +++ b/resources/views/admin/plans/index.blade.php @@ -304,7 +304,7 @@ @empty - 暂无套餐数据,当前阶段先把套餐主表与总台目录立起来,后续可继续接套餐创建、授权项与订阅关联。 + 暂无套餐数据,当前阶段先把套餐主表与总台目录立起来,后续可继续接套餐创建、授权项与订阅关联。 @endforelse diff --git a/resources/views/admin/platform_orders/index.blade.php b/resources/views/admin/platform_orders/index.blade.php index f099615..21af385 100644 --- a/resources/views/admin/platform_orders/index.blade.php +++ b/resources/views/admin/platform_orders/index.blade.php @@ -1544,7 +1544,7 @@ @empty - 暂无平台订单,当前阶段骨架已就位,可继续补套餐下单、支付回执与订阅生效链路。 + 暂无平台订单,当前阶段骨架已就位,可继续补套餐下单、支付回执与订阅生效链路。 @endforelse diff --git a/resources/views/admin/site_subscriptions/index.blade.php b/resources/views/admin/site_subscriptions/index.blade.php index 3bccd02..238eedb 100644 --- a/resources/views/admin/site_subscriptions/index.blade.php +++ b/resources/views/admin/site_subscriptions/index.blade.php @@ -406,7 +406,7 @@ @empty - 暂无订阅数据,当前阶段先把订阅主表与总台目录立起来,后续再接订阅创建/激活/续费链路。 + 暂无订阅数据,当前阶段先把订阅主表与总台目录立起来,后续再接订阅创建/激活/续费链路。 @endforelse diff --git a/tests/Feature/AdminBillingListsEmptyRowsShouldUseTableEmptyClassTest.php b/tests/Feature/AdminBillingListsEmptyRowsShouldUseTableEmptyClassTest.php new file mode 100644 index 0000000..35ac3cc --- /dev/null +++ b/tests/Feature/AdminBillingListsEmptyRowsShouldUseTableEmptyClassTest.php @@ -0,0 +1,41 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_admin_billing_lists_empty_rows_should_use_table_empty_class(): void + { + $this->loginAsPlatformAdmin(); + + // 使用“不可能命中”的 keyword 强制列表进入空集合,从而验证空态 td 的统一 class。 + $kw = '___no_such_keyword_' . uniqid() . '___'; + + $platformOrders = $this->get('/admin/platform-orders?keyword=' . urlencode($kw)); + $platformOrders->assertOk(); + $platformOrders->assertSee('table-empty', false); + + $subscriptions = $this->get('/admin/site-subscriptions?keyword=' . urlencode($kw)); + $subscriptions->assertOk(); + $subscriptions->assertSee('table-empty', false); + + $plans = $this->get('/admin/plans?keyword=' . urlencode($kw)); + $plans->assertOk(); + $plans->assertSee('table-empty', false); + } +} diff --git a/tests/Feature/AdminComponentsCssListCardTableEmptyStateShouldBeCenteredTest.php b/tests/Feature/AdminComponentsCssListCardTableEmptyStateShouldBeCenteredTest.php new file mode 100644 index 0000000..8c9eb29 --- /dev/null +++ b/tests/Feature/AdminComponentsCssListCardTableEmptyStateShouldBeCenteredTest.php @@ -0,0 +1,34 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_admin_components_css_list_card_table_empty_state_should_be_centered(): void + { + $this->loginAsPlatformAdmin(); + + $css = file_get_contents(public_path('css/admin-components.css')); + $this->assertIsString($css); + + // 空状态行(table-empty)应统一居中 + 留白,避免每页空态体验不一致。 + $this->assertStringContainsString('.list-card-table .table-empty{', $css); + $this->assertStringContainsString('text-align:center', $css); + $this->assertStringContainsString('padding:24px 12px', $css); + } +}