人人商城

notice-post.html 9.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. {template 'common/header'}
  2. <ol class="breadcrumb we7-breadcrumb">
  3. <a href="{php echo url('article/notice/list');}"><i class="wi wi-back-circle"></i> </a>
  4. <li>
  5. <a href="{php echo url('article/notice/list');}">公告列表</a>
  6. </li>
  7. <li>
  8. 添加公告
  9. </li>
  10. </ol>
  11. {if $do == 'post'}
  12. <form action="{php echo url('article/notice/post');}" method="post" class="we7-form" role="form" id="form1">
  13. <input type="hidden" name="id" value="{$notice['id']}"/>
  14. <div class="form-group">
  15. <label class="col-sm-2 control-label">用户组</label>
  16. <div class="col-sm-8 col-lg-9 col-xs-12">
  17. <span class="users-group-selected">全部</span><span class="btn btn-link color-default" data-toggle="modal" data-target="#users-group">修改</span>
  18. <span class="help-block">请选择哪些用户组可见,不设置代表全部用户组可见</span>
  19. </div>
  20. </div>
  21. {if !empty($user_vice_founder_groups)}
  22. <div class="form-group">
  23. <label class="col-sm-2 control-label">副创始人用户组</label>
  24. <div class="col-sm-8 col-lg-9 col-xs-12">
  25. <span class="vice-founder-group-selected">全部</span><span class="btn btn-link color-default" data-toggle="modal" data-target="#vice-founder-group">修改</span>
  26. <span class="help-block">请选择哪些副创始人用户组可见,不设置代表全部副创始人用户组可见</span>
  27. </div>
  28. </div>
  29. {/if}
  30. <div class="form-group">
  31. <label class="col-sm-2 control-label">公告标题</label>
  32. <div class="col-sm-8 col-lg-9 col-xs-12">
  33. <input type="text" class="form-control" name="title" value="{$notice['title']}" placeholder="公告标题"/>
  34. <div class="help-block">请填写公告标题</div>
  35. </div>
  36. </div>
  37. <div class="form-group">
  38. <label class="col-md-2 control-label">标题颜色</label>
  39. <div class="col-sm-8 col-sm-9 col-xs-12">
  40. {php echo tpl_form_field_color('style[color]', $notice['style']['color']);}
  41. <span class="help-block">标题颜色,在列表中显示对应颜色,默认随系统</span>
  42. </div>
  43. </div>
  44. <div class="form-group">
  45. <label class="col-md-2 control-label">标题加粗</label>
  46. <div class="col-sm-8 col-sm-9 col-xs-12">
  47. <input type="radio" name="style[bold]" id="is_bold-1" value="1" {if $notice['style']['bold'] == 1} checked{/if}>
  48. <label class="radio-inline" for="is_bold-1">是</label>
  49. <input type="radio" name="style[bold]" id="is_bold-0" value="0" {if $notice['style']['bold'] == 0} checked{/if}>
  50. <label class="radio-inline" for="is_bold-0"> 否</label>
  51. <span class="help-block">标题加粗,在列表中显示,默认不加粗</span>
  52. </div>
  53. </div>
  54. <div class="form-group">
  55. <label class="col-sm-2 control-label">公告分类</label>
  56. <div class="col-sm-8 col-lg-9 col-xs-12">
  57. <select name="cateid" id="cateid" class="form-control">
  58. <option value="">==请选择公告分类==</option>
  59. {loop $categorys $category}
  60. <option value="{$category['id']}" {if $notice['cateid'] == $category['id']}selected{/if}>{$category['title']}</option>
  61. {/loop}
  62. </select>
  63. <div class="help-block">还没有分类,点我 <a href="{php echo url('article/notice/category_post');}" target="_blank"><i class="fa fa-plus-circle"></i> 添加分类</a></div>
  64. </div>
  65. </div>
  66. <div class="form-group">
  67. <label class="col-sm-2 control-label">内容</label>
  68. <div class="col-sm-8 col-lg-9 col-xs-12">
  69. {php echo tpl_ueditor('content', $notice['content']);}
  70. </div>
  71. </div>
  72. <div class="form-group">
  73. <label class="col-sm-2 control-label">阅读次数</label>
  74. <div class="col-sm-8 col-lg-9 col-xs-12">
  75. <input type="text" class="form-control" name="click" value="{$notice['click']}" placeholder="阅读次数"/>
  76. <div class="help-block">默认为0。您可以设置一个初始值,阅读次数会在该初始值上增加。</div>
  77. </div>
  78. </div>
  79. <div class="form-group">
  80. <label class="col-sm-2 control-label">排序</label>
  81. <div class="col-sm-8 col-lg-9 col-xs-12">
  82. <input type="text" class="form-control" name="displayorder" value="{$notice['displayorder']}" placeholder="排序"/>
  83. <div class="help-block">数字越大,越靠前。</div>
  84. </div>
  85. </div>
  86. <div class="form-group">
  87. <label class="col-sm-2 control-label">是否显示</label>
  88. <div class="col-sm-8 col-lg-9 col-xs-12">
  89. <input type="radio" id="is_display-1" name="is_display" value="1" {if $notice['is_display'] == 1} checked{/if}>
  90. <label class="radio-inline" for="is_display-1">显示</label>
  91. <input type="radio" name="is_display" id="is_display-0" value="0" {if $notice['is_display'] == 0} checked{/if}>
  92. <label class="radio-inline" for="is_display-0"> 不显示</label>
  93. </div>
  94. </div>
  95. <div class="form-group">
  96. <label class="col-sm-2 control-label">显示在首页</label>
  97. <div class="col-sm-8 col-lg-9 col-xs-12">
  98. <input type="radio" name="is_show_home" id="is_show_home-1" value="1" {if $notice['is_show_home'] == 1} checked{/if}>
  99. <label class="radio-inline" for="is_show_home-1">是</label>
  100. <input type="radio" name="is_show_home" id="is_show_home-0" value="0" {if $notice['is_show_home'] == 0} checked{/if}>
  101. <label class="radio-inline" for="is_show_home-0"> 否</label>
  102. </div>
  103. </div>
  104. <div class="modal" id="users-group">
  105. <div class="modal-dialog">
  106. <div class="modal-content">
  107. <div class="modal-header">
  108. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  109. <h3 class="modal-title">选择用户组</h3>
  110. </div>
  111. <div class="modal-body we7-form">
  112. <div class="form-group">
  113. {if !empty($user_groups)}
  114. {loop $user_groups $key $group}
  115. <div class="col-sm-4">
  116. <div class="checkbox">
  117. <input id="check-child-{$key}" type="checkbox" value="{$group['id']}" name="group[]" {if in_array($group['id'], $notice['group']['normal'])}checked = "checked"{/if}>
  118. <label for="check-child-{$key}">{$group['name']}</label>
  119. </div>
  120. </div>
  121. {/loop}
  122. {else}
  123. <div class="text-center">暂无数据</div>
  124. {/if}
  125. </div>
  126. </div>
  127. <div class="modal-footer">
  128. <button type="button" class="btn btn-primary confirm-users-group">确认</button>
  129. <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
  130. </div>
  131. </div>
  132. </div>
  133. </div>
  134. <div class="modal" id="vice-founder-group">
  135. <div class="modal-dialog">
  136. <div class="modal-content">
  137. <div class="modal-header">
  138. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  139. <h3 class="modal-title">选择副创始人组</h3>
  140. </div>
  141. <div class="modal-body we7-form">
  142. <div class="form-group">
  143. {if !empty($user_vice_founder_groups)}
  144. {loop $user_vice_founder_groups $key $vice_founder_group}
  145. <div class="col-sm-4">
  146. <div class="checkbox">
  147. <input id="check-child-{$key}-{$key}" type="checkbox" value="{$vice_founder_group['id']}" name="vice_founder_group[]" {if in_array($vice_founder_group['id'], $notice['group']['vice_founder'])}checked{/if}>
  148. <label for="check-child-{$key}-{$key}">{$vice_founder_group['name']}</label>
  149. </div>
  150. </div>
  151. {/loop}
  152. {else}
  153. <div class="text-center">暂无数据</div>
  154. {/if}
  155. </div>
  156. </div>
  157. <div class="modal-footer">
  158. <button type="button" class="btn btn-primary confirm-vice-founder-group">确认</button>
  159. <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
  160. </div>
  161. </div>
  162. </div>
  163. </div>
  164. <div class="form-group">
  165. <div class="">
  166. <input type="submit" class="btn btn-primary" name="submit" value="提交" />
  167. <input type="hidden" name="token" value="{$_W['token']}" />
  168. </div>
  169. </div>
  170. </form>
  171. {/if}
  172. <script>
  173. $(function(){
  174. var initChecked = function(type) {
  175. var type = type == 'users-group' ? 'users-group' : 'vice-founder-group';
  176. var inputtag = $('#' + type).find("input[type='checkbox']");
  177. var html = '';
  178. for (i in inputtag) {
  179. if (inputtag[i].checked) {
  180. html += '<span class="label label-primary">' + $(inputtag[i]).parent().find('label').text() + '</span> ';
  181. }
  182. }
  183. if (html) {
  184. $("." + type + '-selected').html(html);
  185. } else {
  186. $("." + type + '-selected').html('全部');
  187. }
  188. };
  189. initChecked('users-group');
  190. initChecked('vice-founder-group');
  191. $('.confirm-users-group').click(function() {
  192. initChecked('users-group');
  193. $('#users-group').modal('hide');
  194. });
  195. $('.confirm-vice-founder-group').click(function() {
  196. initChecked('vice-founder-group');
  197. $('#vice-founder-group').modal('hide');
  198. });
  199. $('#form1').submit(function(){
  200. if(!$.trim($(':text[name="title"]').val())) {
  201. util.message('请填写公告标题', '', 'error');
  202. return false;
  203. }
  204. if(!$.trim($('#cateid').val())) {
  205. util.message('请选择公告分类', '', 'error');
  206. return false;
  207. }
  208. if(!$.trim($('textarea[name="content"]').val())) {
  209. util.message('请填写公告内容', '', 'error');
  210. return false;
  211. }
  212. return true;
  213. });
  214. });
  215. </script>
  216. {template 'common/footer'}