case.blade.php 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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-content">
  9. <form class="row" id="searchForm" onsubmit="units.search();return false;">
  10. <div class="col-md-2">
  11. <div class="input-group">
  12. <span class="input-group-btn">
  13. <button type="button" class="btn btn-md btn-primary" onclick="units.save(0)"
  14. style="margin-left: 10px;border-radius:2px;"> <span class="glyphicon glyphicon-plus"></span> 添加</button>
  15. <button type="button" class="btn btn-md btn-danger" onclick="units.delete()"
  16. style="margin-left: 10px;border-radius:2px;"><span
  17. class="glyphicon glyphicon-remove"></span> 删除</button>
  18. <button type="button" class="btn btn-md btn-primary"
  19. onclick="units.import()" style="margin-left: 10px;border-radius:2px;">
  20. 导入外链
  21. </button>
  22. </span>
  23. </div>
  24. </div>
  25. <div class="col-md-7 pull-right">
  26. <div class="input-group">
  27. <select name="type" id="" class="form-control" title=""
  28. style="width: 150px;float: right">
  29. <option value="">请选择类型</option>
  30. @foreach(\App\Http\Models\LinkCase::TYPES as $key=>$val)
  31. <option value="{{$key}}">{{$val}}</option>
  32. @endforeach
  33. </select>
  34. <input type="text" placeholder="请输入平台链接" class="form-control"
  35. name="keyword"
  36. id="keyword" style="width: 300px;float: right">
  37. <span class="input-group-btn">
  38. <button type="button" class="btn btn-md btn-primary" style="border-radius:2px;"
  39. onclick="units.search()"> 搜索
  40. </button>
  41. <button type="reset" class="btn btn-md btn-primary" style="margin-left: 10px;border-radius:2px;"
  42. name="resetBtn"> 重置
  43. </button>
  44. <button type="button" class="btn btn-md btn-primary" style="margin-left: 10px;border-radius:2px;"
  45. onclick="units.exportExcel()"> 导出</button>
  46. </span>
  47. </div>
  48. </div>
  49. </form>
  50. <div style="padding: 20px 10px">
  51. @foreach($list as $value)
  52. {{$value->type}} : {{$value->count}}
  53. @endforeach
  54. </div>
  55. <hr>
  56. <div class="table-responsive">
  57. <table id="table" class="table table-condensed" data-mobile-responsive="true"></table>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. </body>
  65. @endsection
  66. @section('footer')
  67. <script>
  68. var units = {
  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. save: function (id) {
  78. layer.open({
  79. type: 2,
  80. content: ['/admin/link/case/' + id + '/save'],
  81. area: ['60%', '60%'],
  82. title: '保存'
  83. });
  84. },
  85. search: function () {
  86. tips.selectPage();
  87. },
  88. delete: function () {
  89. var ids = units.getIdsBySelections();
  90. if (ids.length === 0) {
  91. layer.alert('请先选择您所要操作的对象', {icon: 0});
  92. return;
  93. }
  94. layer.confirm('您确定要删除吗?', {icon: 3, title: '删除信息'}, function (index, layero) {
  95. layer.close(index);
  96. tips.ajax({url: '/admin/link/cases', type: 'delete', data: {ids: ids}, tableRefresh: '#table'});
  97. });
  98. },
  99. exportExcel: function () {
  100. var formValues = tips.getFormValues("#searchForm");
  101. var str = $.param(formValues);
  102. window.open('/admin/link/externalCaseExport?' + str)
  103. },
  104. import: function () {
  105. var str = '<div class="ibox-content" id="importLayer">' +
  106. '<form class="form-horizontal">' +
  107. '<div class="form-group">' +
  108. '<label class="col-sm-3 control-label">请选择excel文件:</label>' +
  109. '<div class="col-sm-6">' +
  110. '<input type="file" id="excel_file" class="form-control">' +
  111. '<input type="hidden" id="excel_path">' +
  112. '</div>' +
  113. '<div class="col-sm-2"><button class="btn btn-info" type="button" onclick="units.fileUploadExl()">上传</button></div>' +
  114. '</div>' +
  115. ' <div class="form-group">' +
  116. '<div class="col-sm-6 col-sm-offset-3">' +
  117. '<a href="{{asset('tpl/link_case.xls')}}">请下载导入模板</a>' +
  118. '</div>' +
  119. '</div>' +
  120. '</form>' +
  121. '</div>';
  122. openIndex = layer.open({
  123. type: 1,
  124. content: str,
  125. area: ['60%', '30%'],
  126. title: '导入关键词'
  127. });
  128. },
  129. fileUploadExl: function () {
  130. var config = {
  131. url: '/admin/tool/excel-upload'
  132. };
  133. config.success = function (result) {
  134. var data = {excel_path: result.data.file_url};
  135. var config = {
  136. url: '/admin/link/externalCaseImport',
  137. type: 'post',
  138. data: data,
  139. success: function (result) {
  140. layer.msg(result.message, {icon: 6, time: 1500}, function () {
  141. layer.close(openIndex);
  142. window.location.reload();
  143. });
  144. }
  145. };
  146. tips.ajax(config);
  147. };
  148. tips.fileUpload($("#excel_file"), config);
  149. },
  150. };
  151. var config = {};
  152. config.url = '/admin/link/case';
  153. config.columns = [ //字段
  154. {checkbox: true},
  155. {
  156. title: '序号', align: 'center', formatter: function (value, item, index) {
  157. return index + 1;
  158. }
  159. },
  160. {title: '类型', field: 'typeTitle', align: 'center'},
  161. {title: '平台链接', field: 'url', align: 'center'},
  162. {title: '用户名', field: 'username_history', align: 'center'},
  163. {title: '邮箱', field: 'email_history', align: 'center'},
  164. {title: '密码', field: 'password_history', align: 'center'},
  165. {title: 'profile演示地址', field: 'url_history', align: 'center'},
  166. // {title: '创建时间', field: 'created_at', align: 'center'},
  167. {
  168. title: '操作', field: 'id', align: 'center',
  169. formatter: function (value, row) {
  170. var str = '';
  171. // if (row.status === 1) {
  172. str += '<button onclick="units.save(' + value + ')" class="btn btn-xs"><span class="glyphicon glyphicon-edit"></span>编辑</button>';
  173. // }
  174. return str;
  175. }
  176. }
  177. ];
  178. tips.bootstrapTable(config);
  179. </script>
  180. @endsection