keyword_extend.blade.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. @extends('admin/site/side_layout')
  2. @section('header_extend')
  3. @endsection
  4. @section('right')
  5. <div>
  6. <div class="btn-group" role="group">
  7. <button type="button" class="btn btn-info" onclick="units.import()">
  8. 导入关键词
  9. </button>
  10. {{--<button type="button" class="btn btn-info" style="margin-left: 10px"--}}
  11. {{--onclick="units.add()">--}}
  12. {{--单个关键词添加--}}
  13. {{--</button>--}}
  14. <button type="button" class="btn btn-info" style="margin-left: 10px"
  15. onclick="units.clear()">
  16. 清空当月关键词
  17. </button>
  18. </div>
  19. </div>
  20. <div class="table-responsive">
  21. <table id="table" class="table table-condensed"
  22. data-mobile-responsive="true"></table>
  23. </div>
  24. @endsection
  25. @section('footer_extend')
  26. <script>
  27. var openIndex;
  28. var units = {
  29. import: function () {
  30. var str = '<div class="ibox-content" id="importLayer">' +
  31. '<form class="form-horizontal">' +
  32. '<div class="form-group">' +
  33. '<label class="col-sm-3 control-label">请选择excel文件:</label>' +
  34. '<div class="col-sm-6">' +
  35. '<input type="file" id="excel_file" class="form-control">' +
  36. '<input type="hidden" id="excel_path">' +
  37. '</div>' +
  38. '<div class="col-sm-2"><button class="btn btn-info" type="button" onclick="units.fileUpload()">上传</button></div>' +
  39. '</div>' +
  40. ' <div class="form-group">' +
  41. '<div class="col-sm-6 col-sm-offset-3">' +
  42. '<a href="{{asset('tpl/keyword_extend.xlsx')}}">请下载导入模板</a>' +
  43. '</div>' +
  44. '</div>' +
  45. '</form>' +
  46. '</div>';
  47. openIndex = layer.open({
  48. type: 1,
  49. content: str,
  50. area: ['60%', '30%'],
  51. title: '导入关键词'
  52. });
  53. },
  54. fileUpload: function () {
  55. var config = {
  56. url: '/admin/tool/excel-upload'
  57. };
  58. config.success = function (result) {
  59. var data = {excel_path: result.data.file_url, siteId: "{{$siteId}}"};
  60. var config = {
  61. url: '/admin/keyword-extend-import/sites/{{$siteId}}',
  62. type: 'post',
  63. data: data,
  64. success: function (result) {
  65. layer.msg(result.message, {icon: 6, time: 1500}, function () {
  66. layer.close(openIndex);
  67. window.location.reload();
  68. });
  69. }
  70. };
  71. tips.ajax(config);
  72. };
  73. tips.fileUpload($("#excel_file"), config);
  74. },
  75. {{--add: function () {--}}
  76. {{--layer.open({--}}
  77. {{--type: 2,--}}
  78. {{--content: ['/admin/rank/site/' + "{{$siteId}}" + '/keyword-save'],--}}
  79. {{--area: ['60%', '50%'],--}}
  80. {{--title: '添加关键词'--}}
  81. {{--});--}}
  82. {{--},--}}
  83. clear: function () {
  84. layer.confirm('您确定要清空全部关键词吗?', {icon: 3, title: '清空'}, function () {
  85. var config = {
  86. url: '/admin/keyword-extend-clear/sites/{{$siteId}}',
  87. type: 'delete',
  88. success: function (result) {
  89. layer.msg(result.message, {icon: 6, time: 1500}, function () {
  90. window.location.reload();
  91. });
  92. }
  93. };
  94. tips.ajax(config);
  95. });
  96. },
  97. {{--save: function () {--}}
  98. {{--var config = {--}}
  99. {{--type: 'put',--}}
  100. {{--url: '/admin/rank/allow-rank/{{$site->old_id??0}}',--}}
  101. {{--data: {isAllow: jsSwitch.checked ? 1 : 0, number: $("#cloud_type").val()}--}}
  102. {{--};--}}
  103. {{--tips.ajax(config);--}}
  104. {{--}--}}
  105. };
  106. var config = {};
  107. config.url = '/admin/keyword-extend/sites/' + "{{$siteId}}";
  108. config.columns = [ //字段
  109. // {checkbox: true},
  110. {title: '编号', field: 'id', align: 'center'},
  111. {title: '月份', field: 'ym', align: 'center'},
  112. {title: '推荐关键词', field: 'keyword', align: 'center'},
  113. {title: '年搜索量', field: 'search_num', align: 'center'},
  114. {title: '索引量', field: 'index_num', align: 'center'},
  115. {title: '着陆页', field: 'land_page', align: 'center'},
  116. {title: '创建时间', field: 'created_at', align: 'center'},
  117. // {
  118. // title: '操作', field: 'id', align: 'center',
  119. // formatter: function (value) {
  120. // var str = '';
  121. // str += '<button onclick="units.save(' + value + ')" class="btn btn-xs"><span class="glyphicon glyphicon-edit"></span>编辑</button>&nbsp;';
  122. // return str;
  123. //
  124. // }
  125. // }
  126. ];
  127. tips.bootstrapTable(config);
  128. </script>
  129. @endsection