index.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. {extend name="public/container"}
  2. {block name="head_top"}
  3. {/block}
  4. {block name="content"}
  5. <div class="layui-fluid">
  6. <div class="layui-row layui-col-space15" id="app">
  7. <div class="layui-col-md12">
  8. <div class="layui-card">
  9. <div class="layui-card-header">
  10. <div style="font-weight: bold;">签到海报</div>
  11. </div>
  12. <div class="layui-card-body">
  13. <div class="layui-btn-group">
  14. <button type="button" class="layui-btn layui-btn-normal layui-btn-sm" onclick="$eb.createModalFrame('添加海报','{:Url('create')}',{w:800,h:600})" ><i class="layui-icon">&#xe608;</i> 添加海报</button>
  15. <button class="layui-btn layui-btn-normal layui-btn-sm" onclick="window.location.reload()"><i class="layui-icon">&#xe669;</i> 刷新</button>
  16. </div>
  17. <table class="layui-hide" id="List" lay-filter="List"></table>
  18. <script type="text/html" id="act">
  19. <button type="button" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon">&#xe642;</i> 编辑</button>
  20. <button type="button" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete"><i class="layui-icon">&#xe640;</i> 删除</button>
  21. </script>
  22. </div>
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. <script src="{__ADMIN_PATH}js/layuiList.js"></script>
  28. {/block}
  29. {block name="script"}
  30. <script>
  31. layList.form.render();
  32. layList.tableList({o:'List'},layList.U({a:'getSignPosterList'}),function (){
  33. return [
  34. {field: 'id', title: '编号', width:60,align:'center'},
  35. {field: 'sign_time', title: '签到时间',align:'center'},
  36. {field: 'poster', title: '海报', event:'open_image', align: 'center', templet: '<div><img class="avatar" style="cursor: pointer;" height="50" class="open_image" data-image="{{d.poster}}" src="{{d.poster}}" ></div>'},
  37. {field: 'sign_talk', title: '语录',align: 'center'},
  38. {field: 'right', title: '操作',align:'center',toolbar:'#act'},
  39. ];
  40. });
  41. layList.tool(function (layEvent,data,obj) {
  42. switch (layEvent){
  43. case 'delete':
  44. var url=layList.U({a:'delete',q:{id:data.id}});
  45. $eb.$swal('delete',function(){
  46. $eb.axios.get(url).then(function(res){
  47. if(res.status == 200 && res.data.code == 200) {
  48. $eb.$swal('success',res.data.msg);
  49. obj.del();
  50. }else
  51. return Promise.reject(res.data.msg || '删除失败')
  52. }).catch(function(err){
  53. $eb.$swal('error',err);
  54. });
  55. });
  56. break;
  57. case 'edit':
  58. $eb.createModalFrame('编辑',layList.Url({a:'edit',p:{id:data.id}}));
  59. break;
  60. case 'open_image':
  61. $eb.openImage(data.poster);
  62. break;
  63. }
  64. });
  65. </script>
  66. {/block}