articleList.blade.php 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. @extends('admin.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-content container-fluid">
  7. <div class="panel">
  8. <div class="panel-heading">
  9. <h3 class="panel-title">文章列表</h3>
  10. <div class="panel-actions">
  11. <a href="/admin/addArticle" class="btn btn-primary"><i class="icon wb-plus"></i>添加文章</a>
  12. </div>
  13. </div>
  14. <div class="panel-body">
  15. <table class="text-md-center" data-toggle="table" data-mobile-responsive="true">
  16. <thead class="thead-default">
  17. <tr>
  18. <th> #</th>
  19. <th> 类型</th>
  20. <th> 标题</th>
  21. <th> 排序</th>
  22. <th> 发布日期</th>
  23. <th> 操作</th>
  24. </tr>
  25. </thead>
  26. <tbody>
  27. @foreach($list as $vo)
  28. <tr>
  29. <td> {{$vo->id}} </td>
  30. @if ($vo->type == '1')
  31. <td> 文章</td>
  32. @elseif ($vo->type == '2')
  33. <td> 公告</td>
  34. @elseif ($vo->type == '3')
  35. <td> 购买说明</td>
  36. @elseif ($vo->type == '4')
  37. <td> 使用教程</td>
  38. @else
  39. <td> 未知</td>
  40. @endif
  41. <td>
  42. <a href="/article?id={{$vo->id}}" target="_blank"> {{\Illuminate\Support\Str::limit($vo->title, 80)}} </a>
  43. </td>
  44. <td> {{$vo->sort}} </td>
  45. <td> {{$vo->created_at}} </td>
  46. <td>
  47. <div class="btn-group">
  48. <a href="/admin/editArticle?id={{$vo->id}}&page={{Request::get('page', 1)}}" class="btn btn-outline-primary"><i class="icon wb-edit"></i></a>
  49. <button class="btn btn-outline-danger" onclick="delArticle('{{$vo->id}}')"><i class="icon wb-close"></i></button>
  50. </div>
  51. </td>
  52. </tr>
  53. @endforeach
  54. </tbody>
  55. </table>
  56. </div>
  57. <div class="panel-footer">
  58. <div class="row">
  59. <div class="col-sm-4">
  60. 共 <code>{{$list->total()}}</code> 篇文章
  61. </div>
  62. <div class="col-sm-8">
  63. <nav class="Page navigation float-right">
  64. {{$list->links()}}
  65. </nav>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. @endsection
  72. @section('script')
  73. <script src="/assets/global/vendor/bootstrap-table/bootstrap-table.min.js" type="text/javascript"></script>
  74. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js" type="text/javascript"></script>
  75. <script type="text/javascript">
  76. // 删除文章
  77. function delArticle(id) {
  78. swal.fire({
  79. title: '确定删除文章?',
  80. type: 'question',
  81. showCancelButton: true,
  82. cancelButtonText: '{{trans('home.ticket_close')}}',
  83. confirmButtonText: '{{trans('home.ticket_confirm')}}',
  84. }).then((result) => {
  85. if (result.value) {
  86. $.post("/admin/delArticle", {id: id, _token: '{{csrf_token()}}'}, function (ret) {
  87. if (ret.status === 'success') {
  88. swal.fire({title: ret.message, type: 'success', timer: 1000, showConfirmButton: false})
  89. .then(() => window.location.reload())
  90. } else {
  91. swal.fire({title: ret.message, type: "error"}).then(() => window.location.reload())
  92. }
  93. });
  94. }
  95. });
  96. }
  97. </script>
  98. @endsection