link_url_for_site.blade.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. @extends('admin/site/side_layout')
  2. @section('header_extend')
  3. @endsection
  4. @section('right')
  5. @php $hasEdit=0; @endphp
  6. @hasAuth('sites-links-edit')
  7. @php $hasEdit=1; @endphp
  8. @endHasAuth
  9. <form class="row" id="searchForm">
  10. {{--@if($hasEdit)--}}
  11. {{--<div class="col-md-2">--}}
  12. {{--<div class="input-group">--}}
  13. {{--<span class="input-group-btn">--}}
  14. {{--<button type="button" class="btn btn-md btn-info" onclick="units.importLink()"><span--}}
  15. {{--class="glyphicon glyphicon-hand-up"></span> 导入外链</button>--}}
  16. {{--<button type="button" class="btn btn-md btn-success" style="margin-left: 10px"--}}
  17. {{--onclick="units.save(0)"><span--}}
  18. {{--class="glyphicon glyphicon-hand-down"></span> 添加单个外链</button>--}}
  19. {{--<button type="button" class="btn btn-md btn-warning" onclick="units.delete()"--}}
  20. {{--style="margin-left: 10px"> <span class="glyphicon glyphicon-plus"></span> 删除</button>--}}
  21. {{--</span>--}}
  22. {{--</div>--}}
  23. {{--</div>--}}
  24. {{--@endif--}}
  25. <div class="col-md-6 pull-right">
  26. <div class="input-group">
  27. <input type="text" placeholder="请选择日期范围" class="input-md form-control"
  28. name="date_range"
  29. id="date_range" style="width: 300px;float: right">
  30. <span class="input-group-btn">
  31. <button type="button" class="btn btn-md btn-primary" onclick="units.search()"> 搜索</button>
  32. <button type="button" class="btn btn-md btn-primary" style="margin-left: 10px" name="btnReset"> 重置</button>
  33. <button type="button" class="btn btn-md btn-info" style="margin-left: 10px"
  34. onclick="units.exportExcel()"> 导出</button>
  35. </span>
  36. </div>
  37. </div>
  38. </form>
  39. <hr>
  40. <div class="table-responsive">
  41. <table id="table" class="table table-condensed"
  42. data-mobile-responsive="true"></table>
  43. </div>
  44. @endsection
  45. @section('footer_extend')
  46. <script src="{{asset('js/plugins/layDate-v5.0.9/laydate/laydate.js')}}"></script>
  47. <script>
  48. laydate.render({
  49. elem: '#date_range',
  50. type: 'date',
  51. range: true
  52. });
  53. var units = {
  54. exportExcel: function () {
  55. var date_range = $("#date_range").val();
  56. window.open('/admin/link/sites/{{$siteId}}/link-url/export?date_range=' + date_range);
  57. },
  58. search: function () {
  59. tips.selectPage();
  60. },
  61. importLink: function () {
  62. var str = '<div class="ibox-content" id="importLayer">' +
  63. '<form class="form-horizontal">' +
  64. '<div class="form-group">' +
  65. '<label class="col-sm-3 control-label">请选择excel文件:</label>' +
  66. '<div class="col-sm-6">' +
  67. '<input type="file" id="excel_file" class="form-control">' +
  68. '<input type="hidden" id="excel_path">' +
  69. '</div>' +
  70. '<div class="col-sm-2"><button class="btn btn-info" type="button" onclick="units.fileUpload()">上传</button></div>' +
  71. '</div>' +
  72. ' <div class="form-group">' +
  73. '<div class="col-sm-6 col-sm-offset-3">' +
  74. '<a href="{{asset('tpl/link_tpl.xlsx')}}">请下载导入模板</a>' +
  75. '</div>' +
  76. '</div>' +
  77. '</form>' +
  78. '</div>';
  79. var openIndex = layer.open({
  80. type: 1,
  81. content: str,
  82. area: ['60%', '40%'],
  83. btn: ['导入', '取消'],
  84. title: '导入外链',
  85. yes: function (index, layero) {
  86. var data = {excel_path: $("#excel_path").val(), siteId: "{{$siteId}}"};
  87. var config = {
  88. url: '/admin/link/import/{{$siteId}}',
  89. type: 'post',
  90. data: data,
  91. success: function (result) {
  92. layer.msg(result.message, {icon: 6, time: 1500}, function () {
  93. layer.close(openIndex);
  94. tips.tableRefresh();
  95. });
  96. }
  97. };
  98. tips.ajax(config);
  99. }
  100. });
  101. },
  102. fileUpload: function () {
  103. var config = {
  104. url: '/admin/tool/excel-upload'
  105. };
  106. config.success = function (result) {
  107. $("#excel_path").val(result.data.file_url);
  108. layer.msg(result.message, {icon: 6, time: 1500});
  109. };
  110. tips.fileUpload($("#excel_file"), config);
  111. },
  112. getIdsBySelections: function () {
  113. var selections = $("#table").bootstrapTable('getSelections');
  114. var ids = [];
  115. $.each(selections, function (inx, val) {
  116. ids.push(val.id);
  117. });
  118. return ids;
  119. },
  120. delete: function () {
  121. var ids = units.getIdsBySelections();
  122. if (ids.length === 0) {
  123. layer.alert('请先选择您所要操作的对象', {icon: 0});
  124. return;
  125. }
  126. layer.confirm('您确定要删除吗?', {icon: 3, title: '删除信息'}, function () {
  127. tips.ajax({url: '/admin/link/link-detail', type: 'delete', data: {ids: ids}});
  128. tips.tableRefresh('#table');
  129. });
  130. },
  131. save: function (id) {
  132. layer.open({
  133. type: 2,
  134. content: ['/admin/link/link-count/' + id + '?siteId={{$siteId}}'],
  135. area: ['60%', '70%'],
  136. title: '保存'
  137. });
  138. }
  139. // detail: function (id) {
  140. // layer.open({
  141. // type: 2,
  142. // content: ['/admin/link/task/' + id],
  143. // area: ['90%', '100%'],
  144. // title: '',
  145. // closeBtn: 0
  146. // });
  147. // },
  148. };
  149. var config = {};
  150. config.url = '/admin/link/sites/{{$siteId}}/link-url';
  151. config.columns = [ //字段
  152. // {checkbox: true},
  153. {
  154. title: '序号', align: 'center', formatter: function (value, item, index) {
  155. return index + 1;
  156. }
  157. },
  158. {title: '平台链接', field: 'link_url', align: 'center'},
  159. {title: '用户名', field: 'detail_username', align: 'center'},
  160. {title: '邮箱', field: 'detail_email', align: 'center'},
  161. {title: '密码', field: 'detail_password', align: 'center'},
  162. {title: 'profile演示地址', field: 'profile_url', align: 'center'},
  163. {title: '外链地址', field: 'url', align: 'center', width: '200px'},
  164. {title: '创建时间', field: 'created_at', align: 'center'},
  165. {{--{--}}
  166. {{--title: '操作', field: 'id', align: 'center',--}}
  167. {{--formatter: function (value, row) {--}}
  168. {{--var str = '';--}}
  169. {{--@if($hasEdit)--}}
  170. {{--str += '<button onclick="units.save(' + value + ')" class="btn btn-xs"><span class="glyphicon glyphicon-edit"></span>编辑</button>';--}}
  171. {{--@endif--}}
  172. {{--return str;--}}
  173. {{--}--}}
  174. {{--}--}}
  175. ];
  176. tips.bootstrapTable(config);
  177. </script>
  178. @endsection