add.html 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. {extend name="common/base"/}
  2. <!-- 主体 -->
  3. {block name="body"}
  4. <form class="layui-form p-4">
  5. <h3 class="pb-3">轮播组</h3>
  6. <table class="layui-table layui-table-form">
  7. <tr>
  8. <td class="layui-td-gray">标题<font>*</font></td>
  9. <td>
  10. <input type="hidden" name="id" value="{$id}" />
  11. <input type="text" name="title" lay-verify="required" lay-reqText="请输入标题" autocomplete="off" placeholder="请输入标题" class="layui-input" {notempty name="$slide.title" }value="{$slide.title}" {/notempty}>
  12. </td>
  13. <td class="layui-td-gray">标识</td>
  14. <td><input type="text" name="name" lay-verify="required" autocomplete="off" placeholder="请输入标识" lay-reqText="请输入标识" class="layui-input" {notempty name="$slide.name" }value="{$slide.name}" {/notempty}></td>
  15. </tr>
  16. <tr>
  17. <td class="layui-td-gray">状态<font>*</font></td>
  18. <td colspan="3">
  19. {if condition="$id eq 0"}
  20. <input type="radio" name="status" value="1" title="正常" checked>
  21. <input type="radio" name="status" value="-1" title="禁用">
  22. {else/}
  23. <input type="radio" name="status" value="1" title="正常" {eq name="$slide.status" value="1" }checked{/eq}>
  24. <input type="radio" name="status" value="-1" title="禁用" {eq name="$slide.status" value="-1"
  25. }checked{/eq}>
  26. {/if}
  27. </td>
  28. </tr>
  29. <tr>
  30. <td class="layui-td-gray">备注</td>
  31. <td colspan="3">
  32. <textarea name="desc" placeholder="请输入备注" class="layui-textarea">{notempty name="$slide.desc" }{$slide.desc}{/notempty}</textarea>
  33. </td>
  34. </tr>
  35. </table>
  36. <div style="padding: 10px 0">
  37. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
  38. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  39. </div>
  40. </form>
  41. {/block}
  42. <!-- /主体 -->
  43. <!-- 脚本 -->
  44. {block name="script"}
  45. <script>
  46. const moduleInit = ['tool'];
  47. function gouguInit() {
  48. var form = layui.form,tool=layui.tool;
  49. //监听提交
  50. form.on('submit(webform)', function (data) {
  51. let callback = function (e) {
  52. layer.msg(e.msg);
  53. if (e.code == 0) {
  54. parent.layui.tool.close(1000);
  55. }
  56. }
  57. tool.post("/admin/slide/add", data.field, callback);
  58. return false;
  59. });
  60. }
  61. </script>
  62. {/block}
  63. <!-- /脚本 -->