优化:后台大盘用户列表增加微信绑定状态展示并支持排序,优化整体表格排版(不换行、时间简写)
This commit is contained in:
@@ -52,7 +52,7 @@ class UserManagerController extends Controller
|
|||||||
$onlineUsernames = $onlineUsernames->unique()->values();
|
$onlineUsernames = $onlineUsernames->unique()->values();
|
||||||
|
|
||||||
// 排序:允许的字段白名单,防止 SQL 注入
|
// 排序:允许的字段白名单,防止 SQL 注入
|
||||||
$sortable = ['user_level', 'exp_num', 'jjb', 'meili', 'id', 'online'];
|
$sortable = ['user_level', 'exp_num', 'jjb', 'meili', 'id', 'online', 'wxid'];
|
||||||
$sortBy = in_array($request->input('sort_by'), $sortable) ? $request->input('sort_by') : 'id';
|
$sortBy = in_array($request->input('sort_by'), $sortable) ? $request->input('sort_by') : 'id';
|
||||||
$sortDir = $request->input('sort_dir') === 'asc' ? 'asc' : 'desc';
|
$sortDir = $request->input('sort_dir') === 'asc' ? 'asc' : 'desc';
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
};
|
};
|
||||||
$arrow = fn(string $col): string => $sortBy === $col ? ($sortDir === 'desc' ? ' ↓' : ' ↑') : '';
|
$arrow = fn(string $col): string => $sortBy === $col ? ($sortDir === 'desc' ? ' ↓' : ' ↑') : '';
|
||||||
@endphp
|
@endphp
|
||||||
<table class="w-full text-left border-collapse">
|
<table class="w-full text-left border-collapse whitespace-nowrap">
|
||||||
<thead>
|
<thead>
|
||||||
<tr
|
<tr
|
||||||
class="bg-gray-50 border-b border-gray-100 text-xs text-gray-500 uppercase font-bold tracking-wider">
|
class="bg-gray-50 border-b border-gray-100 text-xs text-gray-500 uppercase font-bold tracking-wider">
|
||||||
@@ -67,6 +67,11 @@
|
|||||||
</a>
|
</a>
|
||||||
</th>
|
</th>
|
||||||
<th class="p-4">注册时间</th>
|
<th class="p-4">注册时间</th>
|
||||||
|
<th class="p-4">
|
||||||
|
<a href="{{ $sortLink('wxid') }}" class="hover:text-green-600 flex items-center gap-1">
|
||||||
|
微信绑定<span class="text-green-500">{{ $arrow('wxid') }}</span>
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
<th class="p-4">
|
<th class="p-4">
|
||||||
<a href="{{ $sortLink('online') }}" class="hover:text-green-600 flex items-center gap-1">
|
<a href="{{ $sortLink('online') }}" class="hover:text-green-600 flex items-center gap-1">
|
||||||
在线<span class="text-green-500">{{ $arrow('online') }}</span>
|
在线<span class="text-green-500">{{ $arrow('online') }}</span>
|
||||||
@@ -117,7 +122,18 @@
|
|||||||
<td class="p-4 text-sm font-mono text-pink-600">
|
<td class="p-4 text-sm font-mono text-pink-600">
|
||||||
{{ number_format($user->meili ?? 0) }}
|
{{ number_format($user->meili ?? 0) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="p-4 text-sm font-mono text-gray-500">{{ $user->created_at->format('Y/m/d H:i') }}
|
<td class="p-4 text-sm font-mono text-gray-500">{{ $user->created_at->format('y-m-d') }}
|
||||||
|
</td>
|
||||||
|
<td class="p-4">
|
||||||
|
@if(!empty($user->wxid))
|
||||||
|
<span class="inline-flex items-center gap-1.5 text-xs font-bold px-2 py-0.5 rounded-full bg-green-50 text-green-700 border border-green-200">
|
||||||
|
已绑定
|
||||||
|
</span>
|
||||||
|
@else
|
||||||
|
<span class="inline-flex items-center gap-1.5 text-xs font-bold px-2 py-0.5 rounded-full bg-gray-50 text-gray-400 border border-gray-200">
|
||||||
|
未绑定
|
||||||
|
</span>
|
||||||
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td class="p-4">
|
<td class="p-4">
|
||||||
@php $isOnline = $onlineUsernames->contains($user->username); @endphp
|
@php $isOnline = $onlineUsernames->contains($user->username); @endphp
|
||||||
@@ -146,7 +162,7 @@
|
|||||||
requestUrl: '{{ route('admin.users.update', $user->id) }}'
|
requestUrl: '{{ route('admin.users.update', $user->id) }}'
|
||||||
}; showEditModal = true"
|
}; showEditModal = true"
|
||||||
class="text-xs bg-indigo-50 text-indigo-600 font-bold px-3 py-1.5 rounded hover:bg-indigo-600 hover:text-white transition cursor-pointer">
|
class="text-xs bg-indigo-50 text-indigo-600 font-bold px-3 py-1.5 rounded hover:bg-indigo-600 hover:text-white transition cursor-pointer">
|
||||||
详细 / 修改
|
修改
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<form action="{{ route('admin.users.destroy', $user->id) }}" method="POST"
|
<form action="{{ route('admin.users.destroy', $user->id) }}" method="POST"
|
||||||
|
|||||||
Reference in New Issue
Block a user