inviteList.blade.php 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. @extends('admin.layouts')
  2. @section('css')
  3. <link rel="stylesheet" href="/assets/global/vendor/bootstrap-table/bootstrap-table.min.css">
  4. @endsection
  5. @section('content')
  6. <div class="page-content container-fluid">
  7. <div class="row">
  8. <div class="col-md-4">
  9. <div class="card">
  10. <div class="card-block">
  11. <h4 class="card-title cyan-600"><i class="icon wb-plus"></i> {{trans('home.invite_code_make')}}
  12. </h4>
  13. <p class="card-text alert alert-info">
  14. <i class="icon wb-warning red-700"></i> {{trans('home.invite_code_tips1')}}
  15. <strong> 10 </strong> {{trans('home.invite_code_tips2', ['days' => \App\Components\Helpers::systemConfig()['user_invite_days']])}}
  16. </p>
  17. <button type="button" class="btn btn-primary btn-animate btn-animate-side" onclick="makeInvite()"><i class="icon wb-plus"></i> {{trans('home.invite_code_button')}}
  18. </button>
  19. </div>
  20. </div>
  21. </div>
  22. <div class="col-md-8">
  23. <div class="panel">
  24. <div class="panel-heading">
  25. <h4 class="panel-title cyan-600"><i class="icon wb-extension"></i>{{trans('home.invite_code_my_codes')}}
  26. </h4>
  27. <div class="panel-actions">
  28. <button class="btn btn-primary" onclick="exportInvite()">批量导出</button>
  29. </div>
  30. </div>
  31. <div class="panel-body">
  32. <table class="text-center" data-toggle="table" data-mobile-responsive="true">
  33. <thead class="thead-default">
  34. <tr>
  35. <th> #</th>
  36. <th> {{trans('home.invite_code_table_name')}} </th>
  37. <th> {{trans('home.invite_code_table_date')}} </th>
  38. <th> 生成者</th>
  39. <th> {{trans('home.invite_code_table_status')}} </th>
  40. <th> {{trans('home.invite_code_table_user')}} </th>
  41. </tr>
  42. </thead>
  43. <tbody>
  44. @if($inviteList->isEmpty())
  45. <tr>
  46. <td colspan="6">{{trans('home.invite_code_table_none_codes')}}</td>
  47. </tr>
  48. @else
  49. @foreach($inviteList as $invite)
  50. <tr>
  51. <td> {{$invite->id}} </td>
  52. <td>
  53. <a href="/register?code={{$invite->code}}" target="_blank">{{$invite->code}}</a>
  54. </td>
  55. <td> {{$invite->dateline}} </td>
  56. <td>
  57. @if($invite->uid == '0')
  58. 系统生成
  59. @else
  60. {{empty($invite->generator) ? '【账号已删除】' : $invite->generator->username}}
  61. @endif
  62. </td>
  63. <td>
  64. @if($invite->status == '0')
  65. <span class="badge badge-success">{{trans('home.invite_code_table_status_un')}}</span>
  66. @elseif($invite->status == '1')
  67. <span class="badge badge-danger">{{trans('home.invite_code_table_status_yes')}}</span>
  68. @else
  69. <span class="badge badge-default">{{trans('home.invite_code_table_status_expire')}}</span>
  70. @endif
  71. </td>
  72. @if($invite->status == '1')
  73. <td> {{empty($invite->user) ? '【账号已删除】' : $invite->user->username}} </td>
  74. @else
  75. <td></td>
  76. @endif
  77. </tr>
  78. @endforeach
  79. @endif
  80. </tbody>
  81. </table>
  82. </div>
  83. <div class="panel-footer">
  84. <div class="row">
  85. <div class="col-md-4">
  86. {{trans('home.invite_code_summary', ['total' => $inviteList->total()])}}
  87. </div>
  88. <div class="col-md-8">
  89. <nav class="Page navigation float-right">
  90. {{ $inviteList->links() }}
  91. </nav>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. @endsection
  100. @section('script')
  101. <script src="/assets/global/vendor/bootstrap-table/bootstrap-table.min.js"></script>
  102. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js"></script>
  103. <script type="text/javascript">
  104. // 生成邀请码
  105. function makeInvite() {
  106. $.ajax({
  107. type: "POST",
  108. url: "/admin/makeInvite",
  109. async: false,
  110. data: {_token: '{{csrf_token()}}'},
  111. dataType: 'json',
  112. success: function (ret) {
  113. if (ret.status === 'success') {
  114. swal.fire({title: ret.message, type: 'success', timer: 1000, showConfirmButton: false})
  115. .then(() => window.location.reload())
  116. } else {
  117. swal.fire({title: ret.message, type: "error"}).then(() => window.location.reload())
  118. }
  119. }
  120. });
  121. return false;
  122. }
  123. // 导出邀请码
  124. function exportInvite() {
  125. swal.fire({
  126. title: '提示',
  127. text: '确定导出所有邀请码吗',
  128. type: 'question',
  129. showCancelButton: true,
  130. cancelButtonText: '{{trans('home.ticket_close')}}',
  131. confirmButtonText: '{{trans('home.ticket_confirm')}}',
  132. }).then((result) => {
  133. if (result.value) {
  134. window.location.href = '/admin/exportInvite';
  135. }
  136. });
  137. }
  138. </script>
  139. @endsection