notice.html 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. {template 'common/header'}
  2. <div class="we7-page-title">公告管理</div>
  3. <ul class="we7-page-tab">
  4. <li {if $do == 'list'}class="active"{/if}><a href="{php echo url('article/notice/list');}">公告列表</a></li>
  5. <li {if $do == 'category' || $do == 'category_post'}class="active"{/if}><a href="{php echo url('article/notice/category');}">公告分类</a></li>
  6. </ul>
  7. {if $do == 'list'}
  8. <form action="" method="get" class="we7-form" role="form">
  9. <input type="hidden" name="c" value="article">
  10. <input type="hidden" name="a" value="notice">
  11. <input type="hidden" name="do" value="list">
  12. <input type="hidden" name="cateid" value="{$_GPC['cateid']}">
  13. <input type="hidden" name="createtime" value="{$_GPC['createtime']}">
  14. <div class="form-group">
  15. <label class="col-sm-2 control-label">公告分类</label>
  16. <div class="col-sm-8 form-controls">
  17. <div class="btn-group we7-btn-group">
  18. <a href="{php echo filter_url('cateid:0');}" class="btn {if $_GPC['cateid'] == 0}btn-primary{else}btn-default{/if}">不限</a>
  19. {loop $categorys $category}
  20. <a href="{php echo filter_url('cateid:' . $category['id']);}" class="btn {if $_GPC['cateid'] == $category['id']}btn-primary{else}btn-default{/if}">{$category['title']}</a>
  21. {/loop}
  22. </div>
  23. </div>
  24. </div>
  25. <div class="form-group">
  26. <label class="col-sm-2 control-label">添加时间</label>
  27. <div class="col-sm-8 form-controls">
  28. <div class="btn-group we7-btn-group">
  29. <a href="{php echo filter_url('createtime:0');}" class="btn {if $_GPC['createtime'] == 0}btn-primary{else}btn-default{/if}">不限</a>
  30. <a href="{php echo filter_url('createtime:3');}" class="btn {if $_GPC['createtime'] == 3}btn-primary{else}btn-default{/if}">三天内</a>
  31. <a href="{php echo filter_url('createtime:7');}" class="btn {if $_GPC['createtime'] == 7}btn-primary{else}btn-default{/if}">一周内</a>
  32. <a href="{php echo filter_url('createtime:30');}" class="btn {if $_GPC['createtime'] == 30}btn-primary{else}btn-default{/if}">一月内</a>
  33. <a href="{php echo filter_url('createtime:90');}" class="btn {if $_GPC['createtime'] == 90}btn-primary{else}btn-default{/if}">三月内</a>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="form-group">
  38. <label class="col-sm-2 control-label">标题</label>
  39. <div class="input-group col-sm-4 pull-left">
  40. <input class="form-control" name="title" id="" type="text" value="{$_GPC['title']}">
  41. <div class="input-group-btn">
  42. <button class="btn btn-default"><i class="fa fa-search"></i></button>
  43. </div>
  44. </div>
  45. <div class="pull-right">
  46. <a href="javascript:;" data-toggle="modal" data-target="#displaysetting" class="btn btn-primary">排序设置</a>
  47. <a href="{php echo url('article/notice/post');}" class="btn btn-primary">添加公告</a>
  48. </div>
  49. </div>
  50. </form>
  51. <table class="table we7-table table-hover site-list">
  52. <col width="70px"/>
  53. <col width="80px"/>
  54. <col width="150px"/>
  55. <col width="100px"/>
  56. <col width="90px"/>
  57. <col width="80px"/>
  58. <col width="130px"/>
  59. <col width="110px"/>
  60. <tr>
  61. <th>排序</th>
  62. <th>阅读次数</th>
  63. <th>标题</th>
  64. <th>所属分类</th>
  65. <th>在首页显示</th>
  66. <th>是否显示</th>
  67. <th>添加时间</th>
  68. <th class="text-right">操作</th>
  69. </tr>
  70. {loop $notices $notice}
  71. <input type="hidden" name="ids[]" value="{$notice['id']}" />
  72. <tr>
  73. <td>
  74. <span>{$notice['displayorder']}</span>
  75. </td>
  76. <td>
  77. <span>{$notice['click']}</span>
  78. </td>
  79. <td>
  80. <span style="{if !empty($notice['style'])}{if !empty($notice['style']['color'])}color: {php echo $notice['style']['color']};{/if}{if !empty($notice['style']['bold'])}font-weight:bold;{/if}{/if}">{$notice['title']}</span>
  81. </td>
  82. <td>{$categorys[$notice['cateid']]['title']}</td>
  83. <td>
  84. {if $notice['is_show_home'] == 1}
  85. <span class="label label-success">是</span>
  86. {else}
  87. <span class="label label-danger">否</span>
  88. {/if}
  89. </td>
  90. <td>
  91. {if $notice['is_display'] == 1}
  92. <span class="label label-success">显示中</span>
  93. {else}
  94. <span class="label label-danger">已隐藏</span>
  95. {/if}
  96. </td>
  97. <td>{php echo date('Y-m-d H:i', $notice['createtime']);}</td>
  98. <td>
  99. <div class="link-group">
  100. <a href="{php echo url('article/notice/post', array('id' => $notice['id']));}">编辑</a>
  101. <a href="{php echo url('article/notice/del', array('id' => $notice['id']));}" class="del" onclick="if(!confirm('确定删除吗')) return false;">删除</a>
  102. </div>
  103. </td>
  104. </tr>
  105. {/loop}
  106. </table>
  107. <div class="modal fade" id="displaysetting" tabindex="-1" role="dialog" aria-hidden="true">
  108. <div class="we7-modal-dialog modal-dialog we7-form">
  109. <div class="modal-content">
  110. <div class="modal-header">
  111. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
  112. <div class="modal-title">修改公告排序设置</div>
  113. </div>
  114. <form action="" method="get">
  115. <input type="hidden" name="c" value="article">
  116. <input type="hidden" name="a" value="notice">
  117. <input type="hidden" name="do" value="displaysetting">
  118. <div class="modal-body">
  119. <div class="form-group">
  120. <select name="setting" class="we7-select">
  121. <option value="order">按排序数字大小倒序</option>
  122. <option value="createtime">按添加时间倒序</option>
  123. </select>
  124. <span class="help-block"></span>
  125. </div>
  126. </div>
  127. <div class="modal-footer">
  128. <button name="submit" class="btn btn-primary" value="submit">确定</button>
  129. <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
  130. </div>
  131. </form>
  132. </div>
  133. </div>
  134. </div>
  135. <div class="text-right">
  136. {$pager}
  137. </div>
  138. {elseif $do == 'post'}
  139. <div class="clearfix">
  140. <form action="{php echo url('article/notice/post');}" method="post" class="form-horizontal" role="form" id="form1">
  141. <input type="hidden" name="id" value="{$notice['id']}"/>
  142. <div class="panel panel-default">
  143. <div class="panel-body">
  144. <div class="form-group">
  145. <label class="col-sm-2 control-label">公告标题</label>
  146. <div class="col-sm-8 col-lg-9 col-xs-12">
  147. <input type="text" class="form-control" name="title" value="{$notice['title']}" placeholder="公告标题"/>
  148. <div class="help-block">请填写公告标题</div>
  149. </div>
  150. </div>
  151. <div class="form-group">
  152. <label class="col-sm-2 control-label">公告分类</label>
  153. <div class="col-sm-8 col-lg-9 col-xs-12">
  154. <select name="cateid" id="cateid" class="form-control">
  155. <option value="">==请选择公告分类==</option>
  156. {loop $categorys $category}
  157. <option value="{$category['id']}" {if $notice['cateid'] == $category['id']}selected{/if}>{$category['title']}</option>
  158. {/loop}
  159. </select>
  160. <div class="help-block">还没有分类,点我 <a href="{php echo url('article/notice/category_post');}" target="_blank"><i class="fa fa-plus-circle"></i> 添加分类</a></div>
  161. </div>
  162. </div>
  163. <div class="form-group">
  164. <label class="col-sm-2 control-label">内容</label>
  165. <div class="col-sm-8 col-lg-9 col-xs-12">
  166. {php echo tpl_ueditor('content', $notice['content']);}
  167. </div>
  168. </div>
  169. <div class="form-group">
  170. <label class="col-sm-2 control-label">阅读次数</label>
  171. <div class="col-sm-8 col-lg-9 col-xs-12">
  172. <input type="text" class="form-control" name="click" value="{$notice['click']}" placeholder="阅读次数"/>
  173. <div class="help-block">默认为0。您可以设置一个初始值,阅读次数会在该初始值上增加。</div>
  174. </div>
  175. </div>
  176. <div class="form-group">
  177. <label class="col-sm-2 control-label">排序</label>
  178. <div class="col-sm-8 col-lg-9 col-xs-12">
  179. <input type="text" class="form-control" name="displayorder" value="{$notice['displayorder']}" placeholder="阅读次数"/>
  180. <div class="help-block">数字越大,越靠前。</div>
  181. </div>
  182. </div>
  183. <div class="form-group">
  184. <label class="col-sm-2 control-label">是否显示</label>
  185. <div class="col-sm-8 col-lg-9 col-xs-12">
  186. <input type="radio" id="is_display-1" name="is_display" value="1" {if $notice['is_display'] == 1} checked{/if}> <label class="radio-inline" for="is_display-1">显示</label>
  187. <input type="radio" id="is_display-2" name="is_display" value="0" {if $notice['is_display'] == 0} checked{/if}> <label class="radio-inline" for="is_display-2">不显示</label>
  188. </div>
  189. </div>
  190. <div class="form-group">
  191. <label class="col-sm-2 control-label">显示在首页</label>
  192. <div class="col-sm-8 col-lg-9 col-xs-12">
  193. <input type="radio" id="is_show_home-1" name="is_show_home" value="1" {if $notice['is_show_home'] == 1} checked{/if}> <label class="radio-inline" for="is_show_home-1">是</label>
  194. <input type="radio" id="is_show_home-2" name="is_show_home" value="0" {if $notice['is_show_home'] == 0} checked{/if}> <label class="radio-inline" for="is_show_home-2">否</label>
  195. </div>
  196. </div>
  197. </div>
  198. </div>
  199. <div class="form-group">
  200. <div class="col-sm-8 col-lg-9 col-xs-12">
  201. <input type="submit" class="btn btn-primary" name="submit" value="提交" />
  202. <input type="hidden" name="token" value="{$_W['token']}" />
  203. </div>
  204. </div>
  205. </form>
  206. </div>
  207. {/if}
  208. <script>
  209. $(function(){
  210. $('#form1').submit(function(){
  211. if(!$.trim($(':text[name="title"]').val())) {
  212. util.message('请填写公告标题', '', 'error');
  213. return false;
  214. }
  215. if(!$.trim($('#cateid').val())) {
  216. util.message('请选择公告分类', '', 'error');
  217. return false;
  218. }
  219. if(!$.trim($('textarea[name="content"]').val())) {
  220. util.message('请填写公告内容', '', 'error');
  221. return false;
  222. }
  223. return true;
  224. });
  225. });
  226. </script>
  227. {template 'common/footer'}