noticeform.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <div class="layui-fluid">
  2. <div class="layui-row layui-col-space15">
  3. <div class="layui-col-md12">
  4. <div class="layui-card">
  5. <div class="layui-card-header">通知公告信息</div>
  6. <div class="layui-card-body" pad15>
  7. <div class="layui-form layui-form-pane" lay-filter="LAY-artapp-notice-noticeform-edit">
  8. <input type="hidden" name="id" value="{$notice.id}">
  9. <div class="layui-form-item">
  10. <label class="layui-form-label">分类</label>
  11. <div class="layui-input-block">
  12. <select name="cateid">
  13. {volist name="catelist" id="vo"}
  14. <option value="{$vo.id}" {$notice.cateid==$vo.id ? 'selected' : '' }>{$vo.title}</option>
  15. {/volist}
  16. </select>
  17. </div>
  18. </div>
  19. <div class="layui-form-item">
  20. <label class="layui-form-label"><span style="color:#f90c05;">*</span>标题</label>
  21. <div class="layui-input-block">
  22. <input type="text" name="title" value="{$notice.title}" lay-verify="required" placeholder="请输入标题" autocomplete="off"
  23. class="layui-input">
  24. </div>
  25. </div>
  26. <div class="layui-form-item">
  27. <label class="layui-form-label">详情</label>
  28. <div class="layui-input-block">
  29. <textarea class="layui-textarea" name="details" id="details" placeholder="请输入详情" style="display: none"
  30. lay-verify="editcontent">
  31. {$notice.details}
  32. </textarea>
  33. </div>
  34. </div>
  35. <div class="layui-form-item">
  36. <label class="layui-form-label"><span style="color:#f90c05;">*</span>发布时间</label>
  37. <div class="layui-input-block">
  38. <input type="text" name="createtime" id="createtime" value="{$notice.createtime}" lay-verify="required"
  39. placeholder="请选择发布时间" autocomplete="off" class="layui-input">
  40. </div>
  41. </div>
  42. <div class="layui-form-item">
  43. <label class="layui-form-label">置顶</label>
  44. <div class="layui-input-block">
  45. <select name="priority">
  46. <option value="0" {$notice.priority===0 ? 'selected' : '' }>不置顶</option>
  47. <option value="1" {$notice.priority===1 ? 'selected' : '' }>置顶一</option>
  48. <option value="2" {$notice.priority===2 ? 'selected' : '' }>置顶二</option>
  49. <option value="3" {$notice.priority===3 ? 'selected' : '' }>置顶三</option>
  50. <option value="4" {$notice.priority===4 ? 'selected' : '' }>置顶四</option>
  51. <option value="5" {$notice.priority===5 ? 'selected' : '' }>置顶五</option>
  52. <option value="6" {$notice.priority===6 ? 'selected' : '' }>置顶六</option>
  53. <option value="7" {$notice.priority===7 ? 'selected' : '' }>置顶七</option>
  54. <option value="8" {$notice.priority===8 ? 'selected' : '' }>置顶八</option>
  55. <option value="9" {$notice.priority===9 ? 'selected' : '' }>置顶九</option>
  56. </select>
  57. <div class="layui-form-mid layui-word-aux">倒序,值越大越靠前</div>
  58. </div>
  59. </div>
  60. <div class="layui-form-item" pane>
  61. <label class="layui-form-label">状态</label>
  62. <div class="layui-input-block">
  63. <input type="checkbox" lay-filter="switch" name="status" {eq name="notice.status|default=1" value="1" }checked{/eq}
  64. lay-skin="switch" lay-text="已发布|待修改" value="1">
  65. </div>
  66. </div>
  67. <div class="layui-form-item">
  68. <label class="layui-form-label">浏览量</label>
  69. <div class="layui-input-block">
  70. <input type="text" name="volume" value="{$notice.volume|default=0}" lay-verify="required|number" placeholder="请输入浏览量"
  71. autocomplete="off" class="layui-input">
  72. </div>
  73. </div>
  74. <div class="layui-form-item">
  75. <div class="layui-input-block">
  76. <input type="button" lay-submit lay-filter="LAY-artapp-notice-noticeform-edit-submit" value="确认提交" class="layui-btn">
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. <script>
  86. layui.config({
  87. base: '/static/echoui/' //静态资源所在路径
  88. }).extend({
  89. index: 'lib/index' //主入口模块
  90. }).use(['index', 'form', 'set', 'layedit', 'laydate', 'upload'], function() {
  91. var $ = layui.$,
  92. setter = layui.setter,
  93. admin = layui.admin,
  94. layedit = layui.layedit,
  95. laydate = layui.laydate,
  96. form = layui.form,
  97. upload = layui.upload;
  98. form.render();
  99. var details = layedit.build('details', {
  100. uploadImage: { url: setter.baseAdminUrl + 'attachment/tplfieldimage', type: 'post' }
  101. });
  102. form.verify({
  103. editcontent: function(value) {
  104. layedit.sync(details);
  105. }
  106. });
  107. laydate.render({
  108. elem: '#createtime',
  109. type: 'datetime'
  110. });
  111. form.on('submit(LAY-artapp-notice-noticeform-edit-submit)', function(obj) {
  112. var index = parent.layer.getFrameIndex(window.name);
  113. admin.req({
  114. url: setter.baseAdminUrl + 'notice/editnotice',
  115. type: 'post',
  116. data: obj.field,
  117. done: function(res) {
  118. layer.msg("提交成功", {
  119. icon: 1
  120. });
  121. parent.layui.table.reload('LAY-artapp-notice-noticelist-table'); //重载表格
  122. parent.layer.close(index);
  123. }
  124. });
  125. });
  126. });
  127. </script>