articleList.blade.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. @if($list->isEmpty())
  28. <tr>
  29. <td colspan="6">暂无数据</td>
  30. </tr>
  31. @else
  32. @foreach($list as $vo)
  33. <tr>
  34. <td> {{$vo->id}} </td>
  35. @if ($vo->type == '1')
  36. <td> 文章</td>
  37. @elseif ($vo->type == '2')
  38. <td> 公告</td>
  39. @elseif ($vo->type == '3')
  40. <td> 购买说明</td>
  41. @elseif ($vo->type == '4')
  42. <td> 使用教程</td>
  43. @else
  44. <td> 未知</td>
  45. @endif
  46. <td>
  47. <a href="/article?id={{$vo->id}}" target="_blank"> {{str_limit($vo->title, 80)}} </a>
  48. </td>
  49. <td> {{$vo->sort}} </td>
  50. <td> {{$vo->created_at}} </td>
  51. <td>
  52. <div class="btn-group">
  53. <a href="/admin/editArticle?id={{$vo->id}}&page={{Request::get('page', 1)}}" class="btn btn-outline-primary"><i class="icon wb-edit"></i></a>
  54. <button class="btn btn-outline-danger" onclick="delArticle('{{$vo->id}}')"><i class="icon wb-close"></i></button>
  55. </div>
  56. </td>
  57. </tr>
  58. @endforeach
  59. @endif
  60. </tbody>
  61. </table>
  62. </div>
  63. <div class="panel-footer">
  64. <div class="row">
  65. <div class="col-sm-4">
  66. 共 <code>{{$list->total()}}</code> 篇文章
  67. </div>
  68. <div class="col-sm-8">
  69. <nav class="Page navigation float-right">
  70. {{$list->links()}}
  71. </nav>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. @endsection
  78. @section('script')
  79. <script src="/assets/global/vendor/bootstrap-table/bootstrap-table.min.js" type="text/javascript"></script>
  80. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js" type="text/javascript"></script>
  81. <script type="text/javascript">
  82. // 删除文章
  83. function delArticle(id) {
  84. swal.fire({
  85. title: '确定删除文章?',
  86. type: 'question',
  87. showCancelButton: true,
  88. cancelButtonText: '{{trans('home.ticket_close')}}',
  89. confirmButtonText: '{{trans('home.ticket_confirm')}}',
  90. }).then((result) => {
  91. if (result.value) {
  92. $.post("/admin/delArticle", {id: id, _token: '{{csrf_token()}}'}, function (ret) {
  93. if (ret.status === 'success') {
  94. swal.fire({title: ret.message, type: 'success', timer: 1000, showConfirmButton: false})
  95. .then(() => window.location.reload())
  96. } else {
  97. swal.fire({title: ret.message, type: "error"}).then(() => window.location.reload())
  98. }
  99. });
  100. }
  101. });
  102. }
  103. </script>
  104. @endsection