统一后台列表页样式并调整站长菜单
This commit is contained in:
@@ -3,120 +3,122 @@
|
||||
@section('title', '五子棋对局记录')
|
||||
|
||||
@section('content')
|
||||
<div class="space-y-6">
|
||||
@php require resource_path('views/admin/partials/list-theme.php'); @endphp
|
||||
|
||||
{{-- 页头 --}}
|
||||
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6 flex justify-between items-center">
|
||||
@php
|
||||
$tableCellClass = 'px-4 py-3';
|
||||
$badgeClass = $adminListBadgeBaseClass;
|
||||
@endphp
|
||||
|
||||
<div class="{{ $adminListPageClass }}">
|
||||
<div class="{{ $adminListHeaderCardClass }} flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
|
||||
<div>
|
||||
<h2 class="text-lg font-bold text-gray-800">♟️ 五子棋历史记录</h2>
|
||||
<p class="text-xs text-gray-500 mt-1">查询全站所有的五子棋人机及 PvP 对局。</p>
|
||||
<h2 class="{{ $adminListHeaderTitleClass }}">♟️ 五子棋历史记录</h2>
|
||||
<p class="{{ $adminListHeaderSubtitleClass }}">查询全站所有的五子棋人机及 PvP 对局。</p>
|
||||
</div>
|
||||
<a href="{{ route('admin.game-configs.index') }}"
|
||||
class="px-4 py-2 bg-gray-100 text-gray-700 rounded-lg text-sm font-bold hover:bg-gray-200 transition">
|
||||
<a href="{{ route('admin.game-configs.index') }}" class="{{ $adminListSecondaryButtonClass }}">
|
||||
⚙️ 游戏配置
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{{-- 统计卡片 --}}
|
||||
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
|
||||
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-5">
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-4">
|
||||
<div class="rounded-xl border border-gray-100 bg-white p-5 shadow-sm">
|
||||
<div class="text-2xl font-bold text-indigo-600">{{ number_format($summary['total_games']) }}</div>
|
||||
<div class="text-xs text-gray-500 mt-1">历史对局数</div>
|
||||
<div class="mt-1 text-xs text-gray-500">历史对局数</div>
|
||||
</div>
|
||||
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-5">
|
||||
<div class="rounded-xl border border-gray-100 bg-white p-5 shadow-sm">
|
||||
<div class="text-2xl font-bold text-emerald-600">{{ number_format($summary['completed']) }}</div>
|
||||
<div class="text-xs text-gray-500 mt-1">正常完赛</div>
|
||||
<div class="mt-1 text-xs text-gray-500">正常完赛</div>
|
||||
</div>
|
||||
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-5">
|
||||
<div class="rounded-xl border border-gray-100 bg-white p-5 shadow-sm">
|
||||
<div class="text-2xl font-bold text-amber-600">{{ number_format($summary['pvp_count']) }}</div>
|
||||
<div class="text-xs text-gray-500 mt-1">PvP 人人对战数</div>
|
||||
<div class="mt-1 text-xs text-gray-500">PvP 人人对战数</div>
|
||||
</div>
|
||||
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-5">
|
||||
<div class="rounded-xl border border-gray-100 bg-white p-5 shadow-sm">
|
||||
<div class="text-2xl font-bold text-rose-600">{{ number_format($summary['today_games']) }}</div>
|
||||
<div class="text-xs text-gray-500 mt-1">今日新建对局</div>
|
||||
<div class="mt-1 text-xs text-gray-500">今日新建对局</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 期数列表 --}}
|
||||
<div class="bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden">
|
||||
<table class="w-full text-sm">
|
||||
<thead class="bg-gray-50 border-b border-gray-100">
|
||||
<tr>
|
||||
<th class="px-4 py-3 text-left text-xs font-bold text-gray-500 uppercase">赛事ID</th>
|
||||
<th class="px-4 py-3 text-left text-xs font-bold text-gray-500 uppercase">创建时间</th>
|
||||
<th class="px-4 py-3 text-center text-xs font-bold text-gray-500 uppercase">模式</th>
|
||||
<th class="px-4 py-3 text-center text-xs font-bold text-gray-500 uppercase">黑方 (发起)</th>
|
||||
<th class="px-4 py-3 text-center text-xs font-bold text-gray-500 uppercase">白方 (迎战)</th>
|
||||
<th class="px-4 py-3 text-center text-xs font-bold text-gray-500 uppercase">状态</th>
|
||||
<th class="px-4 py-3 text-center text-xs font-bold text-gray-500 uppercase">胜负</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-50">
|
||||
@forelse ($games as $game)
|
||||
<tr class="hover:bg-gray-50 transition">
|
||||
<td class="px-4 py-3 text-gray-600 text-xs font-mono font-bold">#{{ $game->id }}</td>
|
||||
<td class="px-4 py-3 text-xs text-gray-600">
|
||||
{{ $game->created_at ? $game->created_at->format('m-d H:i') : '—' }}
|
||||
</td>
|
||||
<td class="px-4 py-3 text-center">
|
||||
@if ($game->mode === 'pve')
|
||||
<span
|
||||
class="px-2 py-0.5 rounded-full text-xs font-bold bg-purple-100 text-purple-700">单机
|
||||
PvE(L{{ $game->ai_level }})</span>
|
||||
@else
|
||||
<span class="px-2 py-0.5 rounded-full text-xs font-bold bg-blue-100 text-blue-700">在线
|
||||
PvP</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="px-4 py-3 text-center font-bold">
|
||||
{{ $game->playerBlack?->username ?? '已注销/未知' }}
|
||||
</td>
|
||||
<td class="px-4 py-3 text-center font-bold">
|
||||
@if ($game->mode === 'pve')
|
||||
<span class="text-xs text-gray-400">AI 机器人</span>
|
||||
@else
|
||||
{{ $game->playerWhite?->username ?? '已注销/未加入' }}
|
||||
@endif
|
||||
</td>
|
||||
<td class="px-4 py-3 text-center">
|
||||
@php
|
||||
$s = match ($game->status) {
|
||||
'waiting' => ['label' => '等待中', 'bg' => 'bg-amber-100 text-amber-600'],
|
||||
'playing' => ['label' => '对弈中', 'bg' => 'bg-blue-100 text-blue-600'],
|
||||
'finished' => ['label' => '已结束', 'bg' => 'bg-emerald-100 text-emerald-700'],
|
||||
default => ['label' => $game->status, 'bg' => 'bg-gray-100 text-gray-600'],
|
||||
};
|
||||
@endphp
|
||||
<span
|
||||
class="px-2 py-0.5 rounded-full text-xs font-bold {{ $s['bg'] }}">{{ $s['label'] }}</span>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-center">
|
||||
@if ($game->status !== 'finished')
|
||||
<span class="text-xs text-gray-400">-</span>
|
||||
@else
|
||||
@if ($game->winner === 1)
|
||||
<span class="text-xs font-bold text-gray-800 bg-gray-200 px-2 py-1 rounded">⚫
|
||||
黑胜</span>
|
||||
@elseif($game->winner === 2)
|
||||
<span class="text-xs font-bold bg-white border border-gray-300 px-2 py-1 rounded">⚪
|
||||
白胜</span>
|
||||
<div class="{{ $adminListCardClass }}">
|
||||
<div class="{{ $adminListSectionHeadClass }}">
|
||||
<div class="{{ $adminListSectionTitleClass }}">对局列表</div>
|
||||
<div class="{{ $adminListSectionDescClass }}">统一表格层次,保留 PvE/PvP、对局状态与胜负视觉语义。</div>
|
||||
</div>
|
||||
|
||||
<div class="{{ $adminListTableWrapClass }}">
|
||||
<table class="{{ $adminListTableClass }}">
|
||||
<thead>
|
||||
<tr class="{{ $adminListTableHeadRowClass }}">
|
||||
<th class="{{ $adminListTableHeadCellClass }}">赛事ID</th>
|
||||
<th class="{{ $adminListTableHeadCellClass }}">创建时间</th>
|
||||
<th class="{{ $adminListTableHeadCellClass }} text-center">模式</th>
|
||||
<th class="{{ $adminListTableHeadCellClass }} text-center">黑方 (发起)</th>
|
||||
<th class="{{ $adminListTableHeadCellClass }} text-center">白方 (迎战)</th>
|
||||
<th class="{{ $adminListTableHeadCellClass }} text-center">状态</th>
|
||||
<th class="{{ $adminListTableHeadCellClass }} text-center">胜负</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="{{ $adminListTableBodyClass }}">
|
||||
@forelse ($games as $game)
|
||||
<tr class="{{ $adminListTableRowClass }}">
|
||||
<td class="{{ $tableCellClass }} {{ $adminListPrimaryTextClass }} font-mono">#{{ $game->id }}</td>
|
||||
<td class="{{ $tableCellClass }} {{ $adminListBodyTextClass }}">
|
||||
{{ $game->created_at ? $game->created_at->format('m-d H:i') : '—' }}
|
||||
</td>
|
||||
<td class="{{ $tableCellClass }} text-center">
|
||||
@if ($game->mode === 'pve')
|
||||
<span class="{{ $badgeClass }} border-purple-200 bg-purple-100 text-purple-700">单机 PvE(L{{ $game->ai_level }})</span>
|
||||
@else
|
||||
<span
|
||||
class="text-xs font-bold text-gray-500 bg-gray-100 px-2 py-1 rounded">平局撤销</span>
|
||||
<span class="{{ $badgeClass }} border-blue-200 bg-blue-100 text-blue-700">在线 PvP</span>
|
||||
@endif
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="7" class="px-4 py-10 text-center text-gray-400 text-sm">暂无记录</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
<td class="{{ $tableCellClass }} text-center {{ $adminListPrimaryTextClass }}">
|
||||
{{ $game->playerBlack?->username ?? '已注销/未知' }}
|
||||
</td>
|
||||
<td class="{{ $tableCellClass }} text-center {{ $adminListPrimaryTextClass }}">
|
||||
@if ($game->mode === 'pve')
|
||||
<span class="{{ $adminListSecondaryTextClass }}">AI 机器人</span>
|
||||
@else
|
||||
{{ $game->playerWhite?->username ?? '已注销/未加入' }}
|
||||
@endif
|
||||
</td>
|
||||
<td class="{{ $tableCellClass }} text-center">
|
||||
@php
|
||||
$s = match ($game->status) {
|
||||
'waiting' => ['label' => '等待中', 'bg' => 'bg-amber-100 text-amber-600 border-amber-200'],
|
||||
'playing' => ['label' => '对弈中', 'bg' => 'bg-blue-100 text-blue-600 border-blue-200'],
|
||||
'finished' => ['label' => '已结束', 'bg' => 'bg-emerald-100 text-emerald-700 border-emerald-200'],
|
||||
default => ['label' => $game->status, 'bg' => 'bg-gray-100 text-gray-600 border-gray-200'],
|
||||
};
|
||||
@endphp
|
||||
<span class="{{ $badgeClass }} {{ $s['bg'] }}">{{ $s['label'] }}</span>
|
||||
</td>
|
||||
<td class="{{ $tableCellClass }} text-center">
|
||||
@if ($game->status !== 'finished')
|
||||
<span class="{{ $adminListSecondaryTextClass }}">-</span>
|
||||
@else
|
||||
@if ($game->winner === 1)
|
||||
<span class="{{ $badgeClass }} border-gray-300 bg-gray-200 text-gray-800">⚫ 黑胜</span>
|
||||
@elseif ($game->winner === 2)
|
||||
<span class="{{ $badgeClass }} border-gray-300 bg-white text-gray-700">⚪ 白胜</span>
|
||||
@else
|
||||
<span class="{{ $badgeClass }} border-gray-200 bg-gray-100 text-gray-500">平局撤销</span>
|
||||
@endif
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="7" class="{{ $adminListEmptyClass }}">暂无记录</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@if ($games->hasPages())
|
||||
<div class="px-4 py-3 border-t border-gray-100">
|
||||
<div class="{{ $adminListPaginationClass }}">
|
||||
{{ $games->links() }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
Reference in New Issue
Block a user