edit.html 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <link rel="stylesheet" href="/static/editor.md/css/editormd.min.css" />
  2. <div class="layui-layout layui-layout-admin" style="padding-left: 40px;margin-top: 20px;">
  3. <form class="layui-form" action="" method="post">
  4. <div class="layui-form-item">
  5. <label class="layui-form-label">标题</label>
  6. <div class="layui-input-block " style="width: 400px">
  7. <input type="hidden" name="id" id="id" value="{{.info.Id}}" >
  8. <input type="text" name="title" id="title" lay-verify="required" autocomplete="off" placeholder="请输入标题" class="layui-input" value="{{.info.Title}}">
  9. </div>
  10. </div>
  11. <div class="layui-form-item">
  12. <label class="layui-form-label">内容</label>
  13. <div class="layui-input-inline" id="api-editormd" style="border: 1px solid #e4e4e4">
  14. <textarea name="content" id="content" style="display:none;">
  15. {{.info.Content}}
  16. </textarea>
  17. </div>
  18. </div>
  19. <div class="layui-form-item">
  20. <div class="layui-input-block">
  21. <button class="layui-btn" lay-submit="" lay-filter="sub">保存</button>
  22. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  23. </div>
  24. </div>
  25. </form>
  26. </div>
  27. <script>
  28. var apiEditor;
  29. layui.use(['form','element','table','layer','jquery'],function(){
  30. var form = layui.form; //只有执行了这一步,部分表单元素才会自动修饰成功
  31. var $ = layui.jquery;
  32. var table = layui.table;
  33. form.on('submit(sub)', function(data){
  34. var form_data = data.field;
  35. $.post('{{urlfor "PropertyNoticeController.Edit"}}', form_data, function (out) {
  36. if (out.status == 0) {
  37. layer.msg("操作成功",{icon: 1},function () {
  38. window.location.href="/propertynotice/index";
  39. })
  40. } else {
  41. layer.msg(out.message)
  42. }
  43. }, "json");
  44. return false;
  45. });
  46. form.render();
  47. });
  48. </script>
  49. {{template "public/editormd.html" .}}