invite.blade.php 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. @extends('user.layouts')
  2. @section('content')
  3. <div class="page-header">
  4. <h1 class="page-title cyan-600"><i class="icon wb-extension"></i>{{trans('home.invite_code')}}</h1>
  5. <div class="page-content container-fluid">
  6. <div class="alert alert-info" role="alert">
  7. <button class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
  8. {!! trans('home.promote_invite_code', ['traffic' => $referral_traffic, 'referral_percent' => $referral_percent * 100]) !!}
  9. </div>
  10. <div class="row">
  11. <div class="col-xxl-3 col-lg-4">
  12. <div class="card">
  13. <div class="card-block">
  14. <h4 class="card-title cyan-600"><i class="icon wb-plus"></i> {{trans('home.invite_code_make')}}
  15. </h4>
  16. <p class="card-text alert alert-info">
  17. <i class="icon wb-warning red-700"></i> {{trans('home.invite_code_tips1')}} <strong> {{$num}} </strong> {{trans('home.invite_code_tips2', ['days' => \App\Components\Helpers::systemConfig()['user_invite_days']])}}
  18. </p>
  19. <button type="button" class="btn btn-primary btn-animate btn-animate-side" onclick="makeInvite()" @if(!$num) disabled @endif><i class="icon wb-plus"></i> {{trans('home.invite_code_button')}}
  20. </button>
  21. </div>
  22. </div>
  23. </div>
  24. <div class="col-xxl-9 col-lg-8">
  25. <div class="card">
  26. <div class="card-block">
  27. <h4 class="card-title cyan-600"><i class="icon wb-extension"></i>{{trans('home.invite_code_my_codes')}}
  28. </h4>
  29. <div class="table-responsive">
  30. <table class="table text-center" data-mobile-responsive="true">
  31. <thead class="thead-default">
  32. <tr>
  33. <th data-cell-style="cellStyle"> #</th>
  34. <th> {{trans('home.invite_code_table_name')}} </th>
  35. <th> {{trans('home.invite_code_table_date')}} </th>
  36. <th> {{trans('home.invite_code_table_status')}} </th>
  37. <th> {{trans('home.invite_code_table_user')}} </th>
  38. </tr>
  39. </thead>
  40. <tbody>
  41. @if($inviteList->isEmpty())
  42. <tr>
  43. <td colspan="5">{{trans('home.invite_code_table_none_codes')}}</td>
  44. </tr>
  45. @else
  46. @foreach($inviteList as $invite)
  47. <tr>
  48. <td> {{$loop->iteration}} </td>
  49. <td>
  50. <a href="/register?aff={{Auth::user()->id}}&code={{$invite->code}}" target="_blank">{{$invite->code}}</a>
  51. </td>
  52. <td> {{$invite->dateline}} </td>
  53. <td>
  54. @if($invite->status == '0')
  55. <span class="badge badge-success">{{trans('home.invite_code_table_status_un')}}</span>
  56. @elseif($invite->status == '1')
  57. <span class="badge badge-danger">{{trans('home.invite_code_table_status_yes')}}</span>
  58. @else
  59. <span class="badge badge-default">{{trans('home.invite_code_table_status_expire')}}</span>
  60. @endif
  61. </td>
  62. @if($invite->status == '1')
  63. <td> {{empty($invite->user) ? ($invite->status == 1 ? '【账号已删除】' : '') : $invite->user->username}} </td>
  64. @else
  65. <td></td>
  66. @endif
  67. </tr>
  68. @endforeach
  69. @endif
  70. </tbody>
  71. </table>
  72. </div>
  73. <div class="row">
  74. <div class="col-md-4">
  75. {{trans('home.invite_code_summary', ['total' => $inviteList->total()])}}
  76. </div>
  77. <div class="col-md-8">
  78. <nav class="Page navigation float-right">
  79. {{$inviteList->links()}}
  80. </nav>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. @endsection
  90. @section('script')
  91. <script type="text/javascript">
  92. // 生成邀请码
  93. function makeInvite() {
  94. const _token = '{{csrf_token()}}';
  95. $.ajax({
  96. type: "POST",
  97. url: "/makeInvite",
  98. async: false,
  99. data: {_token: _token},
  100. dataType: 'json',
  101. success: function (ret) {
  102. swal.fire({title: ret.message, timer: 1000})
  103. .then(() => {
  104. if (ret.status === 'success') {
  105. window.location.reload();
  106. }
  107. });
  108. }
  109. });
  110. return false;
  111. }
  112. </script>
  113. @endsection