diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index c84e7286..5115c09c 100644 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -174,10 +174,8 @@ class AdminController extends Controller return Arr::get($permissionTextMap, $user->permission); }) ->setRowId('uid') - ->editColumn('score', function ($user) { - return ''; - }) - ->addColumn('operations', 'vendor.admin-operations.users') + ->editColumn('score', 'vendor.admin-operations.users.score') + ->addColumn('operations', 'vendor.admin-operations.users.operations') ->make(true); } @@ -189,26 +187,18 @@ class AdminController extends Controller */ public function players(Request $request) { - $page = $request->input('page', 1); - $filter = $request->input('filter', ''); - $q = $request->input('q', ''); + return view('admin.players'); + } - if ($filter == "") { - $players = Player::orderBy('uid'); - } elseif ($filter == "player_name") { - $players = Player::like('player_name', $q)->orderBy('uid'); - } elseif ($filter == "uid") { - $players = Player::where('uid', $q)->orderBy('uid'); - } + public function getPlayerData() + { + $players = Player::select(['pid', 'uid', 'player_name', 'preference', 'tid_steve', 'tid_alex', 'tid_cape', 'last_modified']); - $total_pages = ceil($players->count() / 30); - $players = $players->skip(($page - 1) * 30)->take(30)->get(); - - return view('admin.players')->with('players', $players) - ->with('filter', $filter) - ->with('q', $q) - ->with('page', $page) - ->with('total_pages', $total_pages); + return Datatables::of($players)->editColumn('preference', 'vendor.admin-operations.players.preference') + ->setRowId('pid') + ->addColumn('previews', 'vendor.admin-operations.players.previews') + ->addColumn('operations', 'vendor.admin-operations.players.operations') + ->make(true); } /** diff --git a/app/Http/Routes/web.php b/app/Http/Routes/web.php index 532302b7..3b6c0f1d 100644 --- a/app/Http/Routes/web.php +++ b/app/Http/Routes/web.php @@ -96,19 +96,21 @@ Route::group(['prefix' => 'skinlib'], function () */ Route::group(['middleware' => 'admin', 'prefix' => 'admin'], function () { - Route::get('/', 'AdminController@index'); + Route::get('/', 'AdminController@index'); - Route::any('/customize', 'AdminController@customize'); - Route::any('/score', 'AdminController@score'); - Route::any('/options', 'AdminController@options'); + Route::any('/customize', 'AdminController@customize'); + Route::any('/score', 'AdminController@score'); + Route::any('/options', 'AdminController@options'); - Route::get('/users', 'AdminController@users'); - Route::get('/user-data', 'AdminController@getUserData'); + Route::get('/users', 'AdminController@users'); + Route::get('/user-data', 'AdminController@getUserData'); + + Route::get('/players', 'AdminController@players'); + Route::get('/player-data', 'AdminController@getPlayerData'); - Route::get('/players', 'AdminController@players'); // ajax handlers - Route::post('/users', 'AdminController@userAjaxHandler'); - Route::post('/players', 'AdminController@playerAjaxHandler'); + Route::post('/users', 'AdminController@userAjaxHandler'); + Route::post('/players', 'AdminController@playerAjaxHandler'); Route::group(['prefix' => 'plugins'], function () { Route::any('/manage', 'PluginController@manage'); diff --git a/resources/views/admin/players.tpl b/resources/views/admin/players.tpl index 2e0ccd4c..b76de9fa 100644 --- a/resources/views/admin/players.tpl +++ b/resources/views/admin/players.tpl @@ -9,32 +9,20 @@

- @if (isset($_GET['q'])) - 搜索结果:{{ $_GET['q'] }} - @else {{ trans('general.player-manage') }} - @endif Player Management - -
- - -

-
- +
+
- + @@ -42,104 +30,8 @@ - - - @forelse($players as $player) - - - - - - - - - - - @empty - - - - - - @endforelse -
PID拥有者 UID拥有者 角色名 优先模型 预览材质操作
{{ $player->pid }}{{ $player->uid }}{{ $player->player_name }} - - - @if ($player->tid_steve == '0') - - @else - - - - @endif - - @if ($player->tid_alex == '0') - - @else - - - - @endif - - @if ($player->tid_cape == '0') - - @else - - - - @endif - {{ $player->last_modified }} -
- - -
- - 删除角色 -
0无结果(´・ω・`)
-
@@ -147,20 +39,31 @@ @endsection -@section('style') - -@endsection - @section('script') @endsection diff --git a/resources/views/admin/users.tpl b/resources/views/admin/users.tpl index ab69cefe..f5489c44 100644 --- a/resources/views/admin/users.tpl +++ b/resources/views/admin/users.tpl @@ -21,7 +21,6 @@ - {{-- --}} @@ -53,22 +52,11 @@ $('#user-table').DataTable({ serverSide: true, ajax: '{{ url("admin/user-data") }}', createdRow: function (row, data, index) { - $('td', row).eq(2).attr('id', 'email'); - $('td', row).eq(3).attr('id', 'nickname'); - $('td', row).eq(5).attr('id', 'permission'); + $('td', row).eq(1).attr('id', 'email'); + $('td', row).eq(2).attr('id', 'nickname'); + $('td', row).eq(4).attr('id', 'permission'); }, - // columnDefs: [{ - // targets: 0, - // searchable: false, - // orderable: false, - // width: '1%', - // className: 'dt-body-center', - // render: function (data, type, full, meta){ - // return ''; - // } - // }], columns: [ - // {data: 0}, {data: 'uid', 'width': '1%'}, {data: 'email'}, {data: 'nickname'}, diff --git a/resources/views/vendor/admin-operations/players/operations.tpl b/resources/views/vendor/admin-operations/players/operations.tpl new file mode 100644 index 00000000..63c285c2 --- /dev/null +++ b/resources/views/vendor/admin-operations/players/operations.tpl @@ -0,0 +1,11 @@ +
+ + +
+ +删除角色 diff --git a/resources/views/vendor/admin-operations/players/preference.tpl b/resources/views/vendor/admin-operations/players/preference.tpl new file mode 100644 index 00000000..a5330e12 --- /dev/null +++ b/resources/views/vendor/admin-operations/players/preference.tpl @@ -0,0 +1,4 @@ + diff --git a/resources/views/vendor/admin-operations/players/previews.tpl b/resources/views/vendor/admin-operations/players/previews.tpl new file mode 100644 index 00000000..20f132ce --- /dev/null +++ b/resources/views/vendor/admin-operations/players/previews.tpl @@ -0,0 +1,23 @@ +@if ($tid_steve == '0') + +@else + + + +@endif + +@if ($tid_alex == '0') + +@else + + + +@endif + +@if ($tid_cape == '0') + +@else + + + +@endif diff --git a/resources/views/vendor/admin-operations/users.tpl b/resources/views/vendor/admin-operations/users/operations.tpl similarity index 100% rename from resources/views/vendor/admin-operations/users.tpl rename to resources/views/vendor/admin-operations/users/operations.tpl diff --git a/resources/views/vendor/admin-operations/users/score.tpl b/resources/views/vendor/admin-operations/users/score.tpl new file mode 100644 index 00000000..55ad855b --- /dev/null +++ b/resources/views/vendor/admin-operations/users/score.tpl @@ -0,0 +1 @@ +
UID 邮箱 昵称