统一后台列表页样式并调整站长菜单

This commit is contained in:
2026-04-26 18:10:37 +08:00
parent 61cfc2091c
commit 00270b3904
36 changed files with 2590 additions and 2345 deletions
@@ -11,70 +11,81 @@
@section('title', '在职登录日志 · ' . $userPosition->user->username)
@section('content')
<div class="mb-6">
<a href="{{ route('admin.appointments.index') }}" class="text-sm text-indigo-600 hover:underline"> 返回任命管理</a>
<h2 class="text-lg font-bold text-gray-800 mt-2">
{{ $userPosition->position->icon }} {{ $userPosition->user->username }} · {{ $userPosition->position->name }}
</h2>
<p class="text-sm text-gray-500 mt-1">
任命于 {{ $userPosition->appointed_at->format('Y-m-d') }}
任命人:{{ $userPosition->appointedBy?->username ?? '系统' }}
</p>
</div>
@php require resource_path('views/admin/partials/list-theme.php'); @endphp
<div class="{{ $adminListPageClass }}">
<div class="{{ $adminListHeaderCardClass }}">
<div>
<a href="{{ route('admin.appointments.index') }}" class="text-sm font-semibold text-indigo-600 hover:text-indigo-700"> 返回任命管理</a>
<h2 class="mt-2 {{ $adminListHeaderTitleClass }}">
{{ $userPosition->position->icon }} {{ $userPosition->user->username }} · {{ $userPosition->position->name }}
</h2>
<p class="{{ $adminListHeaderSubtitleClass }}">
任命于 {{ $userPosition->appointed_at->format('Y-m-d') }},任命人:{{ $userPosition->appointedBy?->username ?? '系统' }}
</p>
</div>
</div>
{{-- 统计摘要 --}}
<div class="grid grid-cols-3 gap-4 mb-6">
<div class="bg-white rounded-xl p-5 border shadow-sm text-center">
<div class="grid gap-4 md:grid-cols-3">
<div class="{{ $adminListCardClass }} p-5 text-center">
<div class="text-2xl font-bold text-indigo-600">{{ $logs->total() }}</div>
<div class="text-xs text-gray-500 mt-1">总登录次数</div>
</div>
<div class="bg-white rounded-xl p-5 border shadow-sm text-center">
<div class="{{ $adminListCardClass }} p-5 text-center">
<div class="text-2xl font-bold text-green-600">
{{ intdiv($totalSeconds, 3600) }}h {{ intdiv($totalSeconds % 3600, 60) }}m
</div>
<div class="text-xs text-gray-500 mt-1">累计在线时长(所有)</div>
</div>
<div class="bg-white rounded-xl p-5 border shadow-sm text-center">
<div class="{{ $adminListCardClass }} p-5 text-center">
<div class="text-2xl font-bold text-orange-600">{{ $userPosition->total_rewarded_coins }}</div>
<div class="text-xs text-gray-500 mt-1">在职期间发放金币</div>
</div>
</div>
<div class="bg-white rounded-xl shadow-sm border overflow-hidden">
<table class="w-full text-sm">
<thead class="bg-gray-50 text-gray-600 text-xs">
<tr>
<th class="px-4 py-3 text-left">登录时间</th>
<th class="px-4 py-3 text-left">退出时间</th>
<th class="px-4 py-3 text-center">在线时长</th>
<th class="px-4 py-3 text-center">房间</th>
<th class="px-4 py-3 text-left">IP 地址</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100">
@forelse ($logs as $log)
<tr class="hover:bg-gray-50">
<td class="px-4 py-3 text-gray-700">{{ $log->login_at->format('m-d H:i:s') }}</td>
<td class="px-4 py-3 text-gray-500">{{ $log->logout_at?->format('m-d H:i:s') ?? '在线中...' }}</td>
<td class="px-4 py-3 text-center">
@if ($log->duration_seconds)
<span
class="text-xs bg-blue-100 text-blue-700 px-2 py-0.5 rounded">{{ $log->formatted_duration }}</span>
@else
<span class="text-xs text-gray-400"></span>
@endif
</td>
<td class="px-4 py-3 text-center text-gray-500">{{ $log->room_id ? "房间#{$log->room_id}" : '—' }}
</td>
<td class="px-4 py-3 text-gray-400 font-mono text-xs">{{ $log->ip_address }}</td>
</tr>
@empty
<tr>
<td colspan="5" class="px-4 py-12 text-center text-gray-400">暂无登录记录</td>
</tr>
@endforelse
</tbody>
</table>
<div class="{{ $adminListCardClass }}">
<div class="{{ $adminListSectionHeadClass }}">
<h3 class="{{ $adminListSectionTitleClass }}">在职登录记录</h3>
<p class="{{ $adminListSectionDescClass }}">记录该任职周期内的登录、退出、在线时长与所在房间信息。</p>
</div>
<div class="{{ $adminListTableWrapClass }}">
<table class="{{ $adminListTableClass }} whitespace-nowrap">
<thead>
<tr class="{{ $adminListTableHeadRowClass }}">
<th class="{{ $adminListTableHeadCellClass }}">登录时间</th>
<th class="{{ $adminListTableHeadCellClass }}">退出时间</th>
<th class="{{ $adminListTableHeadCellClass }} text-center">在线时长</th>
<th class="{{ $adminListTableHeadCellClass }} text-center">房间</th>
<th class="{{ $adminListTableHeadCellClass }}">IP 地址</th>
</tr>
</thead>
<tbody class="{{ $adminListTableBodyClass }}">
@forelse ($logs as $log)
<tr class="{{ $adminListTableRowClass }}">
<td class="px-4 py-3 {{ $adminListPrimaryTextClass }}">{{ $log->login_at->format('m-d H:i:s') }}</td>
<td class="px-4 py-3 {{ $adminListBodyTextClass }}">{{ $log->logout_at?->format('m-d H:i:s') ?? '在线中...' }}</td>
<td class="px-4 py-3 text-center">
@if ($log->duration_seconds)
<span class="inline-flex items-center rounded-full bg-blue-100 px-2 py-0.5 text-xs font-semibold text-blue-700">{{ $log->formatted_duration }}</span>
@else
<span class="{{ $adminListSecondaryTextClass }}"></span>
@endif
</td>
<td class="px-4 py-3 text-center {{ $adminListBodyTextClass }}">{{ $log->room_id ? "房间#{$log->room_id}" : '—' }}</td>
<td class="px-4 py-3 {{ $adminListNumericTextClass }} text-gray-400">{{ $log->ip_address }}</td>
</tr>
@empty
<tr>
<td colspan="5" class="{{ $adminListEmptyClass }}">暂无登录记录</td>
</tr>
@endforelse
</tbody>
</table>
</div>
@if ($logs->hasPages())
<div class="{{ $adminListPaginationClass }}">{{ $logs->links() }}</div>
@endif
</div>
</div>
<div class="mt-4">{{ $logs->links() }}</div>
@endsection