人人商城

notice.html 9.7KB

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