advertise.blade.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. @extends('admin/site/side_layout')
  2. @section('header_extend')
  3. @endsection
  4. @section('right')
  5. <div class="col-md-2">
  6. <div class="input-group">
  7. <span class="input-group-btn">
  8. <button type="button" class="btn btn-md btn-success" onclick="units.add(0,'{{$siteId}}')"
  9. style="margin-left: 10px;"><span class="glyphicon glyphicon-plus"></span> 添加</button>
  10. <button type="button" class="btn btn-md btn-danger" onclick="units.del()"
  11. style="margin-left: 10px"><span class="glyphicon glyphicon-remove"></span> 删除</button>
  12. </span>
  13. </div>
  14. </div>
  15. <body class="gray-bg">
  16. <div class="wrapper wrapper-content animated fadeInRight">
  17. <div class="row">
  18. <div class="col-sm-12">
  19. <div class="ibox float-e-margins">
  20. <div class="table-responsive">
  21. <table id="table" class="table table-condensed" data-mobile-responsive="true"></table>
  22. </div>
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. </body>
  28. @endsection
  29. @section('footer_extend')
  30. <script>
  31. var units = {
  32. del: function () {
  33. var ids = units.getIdsBySelections();
  34. if (ids.length === 0) {
  35. layer.alert('请先选择您所要操作的对象', {icon: 0});
  36. return;
  37. }
  38. layer.confirm('确定删除?', {icon: 3, title: '是否删除'}, function (index, layero) {
  39. layer.close(index);
  40. tips.ajax({
  41. url: '/admin/advertise/delete-row/1',
  42. type: 'post',
  43. data: {ids: ids},
  44. tableRefresh: '#table'
  45. });
  46. });
  47. },
  48. add: function (id, siteId) {
  49. layer.open({
  50. type: 2,
  51. content: ['/admin/advertise/advertise-edit/' + id + '/' + siteId],
  52. area: ['80%', '80%'],
  53. title: '编辑'
  54. });
  55. },
  56. save: function (id, siteId) {
  57. layer.open({
  58. type: 2,
  59. content: ['/admin/advertise/advertise-edit/' + id + '/' + siteId],
  60. area: ['80%', '80%'],
  61. title: '编辑'
  62. });
  63. },
  64. setting: function (id, siteId) {
  65. layer.open({
  66. type: 2,
  67. content: ['/admin/advertise/setting/' + id + '/' + siteId],
  68. area: ['100%', '100%'],
  69. title: '设置'
  70. });
  71. },
  72. getIdsBySelections: function () {
  73. var selections = $("#table").bootstrapTable('getSelections');
  74. var ids = [];
  75. $.each(selections, function (inx, val) {
  76. ids.push(val.id);
  77. });
  78. return ids;
  79. }
  80. };
  81. var config = {};
  82. config.url = '/admin/advertise/index/{{$siteId}}';
  83. config.pageSize = 20;
  84. config.showColumns = true;
  85. config.columns = [ //字段
  86. {checkbox: true},
  87. {
  88. title: '序号', align: 'center', formatter: function (value, item, index) {
  89. return index + 1;
  90. },
  91. width: '10px'
  92. },
  93. {title: '广告代码', field: 'code', align: 'center', width: '120px'},
  94. {title: '广告位名称', field: 'name', align: 'center'},
  95. {title: '尺寸', field: 'size', align: 'center'},
  96. {title: '创建时间', field: 'date', align: 'center'},
  97. {
  98. title: '操作', field: 'id', align: 'center',
  99. formatter: function (value, row) {
  100. return '<button onclick="units.save(' + row.id + ',' + "{{$siteId}}" + ')" class="btn btn-xs"><span class="glyphicon glyphicon-menu-hamburger"></span>编辑</button>&nbsp;' +
  101. '<button onclick="units.setting(' + row.id + ',' + "{{$siteId}}" + ')" class="btn btn-xs"><span class="glyphicon glyphicon-menu-hamburger"></span>设置</button>';
  102. }
  103. }
  104. ];
  105. tips.bootstrapTable(config);
  106. </script>
  107. @endsection