From 053fc71dc8294fd8684ace3282bc3de930cca167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Mon, 16 Mar 2026 03:42:43 +0800 Subject: [PATCH] chore(admin-ui): migrate products list to list card and admin pagination --- .../views/admin/products/index.blade.php | 19 ++++++--- ...houldUseListCardAndAdminPaginationTest.php | 40 +++++++++++++++++++ 2 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 tests/Feature/AdminProductsIndexShouldUseListCardAndAdminPaginationTest.php diff --git a/resources/views/admin/products/index.blade.php b/resources/views/admin/products/index.blade.php index c59e792..94fcf69 100644 --- a/resources/views/admin/products/index.blade.php +++ b/resources/views/admin/products/index.blade.php @@ -54,7 +54,7 @@
累计失败商品
{{ $importHistoryStats['total_failed'] ?? 0 }}
含失败批次
{{ $importHistoryStats['warning_imports'] ?? 0 }}
- +
@forelse($importHistories->take(5) as $history) @@ -171,8 +171,13 @@ -
-

商品列表

+
+
+
+

商品列表

+
+
+
@csrf @php @@ -195,7 +200,7 @@

平台侧批量改分类会校验所选分类是否属于被勾选商品对应商家;若混选了不同商家的商品,请选择各自可用的分类或先分批处理。

-
ID导入时间商家上传文件结果失败明细
+
@foreach($products as $product) @@ -216,7 +221,7 @@ @endforeach
ID商家标题分类SKU售价/原价库存创建时间更新时间状态操作
- + -
{{ $products->links() }}
+{{ $products->links('pagination.admin') }} + + @endsection diff --git a/tests/Feature/AdminProductsIndexShouldUseListCardAndAdminPaginationTest.php b/tests/Feature/AdminProductsIndexShouldUseListCardAndAdminPaginationTest.php new file mode 100644 index 0000000..2c996d4 --- /dev/null +++ b/tests/Feature/AdminProductsIndexShouldUseListCardAndAdminPaginationTest.php @@ -0,0 +1,40 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_admin_products_index_should_use_list_card_and_admin_pagination(): void + { + $this->loginAsPlatformAdmin(); + + $res = $this->get('/admin/products'); + $res->assertOk(); + + // 护栏:商品列表区域应走统一 List Card 骨架。 + $res->assertSee('list-card', false); + $res->assertSee('list-card-header', false); + $res->assertSee('list-card-body', false); + $res->assertSee('list-card-table', false); + + // 分页统一:数据量可能不足导致 hasPages=false,因此用扫描型护栏断言。 + $blade = file_get_contents(resource_path('views/admin/products/index.blade.php')); + $this->assertIsString($blade); + $this->assertStringContainsString("links('pagination.admin')", $blade); + } +}