advertise_setting.blade.php 4.4 KB

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