pushList.blade.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. @extends('admin.layouts')
  2. @section('css')
  3. <link rel="stylesheet" href="/assets/global/vendor/bootstrap-table/bootstrap-table.min.css">
  4. <link rel="stylesheet" href="/assets/global/vendor/bootstrap-markdown/bootstrap-markdown.min.css">
  5. <link rel="stylesheet" href="/assets/global/fonts/font-awesome/font-awesome.min.css">
  6. @endsection
  7. @section('content')
  8. <div class="page-content container-fluid">
  9. <div class="panel">
  10. <div class="panel-heading">
  11. <h3 class="panel-title">推送消息列表</h3>
  12. <div class="panel-actions">
  13. <button class="btn btn-primary" data-toggle="modal" data-target="#send_modal"><i class="icon wb-plus"></i>推送消息</button>
  14. </div>
  15. </div>
  16. <div class="panel-body">
  17. <div class="form-inline pb-20">
  18. <div class="form-group">
  19. <select class="form-control" name="status" id="status">
  20. <option value="" @if(Request::get('status') == '') selected hidden @endif>状态</option>
  21. <option value="0" @if(Request::get('status') == '0') selected hidden @endif>待发送</option>
  22. <option value="-1" @if(Request::get('status') == '-1') selected hidden @endif>失败</option>
  23. <option value="1" @if(Request::get('status') == '1') selected hidden @endif>成功</option>
  24. </select>
  25. </div>
  26. <div class="btn-group">
  27. <button class="btn btn-primary" onclick="doSearch()">搜索</button>
  28. <button class="btn btn-danger" onclick="doReset()">重置</button>
  29. </div>
  30. </div>
  31. <div class="alert alert-info alert-dismissible" role="alert">
  32. <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  33. <span aria-hidden="true">×</span>
  34. <span class="sr-only">Close</span>
  35. </button>
  36. 仅会推送给关注了您的消息通道的用户 <a class="alert-link" href="{{url('admin/system')}}" target="_blank">设置PushBear</a>.
  37. </div>
  38. <table class="table text-center" data-toggle="table" data-mobile-responsive="true">
  39. <thead class="thead-default">
  40. <tr>
  41. <th> #</th>
  42. <th> 消息标题</th>
  43. <th> 消息内容</th>
  44. <th> 推送状态</th>
  45. <th> 推送时间</th>
  46. <th> 错误信息</th>
  47. </tr>
  48. </thead>
  49. <tbody>
  50. @if ($list->isEmpty())
  51. <tr>
  52. <td colspan="6">暂无数据</td>
  53. </tr>
  54. @else
  55. @foreach($list as $vo)
  56. <tr>
  57. <td> {{$vo->id}} </td>
  58. <td> {{$vo->title}} </td>
  59. <td> {{$vo->content}} </td>
  60. <td> {{$vo->status_label}} </td>
  61. <td> {{$vo->created_at}} </td>
  62. <td> {{$vo->error}} </td>
  63. </tr>
  64. @endforeach
  65. @endif
  66. </tbody>
  67. </table>
  68. </div>
  69. <div class="panel-footer">
  70. <div class="row">
  71. <div class="col-md-4 col-sm-4">
  72. 共 {{$list->total()}} 条推送消息
  73. </div>
  74. <div class="col-md-8 col-sm-8">
  75. <div class="Page navigation float-right">
  76. {{ $list->links() }}
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. <!-- 推送消息 -->
  84. <div id="send_modal" class="modal fade" tabindex="-1" data-focus-on="input:first" data-backdrop="static" data-keyboard="false">
  85. <div class="modal-dialog">
  86. <div class="modal-content">
  87. <div class="modal-header">
  88. <button class="close" data-dismiss="modal" aria-hidden="true"></button>
  89. <h4 class="modal-title">推送消息</h4>
  90. </div>
  91. <div class="modal-body">
  92. <div class="alert alert-danger" style="display: none;" id="msg"></div>
  93. <form action="#" method="post" class="form-horizontal">
  94. <div class="form-body">
  95. <div class="form-group">
  96. <div class="row">
  97. <label for="title" class="col-md-2 control-label"> 标题 </label>
  98. <div class="col-md-10">
  99. <input type="text" class="form-control" name="title" id="title" placeholder="">
  100. </div>
  101. </div>
  102. </div>
  103. <div class="form-group">
  104. <div class="row">
  105. <label for="content" class="col-md-2 control-label"> 内容 </label>
  106. <div class="col-md-10">
  107. <textarea class="form-control" rows="6" name="content" id="content" data-provide="markdown" data-iconlibrary="fa"></textarea>
  108. <span class="help-block"> 内容支持<a href="https://maxiang.io/" target="_blank">Markdown语法</a> </span>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. </form>
  114. </div>
  115. <div class="modal-footer">
  116. <button class="btn btn-danger" data-dismiss="modal">取消</button>
  117. <button class="btn btn-primary" onclick="return send();">推送</button>
  118. </div>
  119. </div>
  120. </div>
  121. </div>
  122. @endsection
  123. @section('script')
  124. <script src="/assets/global/vendor/bootstrap-table/bootstrap-table.min.js"></script>
  125. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js"></script>
  126. <script src="/assets/global/vendor/bootstrap-markdown/bootstrap-markdown.js"></script>
  127. <script src="/assets/global/vendor/marked/marked.js"></script>
  128. <script src="/assets/global/vendor/to-markdown/to-markdown.js"></script>
  129. <script type="text/javascript">
  130. // 发送通道消息
  131. function send() {
  132. const _token = '{{csrf_token()}}';
  133. const title = $("#title").val();
  134. const content = $("#content").val();
  135. if (title.trim() === '') {
  136. $("#msg").show().html("标题不能为空");
  137. $("#title").focus();
  138. return false;
  139. }
  140. $.ajax({
  141. url: '/marketing/addPushMarketing',
  142. type: "POST",
  143. data: {_token: _token, title: title, content: content},
  144. beforeSend: function () {
  145. $("#msg").show().html("正在添加...");
  146. },
  147. success: function (ret) {
  148. if (ret.status === 'fail') {
  149. $("#msg").show().html(ret.message);
  150. return false;
  151. }
  152. $("#send_modal").modal("hide");
  153. },
  154. error: function () {
  155. $("#msg").show().html("请求错误,请重试");
  156. },
  157. complete: function () {
  158. }
  159. });
  160. }
  161. // 关闭modal触发
  162. $('#send_modal').on('hide.bs.modal', function () {
  163. window.location.reload();
  164. });
  165. function doSearch() {
  166. const status = $("#status").val();
  167. window.location.href = "/marketing/pushList?status=" + status;
  168. }
  169. function doReset() {
  170. window.location.href = "/marketing/pushList";
  171. }
  172. </script>
  173. @endsection