add.html 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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="name" lay-verify="required" autocomplete="off" placeholder="请输入分类名" lay-reqText="请输入分类名" class="layui-input" {notempty name="$cate.name" }value="{$cate.name}" {/notempty}>
  12. </td>
  13. <td class="layui-td-gray">排序</td>
  14. <td>
  15. <input type="text" name="sort" autocomplete="off" placeholder="请输入排序" class="layui-input" {notempty name="$cate.sort" }value="{$cate.sort}" {else/} value="0"{/notempty}>
  16. </td>
  17. </tr>
  18. </table>
  19. <div class="py-3">
  20. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
  21. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  22. </div>
  23. </form>
  24. {/block}
  25. <!-- /主体 -->
  26. <!-- 脚本 -->
  27. {block name="script"}
  28. <script>
  29. const moduleInit = ['tool'];
  30. function gouguInit() {
  31. var form = layui.form,tool=layui.tool;
  32. //监听提交
  33. form.on('submit(webform)', function (data) {
  34. let callback = function (e) {
  35. layer.msg(e.msg);
  36. if (e.code == 0) {
  37. parent.layui.tool.close(1000);
  38. }
  39. }
  40. tool.post("/admin/sitemap/add", data.field, callback);
  41. return false;
  42. });
  43. }
  44. </script>
  45. {/block}
  46. <!-- /脚本 -->