index.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. <div class="box box-solid">
  13. <div class="box-header with-border">
  14. <h3 class="box-title">菜单</h3>
  15. <div class="box-tools">
  16. <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
  17. </button>
  18. </div>
  19. </div>
  20. <div class="box-body no-padding">
  21. {include file="wechat/common/wechat_menu"}
  22. </div>
  23. </div>
  24. </div>
  25. <div class="col-md-9 r-col-md-9">
  26. <div class="layui-fluid">
  27. <div class="layui-card">
  28. <div class="layui-card-body">
  29. <blockquote class="layui-elem-quote" style="border-left: 5px solid #3c8dbc; font-size: 14px; background-color: #eee;">
  30. 如果小程序更换Appid,请清空小程序码,前台会员访问时会自动生成相关小程序码。
  31. </blockquote>
  32. </div>
  33. </div>
  34. </div>
  35. <section class="content clearfix">
  36. <div class="layui-list-box">
  37. <table class="layui-hide" id="list-box" lay-filter="list-box"></table>
  38. </div>
  39. </section>
  40. <script type="text/html" id="list-toolbar">
  41. <div class="layui-btn-container">
  42. <button lay-event="refresh" type="button" class="layui-btn layui-btn-sm layui-bg-red"><i class="layui-icon">&#xe9aa;</i> 刷新</button>
  43. <button lay-event="remove" type="button" class="layui-btn layui-btn-sm layui-btn-normal"><i class="layui-icon">&#xe640;</i> 清空</button>
  44. </div>
  45. </script>
  46. <script type="text/html" id="list-bar">
  47. <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
  48. </script>
  49. </div>
  50. </div>
  51. </section>
  52. <style type="text/css">.layui-table-cell{ height:auto !important; }</style>
  53. <script>
  54. layui.use(['table','form'], function () {
  55. var table = layui.table;
  56. var form = layui.form;
  57. table.render({
  58. elem: '#list-box'
  59. , url: '{:createUrl("wechat.qrcode/index")}'
  60. , toolbar: '#list-toolbar'
  61. , defaultToolbar: []
  62. , title: '数据表'
  63. , cols: [[
  64. {type: 'checkbox'}
  65. , {field: 'id', title: 'ID', width: 80, unresize: true, sort: true,align:"center"}
  66. , {field:'photo', title:'小程序码', align: "center", width:120,templet: function(res){
  67. return '<img src="'+ res.image +'" style="max-width:60px; max-height:60px;">';
  68. }}
  69. , {field: 'username', title: '用户名',align:"center"}
  70. , {field: 'nickname', title: '昵称',align:"center"}
  71. , {field: 'create_time', title: '生成时间', width: 180, align: "center"}
  72. , {align: 'center', title: '操作', toolbar: '#list-bar', width: 100}
  73. ]]
  74. , text: {
  75. none: '<div><i class="layui-icon">&#xe702;</i>暂无相关数据</div>'
  76. }
  77. , page: true
  78. , id: 'list-table'
  79. , height: 'full-255'
  80. // ,limit:30
  81. });
  82. $("#search-btn").on("click",function (){
  83. table.reload('list-table', {
  84. page: {
  85. curr: 1
  86. }
  87. ,where: {
  88. key: {
  89. title : $('[name="title"]').val()
  90. }
  91. }
  92. }, 'data');
  93. });
  94. // 头工具栏事件
  95. table.on('toolbar(list-box)', function (obj) {
  96. switch (obj.event) {
  97. case 'refresh':
  98. window.location.reload();
  99. break;
  100. case 'remove':
  101. $.post("{:createUrl('wechat.qrcode/remove')}",function (result){
  102. if(result.code){
  103. window.location.reload();
  104. }else{
  105. layer.msg(result.msg,{ icon : 2 });
  106. }
  107. },"json");
  108. break;
  109. }
  110. });
  111. // 监听行工具事件
  112. table.on('tool(list-box)', function (obj) {
  113. var data = obj.data;
  114. if (obj.event === 'del') {
  115. layer.confirm('你确定要删除吗?', function (index) {
  116. $.get('{:createUrl("wechat.qrcode/delete")}',{
  117. id : data.id
  118. },function(result){
  119. layer.close(index);
  120. if(result.code){
  121. obj.del();
  122. }else{
  123. layer.msg(result.msg,{ icon : 2 });
  124. }
  125. },"json");
  126. });
  127. }
  128. });
  129. });
  130. </script>