refactor(platform-orders): extract blocked hint component for tool actions

This commit is contained in:
萝卜
2026-03-17 09:52:34 +08:00
parent 78eef42d57
commit 28e9e3bbe8
2 changed files with 103 additions and 65 deletions

View File

@@ -0,0 +1,33 @@
@php
/**
* 通用“工具被阻断提示块”。
*
* 用法:
* @include('admin.components.tool_blocked_hint', [
* 'dataRole' => 'xxx-blocked-hint',
* 'reason' => '提示原因',
* // actions: [['label' => '去xxx', 'url' => $url], ...]
* 'actions' => [ ... ],
* ])
*/
$dataRole = (string) ($dataRole ?? '');
$reason = (string) ($reason ?? '');
$actions = (array) ($actions ?? []);
@endphp
<div class="adm-tool-blocked-hint" @if($dataRole !== '') data-role="{{ $dataRole }}" @endif>
<div>提示:{{ $reason }}</div>
@if(count($actions) > 0)
<div class="mt-6 actions gap-10">
@foreach($actions as $a)
@php
$label = (string) ($a['label'] ?? '');
$url = (string) ($a['url'] ?? '');
@endphp
@if($label !== '' && $url !== '')
<a class="btn btn-secondary btn-sm" href="{!! $url !!}">{{ $label }}</a>
@endif
@endforeach
</div>
@endif
</div>