hootsuite_history.blade.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. @extends('admin/site/side_layout')
  2. @section('header_extend')
  3. @endsection
  4. @section('right')
  5. <div class="table-responsive">
  6. <button type="button" class="btn btn-md btn-primary"
  7. onclick="units.import()" style="margin-left: 10px">
  8. 导入记录
  9. </button>
  10. <table id="table" class="table table-condensed"
  11. data-mobile-responsive="true"></table>
  12. </div>
  13. @endsection
  14. @section('footer_extend')
  15. <script>
  16. var units = {
  17. import: function () {
  18. var str = '<div class="ibox-content" id="importLayer">' +
  19. '<form class="form-horizontal">' +
  20. '<div class="form-group">' +
  21. '<label class="col-sm-3 control-label">请选择excel文件:</label>' +
  22. '<div class="col-sm-6">' +
  23. '<input type="file" id="excel_file" class="form-control">' +
  24. '<input type="hidden" id="excel_path">' +
  25. '</div>' +
  26. '<div class="col-sm-2"><button class="btn btn-info" type="button" onclick="units.fileUploadExl()">上传</button></div>' +
  27. '</div>' +
  28. ' <div class="form-group">' +
  29. '<div class="col-sm-6 col-sm-offset-3">' +
  30. '<a href="{{asset('tpl/social_message_list.xlsx')}}">请下载导入模板</a>' +
  31. '</div>' +
  32. '</div>' +
  33. '</form>' +
  34. '</div>';
  35. openIndex = layer.open({
  36. type: 1,
  37. content: str,
  38. area: ['60%', '30%'],
  39. title: '导入关键词'
  40. });
  41. },
  42. fileUploadExl: function () {
  43. var config = {
  44. url: '/admin/tool/excel-upload'
  45. };
  46. config.success = function (result) {
  47. var data = {excel_path: result.data.file_url, siteId: "{{$siteId}}"};
  48. var config = {
  49. url: '/admin/sites/' + {{$siteId}} +'/social-message-import',
  50. type: 'post',
  51. data: data,
  52. success: function (result) {
  53. layer.msg(result.message, {icon: 6, time: 1500}, function () {
  54. layer.close(openIndex);
  55. window.location.reload();
  56. });
  57. }
  58. };
  59. tips.ajax(config);
  60. };
  61. tips.fileUpload($("#excel_file"), config);
  62. },
  63. detail: function (id) {
  64. var url = '/admin/sites/social-queue/' + id + '?siteId={{$siteId}}';
  65. layer.open({
  66. type: 2,
  67. content: url,
  68. area: ['70%', '90%'],
  69. title: '详情'
  70. });
  71. }
  72. };
  73. var config = {};
  74. config.url = '/admin/sites/' + "{{$siteId}}" + '/hootsuite-history';
  75. config.columns = [ //字段
  76. {title: '编号', field: 'id', align: 'center'},
  77. {title: '地址', field: 'url', align: 'center', width: '200px'},
  78. {
  79. title: '图片', field: 'media', align: 'center',
  80. formatter: function (value, rows) {
  81. if (value) {
  82. return (
  83. '<img src="' + value + '" height="40px"/>'
  84. );
  85. }
  86. }
  87. },
  88. {title: '内容概要', field: 'content', align: 'center'},
  89. {title: '发布时间', field: 'publish_at', align: 'center', width: '140px'},
  90. {title: '发布对象', field: 'profileStr', align: 'center'},
  91. ];
  92. tips.bootstrapTable(config);
  93. </script>
  94. @endsection