@extends('admin.layouts.app') @section('title', '用户检索与管理') @section('content') @php $filterLabelClass = 'block mb-1 text-xs font-semibold uppercase tracking-wider text-gray-500'; $filterInputClass = 'px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:ring-indigo-500 focus:border-indigo-500 text-sm'; $tableHeadClass = 'p-4 text-xs font-semibold uppercase tracking-wider text-gray-500'; $primaryTextClass = 'text-sm font-semibold text-gray-800'; $secondaryTextClass = 'text-xs text-gray-400'; $numericTextClass = 'text-sm font-mono'; $statusBadgeClass = 'inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-semibold border'; $actionButtonClass = 'rounded-lg px-3 py-1.5 text-xs font-semibold transition cursor-pointer'; $modalLabelClass = 'mb-1 block text-xs font-semibold uppercase tracking-wider text-gray-500'; $modalInputClass = 'w-full rounded-md border border-gray-300 p-2 text-sm text-gray-700 shadow-sm focus:border-indigo-500 focus:ring-indigo-500'; @endphp
重置
@php /** * 生成排序链接:点击同一列切换方向,点击新列默认倒序 */ $sortLink = function (string $col) use ($sortBy, $sortDir): string { $newDir = $sortBy === $col && $sortDir === 'desc' ? 'asc' : 'desc'; $qs = http_build_query( array_merge(request()->except(['sort_by', 'sort_dir', 'page']), [ 'sort_by' => $col, 'sort_dir' => $newDir, ]), ); return url('/admin/users?' . $qs); }; $arrow = fn(string $col): string => $sortBy === $col ? ($sortDir === 'desc' ? ' ↓' : ' ↑') : ''; @endphp @foreach ($users as $user) @endforeach
ID{{ $arrow('id') }} 注册名 性别 等级{{ $arrow('user_level') }} 职务 经验{{ $arrow('exp_num') }} 金币{{ $arrow('jjb') }} 魅力{{ $arrow('meili') }} 注册时间 微信绑定{{ $arrow('wxid') }} 在线{{ $arrow('online') }} 管理操作
{{ $user->id }}
{{ $user->username }} @if ($user->isVip()) {{ $user->vipIcon() }} @endif
{{ [0 => '保密', 1 => '男', 2 => '女'][$user->sex] ?? '保密' }} LV.{{ $user->user_level }} @if ($user->activePosition) @php $pos = $user->activePosition->position; @endphp
{{ $pos->department->name }}
{{ $pos->icon }} {{ $pos->name }}
@else @endif
{{ number_format($user->exp_num ?? 0) }} {{ number_format($user->jjb ?? 0) }} {{ number_format($user->meili ?? 0) }} {{ $user->created_at->format('y-m-d') }} @if(!empty($user->wxid)) 已绑定 @else 未绑定 @endif @php $isOnline = $onlineUsernames->contains($user->username); @endphp {{ $isOnline ? '在线' : '离线' }} @if (auth()->id() === 1)
@csrf @method('DELETE')
@else @endif
@if ($users->hasPages())
{{ $users->links() }}
@endif
@endsection