add.html 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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-2">关键字名称<font>*</font>
  9. </td>
  10. <td>
  11. <input type="hidden" name="id" value="{$id}" />
  12. <input type="text" name="title" lay-verify="required" lay-reqText="请输入关键字名称" autocomplete="off" placeholder="请输入关键字名称"
  13. class="layui-input" {notempty name="$keywords.title"}
  14. value="{$keywords.title}" {/notempty}>
  15. </td>
  16. <td class="layui-td-gray">排序</td>
  17. <td><input type="text" name="sort" placeholder="请输入排序,数字" autocomplete="off" class="layui-input" {notempty name="$keywords.sort" }value="{$keywords.sort}" {/notempty}>
  18. </td>
  19. <td class="layui-td-gray">状态
  20. </td>
  21. <td>
  22. {if condition="$id eq 0"}
  23. <input type="radio" name="status" value="1" title="正常" checked>
  24. <input type="radio" name="status" value="0" title="禁用">
  25. {else/}
  26. <input type="radio" name="status" value="1" title="正常" {eq name="$keywords.status" value="1"
  27. }checked{/eq}>
  28. <input type="radio" name="status" value="0" title="禁用" {eq name="$keywords.status" value="0"
  29. }checked{/eq}>
  30. {/if}
  31. </td>
  32. </tr>
  33. </table>
  34. <div class="py-3">
  35. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
  36. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  37. </div>
  38. </form>
  39. {/block}
  40. <!-- /主体 -->
  41. <!-- 脚本 -->
  42. {block name="script"}
  43. <script>
  44. const moduleInit = ['tool'];
  45. function gouguInit() {
  46. var form = layui.form,tool=layui.tool;
  47. //监听提交
  48. form.on('submit(webform)', function (data) {
  49. let callback = function (e) {
  50. layer.msg(e.msg);
  51. if (e.code == 0) {
  52. parent.layui.tool.close(1000);
  53. }
  54. }
  55. tool.post("/admin/keywords/add", data.field, callback);
  56. return false;
  57. });
  58. }
  59. </script>
  60. {/block}
  61. <!-- /脚本 -->