edit.html 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. <select name="pid" lay-verify="required" lay-reqText="请选择父级分类">
  11. <option value="0">作为顶级分类</option>
  12. {volist name=":set_recursion(get_article_cate())" id="v"}
  13. <option value="{$v.id}" {eq name="$detail.pid" value="$v.id" }selected="" {/eq}>{$v.title}</option>
  14. {/volist}
  15. </select>
  16. </td>
  17. <td class="layui-td-gray">排序</td>
  18. <td>
  19. <input type="text" name="sort" placeholder="请输入排序,数字" autocomplete="off" class="layui-input" value="{$detail.sort}">
  20. </td>
  21. </tr>
  22. <tr>
  23. <td class="layui-td-gray">分类名称<font>*</font></td>
  24. <td>
  25. <input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入分类名称" class="layui-input" value="{$detail.title}">
  26. </td>
  27. <td class="layui-td-gray">关键词</td>
  28. <td>
  29. <input type="text" name="keywords" placeholder="请输入关键词,用“,”隔开,可空" autocomplete="off" class="layui-input" value="{$detail.keywords}">
  30. </td>
  31. </tr>
  32. <tr>
  33. <td class="layui-td-gray">描述</td>
  34. <td colspan="3">
  35. <textarea name="desc" placeholder="请输入描述,可空" class="layui-textarea">{$detail.desc}</textarea>
  36. </td>
  37. </tr>
  38. </table>
  39. <div class="py-3">
  40. <input type="hidden" name="id" value="{$detail.id}" />
  41. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
  42. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  43. </div>
  44. </form>
  45. {/block}
  46. <!-- /主体 -->
  47. <!-- 脚本 -->
  48. {block name="script"}
  49. <script>
  50. const moduleInit = ['tool'];
  51. function gouguInit() {
  52. var form = layui.form, tool = layui.tool;
  53. //监听提交
  54. form.on('submit(webform)', function (data) {
  55. let callback = function (e) {
  56. layer.msg(e.msg);
  57. if (e.code == 0) {
  58. setTimeout(function () {
  59. parent.location.reload();
  60. }, 1000);
  61. }
  62. }
  63. tool.post("/admin/article_cate/edit", data.field, callback);
  64. return false;
  65. });
  66. }
  67. </script>
  68. {/block}
  69. <!-- /脚本 -->