hlep.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. {include file="common/header"/}
  2. <style>
  3. .upload-wrap {
  4. position: relative;
  5. display: inline-block;
  6. overflow: hidden;
  7. border: 1px solid #2d78f4;
  8. border-radius: 3px;
  9. }
  10. .upload-wrap .file-ele {
  11. position: absolute;
  12. top: 0;
  13. right: 0;
  14. opacity: 0;
  15. height: 100%;
  16. width: 100%;
  17. cursor: pointer;
  18. }
  19. .upload-wrap .file-open {
  20. width: 90px;
  21. height: 30px;
  22. line-height: 30px;
  23. text-align: center;
  24. color: #fff;
  25. background: #3385ff;
  26. }
  27. </style>
  28. <div class="LM-container">
  29. <div class="LM-main">
  30. <fieldset class="layui-elem-field layui-field-title">
  31. <legend>常见问题</legend>
  32. <blockquote class="layui-elem-quote">
  33. <div class="LM-table">
  34. <a href="{:url('addhlep')}" class="layui-btn layui-btn-sm layui-btn-warm">添加常见问题</a>
  35. </div>
  36. </blockquote>
  37. </fieldset>
  38. <table class="layui-table" id="list" lay-filter="list">
  39. </table>
  40. </div>
  41. </div>
  42. <script type="text/html" id="barDemo">
  43. <input type="button" class="layui-btn layui-btn-xs" lay-event="del" value="删除">
  44. <a href="addhlep?id={{d.id}}" class="layui-btn layui-btn-xs" >编辑</a>
  45. </script>
  46. {include file="common/footer"/}
  47. <script src="/static/plugins/jquery-3.4.1/jquery-3.4.1.min.js"></script>
  48. <script>
  49. layui.use(['form', 'table'], function () {
  50. var $ = layui.jquery,
  51. form = layui.form,
  52. table = layui.table;
  53. var tableIn = table.render({
  54. elem: '#list',
  55. url: '{:url("hlep")}',
  56. method: 'post',
  57. title: '反馈意见',
  58. loading: true,
  59. toolbar: '#toolbar', //开启头部工具栏,并为其绑定左侧模板
  60. defaultToolbar: ['filter', 'exports', 'print', "excel", { //自定义头部工具栏右侧图标。如无需自定义,去除该参数即可
  61. title: '提示'
  62. , layEvent: 'LAYTABLE_TIPS'
  63. , icon: 'layui-icon-tips'
  64. }],
  65. cols: [[
  66. // {checkbox: true, fixed: true},
  67. {field: 'id', title: 'ID', width: 80, fixed: true, sort: true},
  68. {field: 'name', title: '标题', width: 200, sort: true},
  69. {field: 'text', title: '说明', width: 500, sort: true},
  70. {title: '操作', width: 150, align: "center", toolbar: "#barDemo"},
  71. ]],
  72. limits: [10, 15, 20, 25, 50, 100],
  73. limit: 10,
  74. page: true
  75. });
  76. table.on('tool(list)', function (obj) {
  77. var data = obj.data;
  78. let event = obj.event;
  79. switch (event) {
  80. case "del":
  81. layer.confirm('确定要删除吗', function (index) {
  82. loading = layer.load(1, {shade: [0.1, '#fff']});
  83. $.post("{:url('del_hlep')}", {id: data.id}, function (res) {
  84. layer.close(loading);
  85. layer.close(index);
  86. if (res.code == 200) {
  87. layer.msg(res.msg, {time: 1000, icon: 1});
  88. tableIn.reload();
  89. } else {
  90. layer.msg(res.msg, {time: 1000, icon: 2});
  91. }
  92. }, "json")
  93. })
  94. break;
  95. }
  96. });
  97. form.on('switch(status)', function (data) {
  98. });
  99. $('#search').click(function () {
  100. var $keys = $('#name').val();
  101. if (!$keys) {
  102. return layer.msg('请输入关键词');
  103. }
  104. tableIn.reload({page: {page: 1}, where: {name: $keys}});
  105. })
  106. // setInterval(function () {
  107. // tableIn.reload();
  108. // }, 50000)
  109. });
  110. </script>