articleList.blade.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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}}"
  43. target="_blank"> {{Str::limit($vo->title, 80)}} </a>
  44. </td>
  45. <td> {{$vo->sort}} </td>
  46. <td> {{$vo->created_at}} </td>
  47. <td>
  48. <div class="btn-group">
  49. <a href="/admin/editArticle?id={{$vo->id}}&page={{Request::get('page', 1)}}"
  50. class="btn btn-outline-primary"><i class="icon wb-edit"></i></a>
  51. <button class="btn btn-outline-danger" onclick="delArticle('{{$vo->id}}')"><i
  52. class="icon wb-close"></i></button>
  53. </div>
  54. </td>
  55. </tr>
  56. @endforeach
  57. </tbody>
  58. </table>
  59. </div>
  60. <div class="panel-footer">
  61. <div class="row">
  62. <div class="col-sm-4">
  63. 共 <code>{{$list->total()}}</code> 篇文章
  64. </div>
  65. <div class="col-sm-8">
  66. <nav class="Page navigation float-right">
  67. {{$list->links()}}
  68. </nav>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. @endsection
  75. @section('script')
  76. <script src="/assets/global/vendor/bootstrap-table/bootstrap-table.min.js" type="text/javascript"></script>
  77. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js"
  78. type="text/javascript"></script>
  79. <script type="text/javascript">
  80. // 删除文章
  81. function delArticle(id) {
  82. swal.fire({
  83. title: '确定删除文章?',
  84. type: 'question',
  85. showCancelButton: true,
  86. cancelButtonText: '{{trans('home.ticket_close')}}',
  87. confirmButtonText: '{{trans('home.ticket_confirm')}}',
  88. }).then((result) => {
  89. if (result.value) {
  90. $.post("/admin/delArticle", {id: id, _token: '{{csrf_token()}}'}, function (ret) {
  91. if (ret.status === 'success') {
  92. swal.fire({title: ret.message, type: 'success', timer: 1000, showConfirmButton: false})
  93. .then(() => window.location.reload())
  94. } else {
  95. swal.fire({title: ret.message, type: "error"}).then(() => window.location.reload())
  96. }
  97. });
  98. }
  99. });
  100. }
  101. </script>
  102. @endsection