index.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <div class="row content-nav inline-page-box">
  2. <div class="col-xs-12">
  3. <ul>
  4. <li><a href="javascript:;"><i></i>&nbsp;微信管理</a></li>
  5. <li><a href="javascript:;">公众号</a></li>
  6. </ul>
  7. </div>
  8. </div>
  9. <section class="content">
  10. <div class="row">
  11. <div class="col-md-3 l-col-md-3">
  12. <a href="{:createUrl('editor')}" class="btn btn-primary btn-block margin-bottom">添加图片</a>
  13. <div class="box box-solid">
  14. <div class="box-header with-border">
  15. <h3 class="box-title">菜单</h3>
  16. <div class="box-tools">
  17. <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
  18. </button>
  19. </div>
  20. </div>
  21. <div class="box-body no-padding">
  22. <ul class="nav nav-pills nav-stacked">
  23. {include file="wechat/common/wechat_menu"}
  24. </ul>
  25. </div>
  26. </div>
  27. </div>
  28. <div class="col-md-9 r-col-md-9">
  29. <div class="layui-fluid">
  30. <div class="layui-card">
  31. <ul class="flow-default" style="height: 450px;" id="lay-flow-box"></ul>
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. </section>
  37. <style type="text/css">
  38. .flow-default {
  39. width: 98%;
  40. height: 450px;
  41. overflow: auto;
  42. font-size: 0;
  43. margin: 0 1%;
  44. }
  45. .flow-default li {
  46. display: inline-block;
  47. font-size: 14px;
  48. width: 25%;
  49. margin: 10px 0px;
  50. height: 200px;
  51. text-align: center;
  52. }
  53. .article-item{
  54. padding: 5px;
  55. border: 0px solid #ccc;
  56. box-sizing: content-box;
  57. height: 200px;
  58. display: block;
  59. position: relative;
  60. z-index: 1;
  61. overflow: hidden;
  62. }
  63. .article-item-img{
  64. width: 100%;
  65. height: 100%;
  66. display: block;
  67. background-size: 100%;
  68. }
  69. .article-item-img img {
  70. width: 100%;
  71. height: 100%;
  72. display: inline-block;
  73. }
  74. .article-item-title {
  75. position: absolute;
  76. bottom: 5px;
  77. color: #fff;
  78. font-size: 12px;
  79. background:rgba(0,0,0,0.5);
  80. width: 96%;
  81. height: 30px;
  82. line-height: 30px;
  83. padding: 0 15px;
  84. white-space:nowrap;
  85. overflow:hidden;
  86. text-overflow:ellipsis;
  87. }
  88. .article-item-top-box{
  89. position: absolute;
  90. top: 5px;
  91. color: #fff;
  92. font-size: 12px;
  93. background:rgba(0,0,0,0.5);
  94. width: 96%;
  95. height: 40px;
  96. line-height: 40px;
  97. padding: 0 15px;
  98. overflow:hidden;
  99. display: none;
  100. }
  101. .article-item-top-box a {
  102. float: right;
  103. color: #fff;
  104. margin: 0;
  105. }
  106. .article-item-top-box a:hover {
  107. color: red;
  108. }
  109. .article-item:hover .article-item-top-box {
  110. display: block;
  111. }
  112. .article-item-top-box a:last-child {
  113. margin-right: 15px;
  114. }
  115. </style>
  116. <script type="text/javascript">
  117. layui.use('flow', function(){
  118. var flow = layui.flow;
  119. flow.load({
  120. elem: '#lay-flow-box' //流加载容器
  121. ,scrollElem: '#lay-flow-box' //滚动条所在元素,一般不用填,此处只是演示需要。
  122. ,done: function(page, next){ //执行下一页的回调
  123. $.get("{:createUrl('index')}",{ page: page },function(result){
  124. var lis = [];
  125. for(var i = 0; i < result.data.length; i++){
  126. var str = '<div class="article-item">';
  127. str += '<div class="article-item-top-box">';
  128. str += '<a class="article-item-delete" href="'+result.data[i].remove+'">删除</a>';
  129. str += '<a href="'+result.data[i].editor+'">编辑</a>';
  130. str += '</div>';
  131. str += '<div class="article-item-img"><img src="'+result.data[i]['list'][0].local_url+'"></div>';
  132. str += '<div class="article-item-title">'+result.data[i]['list'][0].title+'</div>';
  133. str += '</div>';
  134. lis.push('<li>'+ str +'</li>')
  135. }
  136. if(lis.length <= 0 && page <= 1){
  137. $(".layui-flow-more").hide();
  138. $("#lay-flow-box").append('<div style="text-align: center;font-size: 14px;margin-top: 150px;">没有数据哦</div>');
  139. }
  140. //执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
  141. //pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
  142. next(lis.join(''), result.total == result.page - 1); //假设总页数为 10
  143. },"json");
  144. }
  145. });
  146. $(document).on("click",".article-item-delete",function (){
  147. var pt = $(this).parent().parent().parent();
  148. $.get($(this).attr("href"),function (result){
  149. if(result.code){
  150. pt.remove();
  151. }else{
  152. layer.msg(result.msg,{ icon : 2 });
  153. }
  154. },"json");
  155. return false;
  156. });
  157. });
  158. </script>