list.html 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. {% if data['page']['ajax'] == False %}
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. {%include '../inc/header.html'%}
  6. <style>
  7. .layui-form-switch
  8. {
  9. margin-top: 0px;
  10. }
  11. </style>
  12. </head>
  13. <body>
  14. <div class="x-nav">
  15. <span class="layui-breadcrumb">
  16. {% block breadcrumb %}
  17. <a><cite>首页</cite></a>
  18. <a><cite><script>document.write(parent.config.parentTitle)</script></cite></a>
  19. <a><cite><script>document.write(parent.config.subTitle)</script></cite></a>
  20. {% if data['state'] != True %}
  21. <a><cite>回收站</cite></a>
  22. {% end %}
  23. {% end %}
  24. </span>
  25. <span id="currentUrl"><script>var cur = parent.config.cur;</script></span>
  26. <a class="layui-btn layui-btn-small" style="margin-top:3px;float:right" href="javascript:window.history.back();" title="返回"><i class="layui-icon">&#xe619;</i></a>
  27. </div>
  28. <div class="x-body">
  29. <form class="layui-form x-center" action="" style="width:auto">
  30. <div class="layui-form-pane" style="margin-top: 15px;">
  31. <div class="layui-form-item">
  32. {% block search %}
  33. <label class="layui-form-label">日期范围</label>
  34. <div class="layui-input-inline">
  35. <input class="layui-input" placeholder="开始时间" id="LAY_demorange_s" name="search_start">
  36. </div>
  37. <div class="layui-input-inline">
  38. <input class="layui-input" placeholder="截止时间" id="LAY_demorange_e" name="search_end">
  39. </div>
  40. <div class="layui-input-inline">
  41. <input type="text" name="search_name" placeholder="标题" autocomplete="off" class="layui-input">
  42. </div>
  43. {% end %}
  44. <div class="layui-input-inline" style="width:80px">
  45. <button class="layui-btn" lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
  46. </div>
  47. </div>
  48. </div>
  49. </form>
  50. <xblock>{% block button %}<button class="layui-btn" onclick="show('添加问题','question-add.html','600','500')"><i class="layui-icon">&#xe608;</i>添加</button><button class="layui-btn layui-btn-danger" onclick="showDel('')"><i class="layui-icon"></i>回收站</button>{% end %}<span class="x-right" style="line-height:40px">{% block total %}共有数据:{{data['page']['totalNum']}} 条 [每页数据:{{data['page']['num']}} 条{% end %}]</span></xblock>
  51. <form class="layui-form">
  52. <table class="layui-table">
  53. <thead>
  54. <tr>
  55. {% block thead %}
  56. <th>
  57. <input type="checkbox" name="" value="">
  58. </th>
  59. <th>
  60. ID
  61. </th>
  62. <th>
  63. 标题
  64. </th>
  65. <th>
  66. 分类
  67. </th>
  68. <th>
  69. 来源
  70. </th>
  71. <th>
  72. 更新时间
  73. </th>
  74. <th>
  75. 浏览次数
  76. </th>
  77. <th>
  78. 操作
  79. </th>
  80. {% end %}
  81. </tr>
  82. </thead>
  83. <tbody id="tbody">
  84. {% end %}
  85. {% block tbody %}
  86. <tr>
  87. <td>
  88. <input type="checkbox" value="1" name="">
  89. </td>
  90. <td>
  91. 1
  92. </td>
  93. <td>
  94. <u style="cursor:pointer" onclick="question_show()">
  95. 问题标题
  96. </u>
  97. </td>
  98. <td >
  99. 新闻子类1
  100. </td>
  101. <td >
  102. xuebingsi
  103. </td>
  104. <td >
  105. 2017-01-01 11:11:42
  106. </td>
  107. <td >
  108. 34
  109. </td>
  110. <td class="td-manage">
  111. <a title="编辑" href="javascript:;" onclick="question_edit('编辑','question-edit.html','4','','510')"
  112. class="ml-5" style="text-decoration:none">
  113. <i class="layui-icon">&#xe642;</i>
  114. </a>
  115. <a title="删除" href="javascript:;" onclick="question_del(this,'1')"
  116. style="text-decoration:none">
  117. <i class="layui-icon">&#xe640;</i>
  118. </a>
  119. </td>
  120. </tr>
  121. {% end %}
  122. <script>var current = {{data['page']['current']}}</script>
  123. {% if data['page']['ajax'] == False %}
  124. </tbody>
  125. </table>
  126. </form>
  127. <div id="page"></div>
  128. </div>
  129. {%include '../inc/footer.html'%}
  130. {%include '../inc/script.html'%}
  131. <script>
  132. layui.use(['laydate','element','laypage','layer', 'form'], function(){
  133. $ = layui.jquery;//jquery
  134. var lement = layui.element();//面包导航
  135. var laypage = layui.laypage;//分页
  136. var layer = layui.layer;//弹出层
  137. var form = layui.form();
  138. layer.ready(function(){ //为了layer.ext.js加载完毕再执行
  139. layer.photos({
  140. photos: '#tbody'
  141. //,shift: 5 //0-6的选择,指定弹出图片动画类型,默认随机
  142. });
  143. });
  144. if ($('.load').length) {
  145. $('.load').each(function()
  146. {
  147. load($(this))
  148. })
  149. }
  150. if ($(".selectLoad").length) {
  151. $(".selectLoad").each(function()
  152. {
  153. if ($(this).attr('lay-filter')) {
  154. var e = $(this);
  155. selectShow(e, e.attr('change'),'search');
  156. form.render();
  157. }
  158. })
  159. }
  160. form.on('select(yes)', function(data){
  161. var e = $(data.elem);
  162. selectShow(e, e.attr('change'), 'search');
  163. form.render();
  164. });
  165. form.on('switch(switch)', function(data){
  166. //console.log(data.elem); //得到checkbox原始DOM对象
  167. //console.log(data.elem.checked); //开关是否开启,true或者false
  168. //console.log(data.value); //开关value值,也可以通过data.elem.value得到
  169. //console.log(data.othis); //得到美化后的DOM对象
  170. var e = $(data.elem)
  171. var id = e.attr('data-id')
  172. var value = e.attr('data-value')
  173. var send = {
  174. id : id
  175. ,value:value
  176. }
  177. var url = e.attr('data-url')
  178. var index = layer.msg('loading...', {icon: 4});
  179. request('post', url, send, function(msg)
  180. {
  181. layer.close(index);
  182. })
  183. });
  184. if ($('.time').length) {
  185. laydate = layui.laydate;//日期插件
  186. var start = {
  187. //min: laydate.now()
  188. max: '2099-06-16 23:59:59'
  189. ,format: 'YYYY-MM-DD hh:mm:ss'
  190. ,istoday: true
  191. ,istime: true
  192. ,choose: function(datas){
  193. end.min = datas; //开始日选好后,重置结束日的最小日期
  194. end.start = datas //将结束日的初始值设定为开始日
  195. }
  196. };
  197. var end = {
  198. //min: laydate.now()
  199. max: '2099-06-16 23:59:59'
  200. ,format: 'YYYY-MM-DD hh:mm:ss'
  201. ,istoday: true
  202. ,istime: true
  203. ,choose: function(datas){
  204. start.max = datas; //结束日选好后,重置开始日的最大日期
  205. }
  206. };
  207. $('.time').each(function()
  208. {
  209. type = $(this).attr('id').indexOf('start')
  210. $(this).click(function()
  211. {
  212. if (type > -1) {
  213. start.elem = this;
  214. laydate(start);
  215. } else {
  216. end.elem = this
  217. laydate(end);
  218. }
  219. })
  220. })
  221. }
  222. laypage({
  223. cont: 'page'
  224. ,pages: {{data['page']['total']}}
  225. ,curr: current
  226. ,first: 1
  227. ,last: {{data['page']['total']}}
  228. ,prev: '<em><</em>'
  229. ,next: '<em>></em>'
  230. ,skip: true
  231. ,jump: function(obj, first) {
  232. var curr = obj.curr;
  233. var url = location.href;
  234. var str = 'page='
  235. var link = '?'
  236. var page = 1
  237. if (url.indexOf(str) > -1) {
  238. var temp = url.split('page=')
  239. url = temp[0]
  240. page = temp[1]
  241. if (page.indexOf('&') > -1) {
  242. temp = page.split('&')
  243. page = temp[0]
  244. if (url.indexOf('?') > -1) {
  245. link = '&'
  246. }
  247. if (temp[1]) {
  248. url = url + link + temp[1]
  249. }
  250. }
  251. }
  252. if (url.indexOf('?') > -1) {
  253. link = '&'
  254. } else {
  255. link = '?'
  256. }
  257. url = url + link;
  258. url = url.replace('&&', '&')
  259. if (curr != current) {
  260. url = url + 'page=' + curr
  261. var index = layer.msg('loading...', {icon: 4});
  262. request('get', url, {}, function(msg)
  263. {
  264. layer.close(index);
  265. $('#tbody').html(msg);
  266. form.render();
  267. })
  268. }
  269. }
  270. });
  271. {% block script %}
  272. {% end %}
  273. });
  274. </script>
  275. </body>
  276. </html>
  277. {% end %}