game_room_switch.blade.php 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. @extends('base.base')
  2. @section('base')
  3. <!-- 内容区域 -->
  4. <div class="main-panel">
  5. <div class="content-wrapper">
  6. <div class="page-header">
  7. <h3 class="page-title">
  8. <span class="page-title-icon bg-gradient-primary text-white mr-2">
  9. <i class="mdi mdi-settings"></i>
  10. </span>
  11. {{ __('auto.无感维护开关') }}
  12. </h3>
  13. <nav aria-label="breadcrumb">
  14. <ol class="breadcrumb">
  15. <li class="breadcrumb-item"><a href="#">{{ __('auto.无感维护开关') }}</a></li>
  16. <li class="breadcrumb-item active" aria-current="page">{{ __('auto.用户数据') }}</li>
  17. </ol>
  18. </nav>
  19. </div>
  20. <div class="row">
  21. <div class="col-lg-12 grid-margin stretch-card">
  22. <div class="card">
  23. <div class="card-body">
  24. <table class="table table-bordered">
  25. <thead>
  26. <tr>
  27. <th width="6%">
  28. <center>
  29. <button type="button" id="quan" onclick="checkbox()"
  30. class="btn btn-sm btn-gradient-primary btn-icon-text">
  31. {{ __('auto.全选/全不选') }}
  32. </button>
  33. </center>
  34. </th>
  35. <th width="10%">{{ __('auto.游戏房间名称') }}</th>
  36. <th width="4%">{{ __('auto.状态') }}</th>
  37. <th width="6%">{{ __('auto.当前房间人数') }}</th>
  38. <th width="8%">{{ __('auto.设置') }}</th>
  39. </tr>
  40. </thead>
  41. <tbody>
  42. <button class="btn btn-sm btn-gradient-dark" onclick="switch_more('on')">{{ __('auto.批量开启') }}</button> &nbsp;&nbsp;&nbsp;
  43. <button class="btn btn-sm btn-gradient-dark" onclick="switch_more('off')">{{ __('auto.批量关闭') }}</button>
  44. @foreach($list as $k=>$v)
  45. <tr>
  46. <td>
  47. <input class="form-control" type="checkbox" name="checkbox"
  48. id="{{$v->ServerID}}" value="">
  49. </td>
  50. <td>{{$v->ServerName}}</td>
  51. <td>
  52. @if ($v->Nullity == 1)
  53. {{ __('auto.关闭') }}
  54. @else
  55. {{ __('auto.开启') }}
  56. @endif
  57. </td>
  58. <td>{{$v->game_count}}</td>
  59. <td>
  60. @if ($v->Nullity == 1)
  61. <button type="button" class="btn btn-sm btn-success btn-icon-text"
  62. onclick="update({{$v->ServerID}},'on')">
  63. {{ __('auto.开启') }}
  64. </button>
  65. @else
  66. <button type="button" class="btn btn-sm btn-danger btn-icon-text"
  67. onclick="update({{$v->ServerID}},'off')">
  68. {{ __('auto.关闭') }}
  69. </button>
  70. @endif
  71. <button type="button" class="btn btn-sm btn-facebook btn-icon-text"
  72. onclick="show({{$v->ServerID}})">
  73. {{ __('auto.查配置') }}
  74. </button>
  75. </td>
  76. </tr>
  77. @endforeach
  78. </tbody>
  79. </table>
  80. @empty($list)
  81. <td>{{ __('auto.暂无数据') }}</td>
  82. @endempty
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. <script>
  90. function switch_more(type) {
  91. var num = document.getElementsByName('checkbox');
  92. var serverID = '';
  93. for (var i = 0; i < num.length; i++) {
  94. if (num[i].checked) {
  95. serverID = serverID + num[i].id + ',';
  96. }
  97. }
  98. if (serverID == '') {
  99. layer.msg('{{ __('auto.请选择要操作的数据') }}');
  100. return false;
  101. }
  102. myConfirm("{{ __('auto.删除操作不可逆,是否继续') }}?", function () {
  103. myRequest("/admin/global/game_room_switch", "post", {serverID, type}, function (res) {
  104. layer.msg(res.msg)
  105. setTimeout(function () {
  106. window.location.reload();
  107. }, 1500)
  108. });
  109. });
  110. }
  111. function checkbox() {
  112. var num = document.getElementsByName('checkbox');
  113. for (var i = 0; i < num.length; i++) {
  114. if (num[i].checked) {
  115. num[i].checked = false;
  116. } else {
  117. num[i].checked = true;
  118. }
  119. }
  120. }
  121. function update(serverID, type) {
  122. myConfirm("{{ __('auto.是否继续') }}?", function () {
  123. myRequest("/admin/global/game_room_switch", "post", {serverID, type}, function (res) {
  124. layer.msg(res.msg)
  125. setTimeout(function () {
  126. window.location.reload();
  127. }, 1500)
  128. });
  129. });
  130. }
  131. function show(value) {
  132. var page = layer.open({
  133. type: 2,
  134. title: '{{ __('auto.查看配置') }}',
  135. shadeClose: true,
  136. shade: 0.8,
  137. area: ['50%', '60%'],
  138. content: '/admin/global/show_config/' + value
  139. });
  140. }
  141. </script>
  142. @endsection