list.blade.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. @extends('statistics.module.layouts.content')
  2. @push('meta')
  3. @endpush
  4. @push('css')
  5. @endpush
  6. @push('js')
  7. <script src="{{ theme_asset('statistics/js/layer/layer.js') }}"></script>
  8. @endpush
  9. @section('content')
  10. <div class="wide container">
  11. @include('statistics.module.section.left_menu')
  12. <div class="cq_rt admin_right">
  13. <div class="detail-info">
  14. <div class="table_title_new" style="margin-bottom: 15px;">管理员列表</div>
  15. <table border="0" cellpadding="0" cellspacing="0">
  16. <tr>
  17. <th style="width: 150px;">ID</th>
  18. <th style="width: 300px;">用户名</th>
  19. <th style="width: 270px;">添加时间</th>
  20. @if(auth('web-statistics')->user()->username == 'admin')
  21. <th style="width: 180px;">操作</th>
  22. @endif
  23. </tr>
  24. @if($list->isNotEmpty())
  25. @foreach($list as $k=>$user)
  26. <tr>
  27. <td>{{$user->id}}</td>
  28. <td>{{$user->username}}</td>
  29. <td>{{$user->created_at}}</td>
  30. @if(auth('web-statistics')->user()->username == 'admin')
  31. <td>
  32. <div class="opera">
  33. <span data-uid="{{$user->id}}" class="edit">修改</span>
  34. @if($user->username != 'admin')
  35. |<span class="del" data-url="{{route('statistics.user.delete', ['id'=>$user->id])}}">删除</span>
  36. @endif
  37. </div>
  38. </td>
  39. @endif
  40. </tr>
  41. @endforeach
  42. @else
  43. <tr>
  44. <td colspan="@if(auth('web-statistics')->user()->username == 'admin') 4 @else 3 @endif" text-aligin="center">暂无数据</td>
  45. </tr>
  46. @endif
  47. </table>
  48. </div>
  49. </div>
  50. <div class="clear"></div>
  51. </div>
  52. @endsection
  53. @section('script')
  54. <script type="text/javascript">
  55. $('.edit').click(function(){
  56. var uid=$(this).attr('data-uid');
  57. $.getJSON("{{route('statistics.user.edit')}}",{uid:uid, _token:"{{csrf_token()}}"},function(result){
  58. if(result.status == 1){
  59. layer.ready(function(){
  60. layer.open({
  61. type: 1,
  62. title: '修改密码',
  63. area: ['360px', '270px'], //宽高
  64. content: result.html
  65. });});
  66. }else{
  67. alert(result.error);
  68. return false;
  69. }
  70. });
  71. });
  72. $('.del').click(function(){
  73. var url=$(this).data('url');
  74. console.log(url);
  75. if (confirm('确定删除该管理员?')) {
  76. $.getJSON(url,{},function(result){
  77. if(result.status == 1){
  78. alert(result.html);
  79. window.location.href = "{{route('statistics.user')}}";
  80. }else{
  81. alert(result.error);
  82. return false;
  83. }
  84. });
  85. }
  86. });
  87. </script>
  88. @endsection