video.blade.php 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. @extends('admin/layout')
  2. @section('content')
  3. <body class="gray-bg">
  4. <div class="wrapper wrapper-content animated fadeInRight">
  5. <div class="row">
  6. <div class="col-sm-12">
  7. <div class="ibox float-e-margins">
  8. {{--<div class="ibox-title"></div>--}}
  9. <div class="ibox-content">
  10. <div class="input-group">
  11. <button type="button" class="btn btn-md btn-primary"
  12. style="margin-left: 10px"
  13. onclick="units.add(0)"> <span
  14. class="glyphicon glyphicon-plus"></span> 添加
  15. </button>
  16. </div>
  17. <hr>
  18. <div class="table-responsive">
  19. <table id="table" class="table table-condensed" data-mobile-responsive="true"></table>
  20. </div>
  21. </div>
  22. </div>
  23. </div>
  24. </div>
  25. </div>
  26. </body>
  27. @endsection
  28. @section('footer')
  29. <script>
  30. var units = {
  31. search: function () {
  32. tips.selectPage();
  33. },
  34. add: function () {
  35. layer.open({
  36. type: 2,
  37. content: ['/admin/classroom/video-update/0'],
  38. area: ['60%', '100%'],
  39. title: '添加'
  40. });
  41. },
  42. update: function (id) {
  43. layer.open({
  44. type: 2,
  45. content: ['/admin/classroom/video-update/' + id],
  46. area: ['60%', '100%'],
  47. title: '编辑'
  48. });
  49. },
  50. del: function (id) {
  51. tips.ajax({
  52. url: ['/admin/classroom/video-delete/' + id],
  53. type: 'get'
  54. });
  55. window.location.reload();
  56. },
  57. };
  58. var config = {};
  59. config.url = '/admin/classroom/video';
  60. config.columns = [ //字段
  61. {
  62. title: '序号', align: 'center', formatter: function (value, item, index) {
  63. return index + 1;
  64. },
  65. width: '20px'
  66. },
  67. {title: '标题', field: 'title', align: 'center', width: '200px'},
  68. {title: '发布者', field: 'user', align: 'center', width: '300px'},
  69. {
  70. title: '图片', field: 'image', align: 'center', formatter: function (value, item) {
  71. return '<img src="' + value + '" style="width:80px">';
  72. }
  73. },
  74. {title: '视频链接', field: 'video', align: 'center', width: '100px'},
  75. {title: '创建时间', field: 'created_at', align: 'center', width: '100px'},
  76. {
  77. title: '操作', field: 'id', align: 'center',
  78. formatter: function (value, rows) {
  79. var str = '<button onclick="units.update(' + rows.id + ')" class="btn btn-xs"><span class="glyphicon glyphicon-edit"></span>编辑</button>&nbsp;';
  80. str += '<button onclick="units.del(' + rows.id + ')" class="btn btn-xs"><span class="glyphicon glyphicon-edit"></span>删除</button>&nbsp;';
  81. return str;
  82. }
  83. }
  84. ];
  85. tips.bootstrapTable(config);
  86. </script>
  87. @endsection