news-post.html 9.5 KB

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