index.html 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>留言列表</title>
  7. <link rel="shortcut icon" href="favicon.ico">
  8. <link href="__CSS__/bootstrap.min.css?v=3.3.6" rel="stylesheet">
  9. <link href="__CSS__/font-awesome.min.css?v=4.4.0" rel="stylesheet">
  10. <link href="__CSS__/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
  11. <link href="__CSS__/animate.min.css" rel="stylesheet">
  12. <link href="__CSS__/style.min.css?v=4.1.0" rel="stylesheet">
  13. <link href="__JS__/layui/css/myLayui.css" rel="stylesheet">
  14. </head>
  15. <body class="gray-bg">
  16. <div class="wrapper wrapper-content animated fadeInRight">
  17. <!-- Panel Other -->
  18. <div class="ibox float-e-margins">
  19. <div class="ibox-title">
  20. <h5>留言列表</h5>
  21. </div>
  22. <div class="ibox-content">
  23. <!--搜索框开始-->
  24. <form id='commentForm' role="form" method="post" class="form-inline pull-right">
  25. <div class="content clearfix m-b">
  26. <div class="form-group">
  27. <label>留言日期:</label>
  28. <input type="text" class="form-control" id="start" value="<?php echo date('Y-m-d',time()-604800);?>" style="width: 100px;"> --
  29. <input type="text" class="form-control" id="end" value="<?php echo date('Y-m-d',time());?>" style="width: 100px;">
  30. </div>
  31. <div class="form-group">
  32. <div class="input-group col-sm-4 layui-form" style="width: 100px;">
  33. <input type="hidden" id="user_id"/>
  34. {$useroption}
  35. </div>
  36. </div>
  37. <div class="form-group">
  38. <!--<label>留言状态:</label>-->
  39. <div class="input-group col-sm-4 layui-form" style="width: 100px;">
  40. <input type="hidden" id="message_status"/>
  41. <select lay-verify="required" lay-filter="message_status">
  42. <option value="-1">留言状态</option>
  43. <option value="0">未处理</option>
  44. <option value="1">已处理</option>
  45. </select>
  46. </div>
  47. </div>
  48. <div class="form-group">
  49. <!--<label>公开状态:</label>-->
  50. <div class="input-group col-sm-4 layui-form" style="width: 100px;">
  51. <input type="hidden" id="if_public"/>
  52. <select lay-verify="required" lay-filter="if_public">
  53. <option value="-1">公开状态</option>
  54. <option value="0">不公开</option>
  55. <option value="1">公开</option>
  56. </select>
  57. </div>
  58. </div>
  59. <div class="form-group">
  60. <div class="input-group col-sm-4 layui-form" style="width: 100px;">
  61. <input type="hidden" id="type_id"/>
  62. {$optiontype}
  63. </div>
  64. </div>
  65. <div class="form-group">
  66. <label>用户名称:</label>
  67. <input type="text" class="form-control" id="username" name="user_name" style="width: 100px;">
  68. </div>
  69. <div class="form-group">
  70. <button class="btn btn-primary" type="button" style="margin-top:5px" id="search"><strong>搜 索</strong>
  71. </button>
  72. </div>
  73. </div>
  74. </form>
  75. <!--搜索框结束-->
  76. <div class="example-wrap">
  77. <div class="example">
  78. <table id="cusTable">
  79. <thead>
  80. <th class="user_name" id="user_name" data-field="name">用户名称</th>
  81. <th style="width: 100px" class="add_time" id="add_time" data-field="add_time">留言时间</th>
  82. <th data-field="content">留言内容</th>
  83. <th data-field="image">附件</th>
  84. <th data-field="phone">手机</th>
  85. <th data-field="email">邮箱</th>
  86. <th data-field="qq">QQ</th>
  87. <th data-field="wechat">微信</th>
  88. <th data-field="status">当前状态</th>
  89. <th data-field="user_name">处理人</th>
  90. <th data-field="reply_content">回复内容</th>
  91. <th data-field="dealWith_time">处理时间</th>
  92. <th data-field="if_public">公开状态</th>
  93. <th data-field="type_name">类型</th>
  94. <th data-field="operate">操作</th>
  95. </thead>
  96. </table>
  97. </div>
  98. </div>
  99. <!-- End Example Pagination -->
  100. </div>
  101. </div>
  102. </div>
  103. <!-- End Panel Other -->
  104. <script src="__JS__/jquery.min.js?v=2.1.4"></script>
  105. <script src="__JS__/bootstrap.min.js?v=3.3.6"></script>
  106. <script src="__JS__/content.min.js?v=1.0.0"></script>
  107. <script src="__JS__/plugins/bootstrap-table/bootstrap-table.min.js"></script>
  108. <script src="__JS__/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
  109. <script src="__JS__/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
  110. <script src="__JS__/plugins/layer/layer.min.js"></script>
  111. <script src="__JS__/layui/layui.js"></script>
  112. <script type="text/javascript">
  113. layui.use(['form', 'upload'], function(){
  114. var form = layui.form;
  115. form.on('select(message_status)', function(value){
  116. $("#message_status").val(value.value);
  117. onSearch()
  118. });
  119. form.on('select(if_public)', function(value){
  120. $("#if_public").val(value.value);
  121. onSearch()
  122. });
  123. form.on('select(user_id)', function(value){
  124. $("#user_id").val(value.value);
  125. onSearch()
  126. });
  127. form.on('select(type_id)', function(value){
  128. $("#type_id").val(value.value);
  129. onSearch()
  130. });
  131. });
  132. </script>
  133. <script type="text/javascript">
  134. function initTable() {
  135. //先销毁表格
  136. $('#cusTable').bootstrapTable('destroy');
  137. //初始化表格,动态从服务器加载数据
  138. $("#cusTable").bootstrapTable({
  139. method: "get", //使用get请求到服务器获取数据
  140. url: "{:url('messages/index')}", //获取数据的地址
  141. striped: true, //表格显示条纹
  142. pagination: true, //启动分页
  143. pageSize: 10, //每页显示的记录数
  144. pageNumber:1, //当前第几页
  145. pageList: [5, 10, 15, 20, 25], //记录数可选列表
  146. sidePagination: "server", //表示服务端请求
  147. paginationFirstText: "首页",
  148. paginationPreText: "上一页",
  149. paginationNextText: "下一页",
  150. paginationLastText: "尾页",
  151. queryParamsType : "undefined",
  152. queryParams: function queryParams(params) { //设置查询参数
  153. var param = {
  154. pageNumber: params.pageNumber,
  155. pageSize: params.pageSize,
  156. searchText:$('#username').val(),
  157. start:$('#start').val(),
  158. end:$('#end').val(),
  159. user_id:$('#user_id').val(),
  160. message_status:$('#message_status').val(),
  161. if_public:$('#if_public').val(),
  162. type_id:$('#type_id').val()
  163. };
  164. return param;
  165. },
  166. onLoadSuccess: function(res){ //加载成功时执行
  167. if(111 == res.code){
  168. window.location.reload();
  169. }
  170. layer.msg("加载成功", {time : 1000});
  171. },
  172. onLoadError: function(){ //加载失败时执行
  173. layer.msg("加载数据失败");
  174. }
  175. });
  176. }
  177. $(document).ready(function () {
  178. //调用函数,初始化表格
  179. initTable();
  180. //当点击查询按钮的时候执行
  181. $("#search").bind("click", function(){
  182. var start = $('#start').val();
  183. var end = $('#end').val();
  184. if(start > end){
  185. layer.msg('开始时间不能大于结束时间');
  186. return false;
  187. }
  188. initTable();
  189. });
  190. });
  191. function messageDel(id){
  192. layer.confirm('确认删除此留言?', {icon: 3, title:'提示'}, function(index){
  193. //do something
  194. $.getJSON("{:url('Messages/delMessage')}", {'id' : id}, function(res){
  195. if(1 == res.code){
  196. layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
  197. initTable();
  198. });
  199. }else if(111 == res.code){
  200. window.location.reload();
  201. }else{
  202. layer.alert(res.msg, {title: '友情提示', icon: 2});
  203. }
  204. });
  205. layer.close(index);
  206. })
  207. }
  208. layui.use('laydate', function(){
  209. var laydate = layui.laydate;
  210. laydate.render({
  211. elem: '#start'
  212. ,type: 'date'
  213. });
  214. laydate.render({
  215. elem: '#end'
  216. ,type: 'date'
  217. });
  218. });
  219. </script>
  220. </body>
  221. </html>