index.blade.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. @extends('base.base')
  2. @section('base')
  3. <div class="main-panel">
  4. <div class="content-wrapper">
  5. <div class="page-header">
  6. <h3 class="page-title">
  7. <span class="page-title-icon bg-gradient-primary text-white mr-2">
  8. <i class="mdi mdi-image-multiple"></i>
  9. </span>
  10. {{ __('auto.Banner管理') }}
  11. </h3>
  12. <nav aria-label="breadcrumb">
  13. <ol class="breadcrumb">
  14. <li class="breadcrumb-item"><a href="#">{{ __('auto.内容管理') }}</a></li>
  15. <li class="breadcrumb-item active" aria-current="page">{{ __('auto.Banner管理') }}</li>
  16. </ol>
  17. </nav>
  18. </div>
  19. <div class="row">
  20. <div class="col-lg-12 grid-margin stretch-card">
  21. <div class="card">
  22. <div class="card-body">
  23. <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;">
  24. <h4 class="card-title">{{ __('auto.Banner列表') }}</h4>
  25. <a href="{{ url('admin/banner/add') }}" class="btn btn-gradient-primary">{{ __('auto.添加Banner') }}</a>
  26. </div>
  27. <!-- 筛选 -->
  28. <form method="GET" action="{{ url('admin/banner') }}" class="mb-3">
  29. <div class="form-row">
  30. <div class="col-md-3">
  31. <select class="form-control" name="theme_key">
  32. <option value="">-- 全部主题 --</option>
  33. @foreach($themes as $theme)
  34. <option value="{{$theme->ThemeKey}}" {{ $theme_key == $theme->ThemeKey ? 'selected' : '' }}>
  35. {{$theme->ThemeKey}}
  36. </option>
  37. @endforeach
  38. </select>
  39. </div>
  40. <div class="col-md-2">
  41. <button type="submit" class="btn btn-primary">{{ __('auto.搜索') }}</button>
  42. </div>
  43. </div>
  44. </form>
  45. <table class="table table-bordered">
  46. <thead>
  47. <tr>
  48. <th>ID</th>
  49. <th>{{ __('auto.图片') }}</th>
  50. <th>Alt</th>
  51. <th>Link Game</th>
  52. <th>Link Module</th>
  53. <th>{{ __('auto.主题KEY') }}</th>
  54. <th>{{ __('auto.操作') }}</th>
  55. </tr>
  56. </thead>
  57. <tbody>
  58. @foreach($list as $v)
  59. <tr>
  60. <td>{{$v->bid}}</td>
  61. <td>
  62. @if($v->img)
  63. <img src="{{$v->img}}" style="max-width: 200px; height: auto;" alt="Banner">
  64. @endif
  65. </td>
  66. <td>{{$v->alt}}</td>
  67. <td>{{$v->link_game}}</td>
  68. <td>{{$v->link_module}}</td>
  69. <td>{{$v->theme_key}}</td>
  70. <td>
  71. <a href="{{ url('admin/banner/edit/'.$v->bid) }}" class="btn btn-sm btn-gradient-info">{{ __('auto.编辑') }}</a>
  72. <button class="btn btn-sm btn-gradient-danger" onclick="deleteBanner({{$v->bid}})">{{ __('auto.删除') }}</button>
  73. </td>
  74. </tr>
  75. @endforeach
  76. </tbody>
  77. </table>
  78. <div class="box-footer clearfix" id="pages">
  79. {{ __('auto.总共') }} <b>{{ $list->total() }}</b> {{ __('auto.条,分为') }}<b>{{ $list->lastPage() }}</b>{{ __('auto.页') }}
  80. {!! $list->links() !!}
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. <script>
  89. function deleteBanner(id) {
  90. if (confirm('确认删除此Banner?')) {
  91. $.ajax({
  92. url: '/admin/banner/delete/' + id,
  93. type: 'POST',
  94. success: function(res) {
  95. if (res.code === 200) {
  96. alert('删除成功');
  97. location.reload();
  98. } else {
  99. alert(res.msg || '删除失败');
  100. }
  101. }
  102. });
  103. }
  104. }
  105. </script>
  106. @endsection