refactor(platform-orders): dedupe show page back actions
This commit is contained in:
@@ -72,7 +72,9 @@
|
||||
<span class="badge">来源线索:#{{ $leadIdFromBack }}</span>
|
||||
@endif
|
||||
|
||||
<a href="{!! $makePlatformOrderIndexUrl([]) !!}" class="btn btn-secondary btn-sm">返回平台订单列表(保留上下文)</a>
|
||||
@if($safeBackForLinks === '')
|
||||
<a href="{!! $makePlatformOrderIndexUrl([]) !!}" class="btn btn-secondary btn-sm">返回平台订单列表(保留上下文)</a>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -68,5 +68,20 @@ class AdminPlatformOrderShowIndexLinkKeepsContextTest extends TestCase
|
||||
|
||||
$res->assertSee('返回平台订单列表(保留上下文)');
|
||||
$res->assertSee($expectedIndexUrl, false);
|
||||
|
||||
// 明确 back 为空时,也应显示该按钮(作为兜底返回列表入口)
|
||||
$res2 = $this->get('/admin/platform-orders/' . $order->id . '?' . Arr::query([
|
||||
'back' => '',
|
||||
]));
|
||||
$res2->assertOk();
|
||||
$res2->assertSee('返回平台订单列表(保留上下文)');
|
||||
|
||||
// 当传入有效 back 时,应优先显示“返回上一页”并隐藏该兜底按钮(避免重复入口噪音)
|
||||
$res3 = $this->get('/admin/platform-orders/' . $order->id . '?' . Arr::query([
|
||||
'back' => '/admin',
|
||||
]));
|
||||
$res3->assertOk();
|
||||
$res3->assertSee('← 返回上一页(保留上下文)');
|
||||
$res3->assertDontSee('返回平台订单列表(保留上下文)');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user