invite.blade.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. @extends('user.layouts')
  2. @section('css')
  3. <link href="/assets/global/vendor/bootstrap-table/bootstrap-table.min.css" type="text/css" rel="stylesheet">
  4. @endsection
  5. @section('content')
  6. <div class="page-header">
  7. <h1 class="page-title cyan-600"><i class="icon wb-extension"></i>{{trans('home.invite_code')}}</h1>
  8. <div class="page-content container-fluid">
  9. <x-alert type="info" :message="trans('home.promote_invite_code', ['traffic' => $referral_traffic, 'referral_percent' => $referral_percent * 100])"/>
  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">
  15. <i class="icon wb-plus"></i> {{trans('home.invite_code_make')}}
  16. </h4>
  17. <x-alert type="info" :message="trans('home.invite_code_tips', ['num'=>$num, 'days' => sysConfig('user_invite_days')])"/>
  18. <button type="button" class="btn btn-primary btn-animate btn-animate-side" onclick="makeInvite()" @if(!$num) disabled @endif>
  19. <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
  28. class="icon wb-extension"></i>{{trans('home.invite_code_my_codes')}}
  29. </h4>
  30. <table class="text-md-center" data-toggle="table" 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. @foreach($inviteList as $invite)
  42. <tr>
  43. <td> {{$loop->iteration}} </td>
  44. <td>
  45. <a href="javascript:void(0)" class="mt-clipboard" data-clipboard-action="copy"
  46. data-clipboard-text="{{route('register', ['aff' => Auth::id(), 'code' => $invite->code])}}">{{$invite->code}}</a>
  47. </td>
  48. <td> {{$invite->dateline}} </td>
  49. <td>
  50. {!!$invite->status_label!!}
  51. </td>
  52. {{$invite->status === 1 ? ($invite->invitee->email ?? '【账号已删除】') : ''}}
  53. </tr>
  54. @endforeach
  55. </tbody>
  56. </table>
  57. </div>
  58. <div class="card-footer card-footer-transparent">
  59. <div class="row">
  60. <div class="col-md-4">
  61. {{trans('home.invite_code_summary', ['total' => $inviteList->total()])}}
  62. </div>
  63. <div class="col-md-8">
  64. <nav class="Page navigation float-right">
  65. {{$inviteList->links()}}
  66. </nav>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. @endsection
  76. @section('script')
  77. <script src="/assets/custom/Plugin/clipboardjs/clipboard.min.js" type="text/javascript"></script>
  78. <script src="/assets/global/vendor/bootstrap-table/bootstrap-table.min.js" type="text/javascript"></script>
  79. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js" type="text/javascript"></script>
  80. <script type="text/javascript">
  81. // 生成邀请码
  82. function makeInvite() {
  83. $.ajax({
  84. method: 'POST',
  85. url: '{{route('createInvite')}}',
  86. async: false,
  87. data: {_token: '{{csrf_token()}}'},
  88. dataType: 'json',
  89. success: function(ret) {
  90. swal.fire({title: ret.message, type: 'success', timer: 1000}).then(() => {
  91. if (ret.status === 'success') {
  92. window.location.reload();
  93. }
  94. });
  95. },
  96. });
  97. return false;
  98. }
  99. const clipboard = new ClipboardJS('.mt-clipboard');
  100. clipboard.on('success', function() {
  101. swal.fire({
  102. title: '复制成功',
  103. type: 'success',
  104. timer: 1300,
  105. showConfirmButton: false,
  106. });
  107. });
  108. clipboard.on('error', function() {
  109. swal.fire({
  110. title: '复制失败,请手动复制',
  111. type: 'error',
  112. timer: 1500,
  113. showConfirmButton: false,
  114. });
  115. });
  116. </script>
  117. @endsection