tool.blade.php 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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/tool-update/0'],
  38. area: ['60%', '100%'],
  39. title: '添加'
  40. });
  41. },
  42. update: function (id) {
  43. layer.open({
  44. type: 2,
  45. content: ['/admin/classroom/tool-update/' + id],
  46. area: ['60%', '100%'],
  47. title: '编辑'
  48. });
  49. },
  50. del: function (id) {
  51. tips.ajax({
  52. url: ['/admin/classroom/tool-delete/' + id],
  53. type: 'get'
  54. });
  55. window.location.reload();
  56. },
  57. };
  58. var config = {};
  59. config.url = '/admin/classroom/tool';
  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: 'content', 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: 'created_at', align: 'center', width: '100px'},
  75. {
  76. title: '操作', field: 'id', align: 'center',
  77. formatter: function (value, rows) {
  78. var str = '<button onclick="units.update(' + rows.id + ')" class="btn btn-xs"><span class="glyphicon glyphicon-edit"></span>编辑</button>&nbsp;';
  79. str += '<button onclick="units.del(' + rows.id + ')" class="btn btn-xs"><span class="glyphicon glyphicon-edit"></span>删除</button>&nbsp;';
  80. return str;
  81. }
  82. }
  83. ];
  84. tips.bootstrapTable(config);
  85. </script>
  86. @endsection