index.blade.php 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. @extends('admin/layout')
  2. @section('header')
  3. <link rel="stylesheet"
  4. href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/css/bootstrap-select.min.css">
  5. <style>
  6. .btn-danger, .btn-primary, .btn-info {
  7. background: #009688 !important;
  8. border-color: #009688 !important;
  9. }
  10. .table-striped > tbody > tr:nth-of-type(odd) {
  11. background: #f8f8f8 !important;
  12. }
  13. .table-striped > tbody > tr .btn {
  14. background: none !important;
  15. }
  16. .table-striped > tbody > tr td {
  17. font-size: 14px !important;
  18. }
  19. .table-striped > tbody > tr:hover {
  20. background: #ffebd8 !important;
  21. }
  22. .table-striped > tbody > tr:hover .btn {
  23. background: #009688 !important;
  24. color: #fff !important;
  25. }
  26. .table-striped > tbody > tr:hover .btn .glyphicon {
  27. color: #fff !important;
  28. }
  29. </style>
  30. @endsection
  31. @section('content')
  32. <body class="gray-bg">
  33. <div class="wrapper wrapper-content animated fadeInRight">
  34. <div class="row">
  35. <div class="col-sm-12">
  36. <div class="ibox float-e-margins">
  37. <div class="ibox-content">
  38. <form class="row" id="searchForm" onsubmit="units.search();return false;">
  39. <div class="col-md-4">
  40. <div class="input-group">
  41. <span class="input-group-btn">
  42. <button type="button" class="btn btn-md btn-info" onclick="units.toAuth()">hootsuite授权</button>
  43. </span>
  44. </div>
  45. </div>
  46. <div class="col-md-6 pull-right">
  47. <div class="input-group">
  48. <input type="text" placeholder="请输入邮箱或站点" class="input-md form-control"
  49. name="keyword"
  50. id="keyWord" style="width: 300px;float: right">
  51. <span class="input-group-btn">
  52. <button type="button" class="btn btn-md btn-primary"
  53. onclick="units.search()"> 搜索</button>
  54. <button type="reset" class="btn btn-md btn-primary" style="margin-left: 10px"
  55. name="resetBtn"> 重置</button> </span>
  56. </div>
  57. </div>
  58. </form>
  59. <hr>
  60. <div class="table-responsive">
  61. <table id="table" class="table table-condensed" data-mobile-responsive="true"></table>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. {{--<div id="bindSiteHtml" style="display: none">--}}
  68. {{--<div style="padding: 12px">--}}
  69. {{--<select class="my-select"--}}
  70. {{--id="site_ids" name="site_ids" data-live-search="true"--}}
  71. {{--title="请选择站点" autocomplete="off">--}}
  72. {{--<option value="">请选择站点</option>--}}
  73. {{--@foreach ($sites as $item)--}}
  74. {{--<option value="{{$item->id}}"--}}
  75. {{--@if(in_array($item->id,[])) selected @endif>{{$item->cn_title}}</option>--}}
  76. {{--@endforeach--}}
  77. {{--</select>--}}
  78. {{--</div>--}}
  79. {{--</div>--}}
  80. </div>
  81. </body>
  82. @endsection
  83. @section('footer')
  84. <!-- Latest compiled and minified JavaScript -->
  85. <script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/js/bootstrap-select.min.js"></script>
  86. <!-- (Optional) Latest compiled and minified JavaScript translation files -->
  87. {{--<script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/js/i18n/defaults-*.min.js"></script>--}}
  88. <script>
  89. var units = {
  90. toAuth: function () {
  91. window.open('/admin/socials/hootsuite-auth')
  92. },
  93. search: function () {
  94. tips.selectPage();
  95. },
  96. bindSite: function (hootsuiteId) {
  97. var str = ' <div style="padding: 12px">\n' +
  98. ' <select class="my-select form-control" style="z-index:999;"' +
  99. ' name="site_id" data-live-search="true"\n' +
  100. ' title="请选择站点" autocomplete="off">\n' +
  101. ' <option value="">请选择站点</option>\n' +
  102. ' @foreach ($sites as $item)' +
  103. ' <option value="{{$item->id}}"\n' +
  104. ' @if(in_array($item->id,[])) selected @endif>{{$item->cn_title}}</option>\n' +
  105. ' @endforeach' +
  106. ' </select>\n' +
  107. ' </div>';
  108. layer.open({
  109. title: "站点绑定",
  110. type: 1,
  111. content: str,
  112. area: ['500px', '500px'],
  113. zIndex: 99,
  114. success: function () {
  115. $('.my-select').selectpicker();
  116. },
  117. btn: ['确认', '取消'],
  118. yes: function (index, layero) {
  119. var siteId = layero.find("[name=site_id]").val();
  120. if (!siteId) {
  121. layer.alert('请选择要绑定的站点', {icon: 5});
  122. return
  123. }
  124. var ajaxConfig = {
  125. url: '/admin/hootsuite/bind-site',
  126. type: 'put',
  127. data: {hootsuiteId: hootsuiteId, siteId: siteId},
  128. success:function () {
  129. layer.close(index)
  130. $('#table').bootstrapTable('refresh');
  131. }
  132. };
  133. tips.ajax(ajaxConfig);
  134. }
  135. });
  136. }
  137. };
  138. var config = {};
  139. config.url = '/admin/socials';
  140. config.columns = [ //字段
  141. {checkbox: true},
  142. {
  143. title: '序号', align: 'center', formatter: function (value, item, index) {
  144. return index + 1;
  145. }
  146. },
  147. {title: '站点', field: 'site_title', align: 'center'},
  148. {title: '用户名', field: 'full_name', align: 'center'},
  149. {title: '邮箱', field: 'email', align: 'center'},
  150. {title: '创建时间', field: 'created_at', align: 'center'},
  151. {
  152. title: '操作', field: 'id', align: 'center',
  153. formatter: function (value, rows) {
  154. return '<button onclick="units.bindSite(' + value + ')" class="btn btn-xs"><span class="glyphicon glyphicon-edit"></span>站点绑定</button>&nbsp;';
  155. }
  156. }
  157. ];
  158. tips.bootstrapTable(config);
  159. </script>
  160. @endsection