messagelist.html 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <title></title>
  7. <meta name="description" content="">
  8. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  9. <meta name="robots" content="all,follow">
  10. <!-- Bootstrap CSS-->
  11. <link rel="stylesheet" href="__VENDOR__/bootstrap/css/bootstrap.min.css">
  12. <!-- Font Awesome CSS-->
  13. <link rel="stylesheet" href="__VENDOR__/font-awesome/css/font-awesome.min.css">
  14. <!-- Fontastic Custom icon font-->
  15. <!--<link rel="stylesheet" href="__CSS__/fontastic.css">-->
  16. <link rel="stylesheet" href="__CSS__/iconfont.css">
  17. <!-- Google fonts - Poppins -->
  18. <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:300,400,700">
  19. <!-- theme stylesheet-->
  20. <link rel="stylesheet" href="__CSS__/style.default.css" id="theme-stylesheet">
  21. <!-- Custom stylesheet - for your changes-->
  22. <link rel="stylesheet" href="__CSS__/custom.css">
  23. <!-- Favicon-->
  24. <link rel="shortcut icon" href="__IMG__/favicon.ico">
  25. <!-- Tweaks for older IEs--><!--[if lt IE 9]>
  26. <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  27. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script><![endif]-->
  28. </head>
  29. <body>
  30. <div class="page">
  31. <!-- Main Navbar-->
  32. {include file="layout/header" /}
  33. <div class="page-content d-flex align-items-stretch">
  34. <!-- Side Navbar -->
  35. {include file="layout/navigation" /}
  36. <div class="content-inner">
  37. <!-- Page Header-->
  38. <header class="page-header">
  39. <div class="container-fluid">
  40. <h2 class="no-margin-bottom">消息列表</h2>
  41. </div>
  42. </header>
  43. <!-- Breadcrumb-->
  44. <div class="breadcrumb-holder container-fluid">
  45. <ul class="breadcrumb">
  46. <li class="breadcrumb-item">消息管理</li>
  47. <li class="breadcrumb-item active">消息列表</li>
  48. </ul>
  49. </div>
  50. <section class="tables">
  51. <div class="container-fluid">
  52. <div class="row">
  53. <div class="col-lg-12">
  54. <div class="card">
  55. <!--<div class="card-close">
  56. <div class="dropdown">
  57. <button type="button" id="closeCard1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="dropdown-toggle"><i class="fa fa-ellipsis-v"></i></button>
  58. <div aria-labelledby="closeCard1" class="dropdown-menu dropdown-menu-right has-shadow"><a href="#" class="dropdown-item remove"> <i class="fa fa-times"></i>Close</a><a href="#" class="dropdown-item edit"> <i class="fa fa-gear"></i>Edit</a></div>
  59. </div>
  60. </div>-->
  61. <div class="card-header d-flex align-items-center">
  62. <h3 class="h4">消息列表</h3>
  63. </div>
  64. <div class="card-body">
  65. <div class="form-group col-lg-6" style="float: right;">
  66. <div class="input-group">
  67. <span style="line-height: 2; font-size: 18px; margin-right: 5px;">平台名</span>
  68. <input type="text" id="platformName" class="form-control">
  69. <div class="input-group-append">
  70. <button type="button" onclick="onSearch()" class="btn btn-primary">查询</button>
  71. </div>
  72. <div class="input-group-append" style="margin-left: 20px;">
  73. <button type="button" onclick="ondelete()" class="btn btn-primary">删除</button>
  74. </div>
  75. </div>
  76. </div>
  77. <div class="table-responsive">
  78. <table class="table table-striped">
  79. <thead>
  80. <tr>
  81. <th><input type="checkbox" lay-filter="checkeds" lay-skin="primary" class="checkall" onclick="oncheck()"></th>
  82. <th>序号</th>
  83. <th>平台名</th>
  84. <th>标题</th>
  85. <th>消息时间</th>
  86. <th>发送者IP</th>
  87. <th>操作</th>
  88. </tr>
  89. </thead>
  90. <tbody>
  91. <?php foreach ($messageList as $k => $v): ?>
  92. <tr>
  93. <td class="check-mail">
  94. <input type="checkbox" class="checkone" value="{$k+1}" name="ids" lay-skin="primary">
  95. </td>
  96. <th scope="row">{$k+1}</th>
  97. <td>{$v['platform_name']}</td>
  98. <td>{$v['message_title']}</td>
  99. <td><?php echo date('Y-m-d H:i',$v['message_time']); ?></td>
  100. <td>{$v['message_ip']}</td>
  101. <td>
  102. <span onclick="getInfo({$v['message_id']})" style="color: #1428ce; cursor:pointer" class="icon iconfont icon-info-circle-fill" title="详情"></span>
  103. </td>
  104. </tr>
  105. <?php endforeach; ?>
  106. </tbody>
  107. </table>
  108. <ul class="list-unstyled" style="display: flex; justify-content: end;">
  109. <?php if (count($page) > 1): ?>
  110. <?php foreach ($page as $k => $v): ?>
  111. <li>
  112. <a onclick="changePage({$v})" style="{$currentPage == $v ? 'pointer-events:none;' : ''}" class="btn btn-xs {$currentPage == $v ? 'btn-secondary' : ''}">{$v}</a>
  113. </li>
  114. <?php endforeach; ?>
  115. <?php endif; ?>
  116. </ul>
  117. </div>
  118. </div>
  119. </div>
  120. </div>
  121. </div>
  122. </div>
  123. </section>
  124. <!-- Page Footer-->
  125. {include file="layout/footer" /}
  126. </div>
  127. </div>
  128. </div>
  129. <!-- JavaScript files-->
  130. <script src="__VENDOR__/jquery/jquery.min.js"></script>
  131. <script src="__VENDOR__/popper.js/umd/popper.min.js"> </script>
  132. <script src="__VENDOR__/bootstrap/js/bootstrap.min.js"></script>
  133. <script src="__VENDOR__/jquery.cookie/jquery.cookie.js"> </script>
  134. <script src="__VENDOR__/chart.js/Chart.min.js"></script>
  135. <script src="__VENDOR__/jquery-validation/jquery.validate.min.js"></script>
  136. <script src="__JS__/jquery.form.js"></script>
  137. <script src="__JS__/plugins/layer/layer.min.js"></script>
  138. <!-- Main File-->
  139. <script src="__JS__/front.js"></script>
  140. <script>
  141. function onSearch() {
  142. let platformName = $("#platformName").val();
  143. let urlParam = '';
  144. if (platformName) {
  145. urlParam = "{:url('admin/index/messagelist')}"+"?platformName="+platformName;
  146. } else {
  147. urlParam = "{:url('admin/index/messagelist')}";
  148. }
  149. window.location.href = urlParam;
  150. }
  151. function getInfo(id) {
  152. let urlParam = "{:url('admin/index/messageInfo')}"+"?id="+id;
  153. window.location.href = urlParam;
  154. }
  155. function changePage(page) {
  156. let param = getQueryString();
  157. param.currentPage = page;
  158. let urlParam = "{:url('admin/index/messageList')}"+"?"+putUrlParam(param);
  159. window.location.href = urlParam;
  160. }
  161. // 获取URL参数.
  162. function getQueryString() {
  163. var qs = location.search.substr(1), // 获取url中"?"符后的字串
  164. args = {}, // 保存参数数据的对象
  165. items = qs.length ? qs.split("&") : [], // 取得每一个参数项
  166. item = null,
  167. len = items.length;
  168. for(var i = 0; i < len; i++) {
  169. item = items[i].split("=");
  170. var name = decodeURIComponent(item[0]),
  171. value = decodeURIComponent(item[1]);
  172. if(name) {
  173. args[name] = value;
  174. }
  175. }
  176. return args;
  177. }
  178. // 对象转URL参数
  179. function putUrlParam(param) {
  180. let urlParam = '';
  181. let n = 1;
  182. for(let key in param){
  183. if (n === 1) {
  184. urlParam = key+'='+param[key];
  185. } else {
  186. urlParam += '&'+key+'='+param[key];
  187. }
  188. n++;
  189. }
  190. return urlParam;
  191. }
  192. function oncheck() {
  193. if($('.checkall').is(':checked')==true){
  194. $('.checkone').prop('checked',true);
  195. }else{
  196. $('.checkone').prop('checked',false);
  197. }
  198. }
  199. function ondelete() {
  200. let msg = '确认删除所选消息';
  201. layer.confirm(msg, {icon: 3, title:'提示'}, function(index){
  202. var ids = [];
  203. $("input[name='ids']:checked").each(function(i){
  204. ids.push($(this).val())
  205. })
  206. if(ids==''){
  207. layer.msg('未选中任何消息'); return false;
  208. }
  209. //console.log(ids);
  210. $.getJSON("{:url('admin/index/delMessage')}", {'ids' : ids}, function(res){
  211. //console.log(res);
  212. if(1 == res.code){
  213. layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
  214. location.reload();
  215. });
  216. }else if(111 == res.code){
  217. window.location.reload();
  218. }else{
  219. layer.alert(res.msg, {title: '友情提示', icon: 2});
  220. }
  221. });
  222. layer.close(index);
  223. })
  224. }
  225. </script>
  226. </body>
  227. </html>