人人商城

category.html 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. {template 'common/header'}
  2. <ul class="nav nav-tabs">
  3. <li {if $do == 'display'}class="active"{/if}><a href="{php echo url('site/category/display');}">管理</a></li>
  4. <li {if $do == 'post' && empty($id)}class="active"{/if}><a href="{php echo url('site/category/post');}">添加</a></li>
  5. {if $do == 'post' && $id}
  6. <li {if $do == 'post' && !empty($id)}class="active"{/if}><a href="{php echo url('site/category/post', array('id'=>$id));}">编辑</a></li>
  7. {/if}
  8. </ul>
  9. {if $do == 'post'}
  10. <style>
  11. .template .item{position:relative;display:block;float:left;border:1px #ddd solid;border-radius:5px;background-color:#fff;padding:5px;width:190px;margin:0 20px 20px 0; overflow:hidden;}
  12. .template .title{margin:5px auto;line-height:2em;}
  13. .template .title a{text-decoration:none;}
  14. .template .item img{width:178px;height:270px; cursor:pointer;}
  15. .template .active.item-style img, .template .item-style:hover img{width:178px;height:270px;border:3px #009cd6 solid;padding:1px; }
  16. .template .title .fa{display:none}
  17. .template .active .fa.fa-check{display:inline-block;position:absolute;bottom:33px;right:6px;color:#FFF;background:#009CD6;padding:5px;font-size:14px;border-radius:0 0 6px 0;}
  18. .template .fa.fa-times{cursor:pointer;display:inline-block;position:absolute;top:10px;right:6px;color:#D9534F;background:#ffffff;padding:5px;font-size:14px;text-decoration:none;}
  19. .template .fa.fa-times:hover{color:red;}
  20. .template .item-bg{width:100%; height:342px; background:#000; position:absolute; z-index:1; opacity:0.5; margin:-5px 0 0 -5px;}
  21. .template .item-build-div1{position:absolute; z-index:2; margin:-5px 10px 0 5px; width:168px;}
  22. .template .item-build-div2{text-align:center; line-height:30px; padding-top:150px;}
  23. </style>
  24. <div class="main">
  25. <form action="" method="post" class="form-horizontal form" id="form1">
  26. <input type="hidden" name="parentid" value="{$parent['id']}" />
  27. <div class="panel panel-default">
  28. <div class="panel-heading">分类详细设置</div>
  29. <div class="panel-body">
  30. {if !empty($category['name'])}
  31. <div class="form-group">
  32. <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">访问地址</label>
  33. <div class="col-sm-8 col-xs-12">
  34. <div class="form-control-static"><a href="{$_W['siteroot']}/app/index.php?c=site&a=site&cid={$category['id']}&i={$_W['uniacid']}" target="_blank">/app/index.php?c=site&a=site&cid={$category['id']}&i={$_W['uniacid']}</a></div>
  35. <span class="help-block">您可以根据此地址,添加回复规则,设置访问。</span>
  36. </div>
  37. </div>
  38. {/if}
  39. {if !empty($parentid)}
  40. <div class="form-group">
  41. <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">上级分类</label>
  42. <div class="col-sm-8 col-xs-12">
  43. <div class="form-control-static">{$parent['name']}</div>
  44. </div>
  45. </div>
  46. {/if}
  47. <div class="form-group">
  48. <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">排序</label>
  49. <div class="col-sm-8 col-xs-12">
  50. <input type="text" name="displayorder" class="form-control" value="{$category['displayorder']}" />
  51. </div>
  52. </div>
  53. <div class="form-group">
  54. <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">分类名称</label>
  55. <div class="col-sm-8 col-xs-12">
  56. <input type="text" name="cname" class="form-control" value="{$category['name']}" />
  57. </div>
  58. </div>
  59. <div class="form-group">
  60. <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">分类描述</label>
  61. <div class="col-sm-8 col-xs-12">
  62. <textarea name="description" class="form-control" cols="70">{$category['description']}</textarea>
  63. </div>
  64. </div>
  65. <div class="form-group">
  66. <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">是否启用</label>
  67. <div class="col-sm-8 col-xs-12">
  68. <label class="radio-inline"><input type="radio" name="enabled" value="1" {if !empty($category['enabled']) || !$id} checked{/if}/> 是</label>
  69. <label class="radio-inline"><input type="radio" name="enabled" value="0" {if empty($category['enabled']) && $id} checked{/if}/> 否</label>
  70. </div>
  71. </div>
  72. <div class="form-group">
  73. <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">是否添加微站首页导航</label>
  74. <div class="col-sm-8 col-xs-12">
  75. <label for="isnav_1" class="radio-inline" onclick="$('.js-site-selector').show();"><input type="radio" name="isnav" id="isnav_1" value="1" autocomplete="off" {if !empty($category['nid'])} checked{/if}/> 是</label>
  76. <label for="isnav_2" class="radio-inline" onclick="$('.js-site-selector').hide();"><input type="radio" name="isnav" id="isnav_2" value="0" autocomplete="off" {if empty($category['nid'])} checked{/if}/> 否</label>
  77. <div class="help-block">开启此选项后,系统在微站首页导航自动生成以分类名称为导航名称的记录.关闭此选项后,系统将删除对应的导航记录</div>
  78. </div>
  79. </div>
  80. <div class="form-group js-site-selector" {if empty($category['nid'])} style="display:none;"{/if}>
  81. <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">分配到微站</label>
  82. <div class="col-sm-8 col-xs-12">
  83. <select class="form-control" name="multiid">
  84. {loop $multis $multi}
  85. <option value="{$multi['id']}" {if $category['nav']['multiid'] == $multi['id'] || $_GPC['mtid'] == $multi['id']}selected{/if}>{$multi['title']}{if $multi['id'] == $default_site}[默认微站]{/if}</option>
  86. {/loop}
  87. </select>
  88. </div>
  89. </div>
  90. <div class="form-group">
  91. <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">是否作为首页使用</label>
  92. <div class="col-sm-8 col-xs-12">
  93. <label for="radio_1" class="radio-inline"><input type="radio" name="ishomepage" id="radio_1" value="1" autocomplete="off" {if !empty($category['ishomepage'])} checked{/if}/> 是</label>
  94. <label for="radio_2" class="radio-inline"><input type="radio" name="ishomepage" id="radio_2" value="0" autocomplete="off" {if empty($category['ishomepage'])} checked{/if}/> 否</label>
  95. <div class="help-block">注意:该选项仅对父级分类有效。开启此选项后,分类模板将直接引用首页模板(home.html[注:该文件在home文件夹下面]]),分类的二级分类将作为导航显示</div>
  96. {if $site_template['sections'] > 0}
  97. <div class="help-block" style="color:red">当前默认微站对应的模板有导航位置限制。如果您希望将该导航链接作为"首页使用"使用,请选择其他分类风格</div>
  98. {/if}
  99. </div>
  100. </div>
  101. <div class="form-group">
  102. <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">当前分类风格</label>
  103. <div class="col-sm-8 col-xs-12">
  104. <div class="template">
  105. <div class="item item-style">
  106. <div class="title">
  107. <div style="overflow:hidden; height:28px;" id="current-title">{$category['style']['name']}</div>
  108. <a href="javascript:;">
  109. <img src="{$_W['siteroot']}app/themes/{$category['style']['tname']}/preview.jpg" id="current-preview" class="img-rounded">
  110. </a>
  111. </div>
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. <div class="form-group">
  117. <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">选择分类风格</label>
  118. <div class="col-sm-8 col-xs-12">
  119. <button type="button" class="btn btn-success" data-toggle="modal" data-target="#ListStyle">选择风格</button>
  120. <input type="hidden" name="styleid" id="styleid" value="{$category['styleid']}" />
  121. <span class="help-block">
  122. 新建分类风格时,请在您选择的风格对应的模板目录下新建“site”文件夹,默认的列表页面为list.html,默认的内容页面为detail.html。
  123. </span>
  124. </div>
  125. </div>
  126. <!-- 风格列表 -->
  127. <div class="modal fade" id="ListStyle" aria-hidden="false" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  128. <div class="modal-dialog modal-lg">
  129. <div class="modal-content">
  130. <div class="modal-header">
  131. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
  132. <h4 class="modal-title">微站模板风格列表</h4>
  133. </div>
  134. <div class="modal-body template clearfix">
  135. {loop $styles $style}
  136. <div class="item item-style {if $category['styleid'] == $style['id']} active {/if}">
  137. <div class="title">
  138. <div class="title-{$style['id']}" style="overflow:hidden; height:28px;">{$style['name']} ({$style['tname']})</div>
  139. <a href="javascript:;" class="change-style" data-styleid="{$style['id']}">
  140. <img src="{$_W['siteroot']}app/themes/{$style['tname']}/preview.jpg" class="img-rounded preview-{$style['id']}">
  141. </a>
  142. <span class="fa fa-check"></span>
  143. </div>
  144. <div class="btn-group btn-group-justified">
  145. <a href="javascript:;" class="btn btn-default btn-xs change-style" data-styleid="{$style['id']}">选择风格</a>
  146. </div>
  147. </div>
  148. {/loop}
  149. </div>
  150. <div class="modal-footer">
  151. <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  152. </div>
  153. </div>
  154. </div>
  155. </div>
  156. <div class="form-group">
  157. <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">直接链接</label>
  158. <div class="col-sm-8 col-xs-12">
  159. <input type="text" class="form-control" placeholder="" name="linkurl" value="{$category['linkurl']}">
  160. <span class="help-block">链接必须是以http://或是https://开头。没有直接链接,请留空</span>
  161. </div>
  162. </div>
  163. </div>
  164. </div>
  165. <div class="panel panel-default" id="style">
  166. <div class="panel-heading">导航样式</div>
  167. <div class="panel-body">
  168. <div class="form-group">
  169. <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">图标类型</label>
  170. <div class="col-sm-8 col-xs-12">
  171. <label for="icontype1" class="radio-inline"><input type="radio" {if empty($category['icontype']) || $category['icontype'] == 1} checked{/if} value="1" name="icontype" id="icontype1" onclick="$('#iconsys').show();$('#iconuser').hide();colorpicker();" autocomplete="off"> 系统内置</label>&nbsp;&nbsp;&nbsp;
  172. <label for="icontype2" class="radio-inline"><input type="radio" {if $category['icontype'] == 2} checked{/if} value="2" name="icontype" id="icontype2" onclick="$('#iconsys').hide();$('#iconuser').show();" autocomplete="off"> 自定义上传</label>
  173. </div>
  174. </div>
  175. <div class="" id="iconsys" {if $category['icontype'] == 2} style="display:none;"{/if}>
  176. <div class="form-group">
  177. <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">系统图标</label>
  178. <div class="col-sm-8 col-xs-12">
  179. <div class="input-group"">
  180. {php echo tpl_form_field_icon('icon[icon]', $category['css']['icon']['icon']);}
  181. </div>
  182. <span class="help-block">导航的背景图标,系统提供了丰富的图标ICON。</span></div>
  183. </div>
  184. <div class="form-group">
  185. <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">图标颜色</label>
  186. <div class="col-sm-8 col-xs-12">
  187. {php echo tpl_form_field_color('icon[color]', $category[css]['icon']['color']);}
  188. <span class="help-block">图标颜色,上传图标时此设置项无效</span>
  189. </div>
  190. </div>
  191. <div class="form-group">
  192. <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">图标大小</label>
  193. <div class="col-sm-8 col-xs-12">
  194. <div class="input-group">
  195. <input class="form-control" type="text" name="icon[size]" id="icon" value="{if $category[css]['icon']['width']}{$category[css]['icon']['width']}{else}35{/if}">
  196. <span class="input-group-addon">PX</span>
  197. </div>
  198. <span class="help-block">图标的尺寸大小,单位为像素,上传图标时此设置项无效</span>
  199. </div>
  200. </div>
  201. </div>
  202. <div class="" id="iconuser" {if empty($category['icontype']) || $category['icontype'] == 1} style="display:none;"{/if}>
  203. <div class="form-group">
  204. <label class="col-xs-12 col-sm-3 col-md-2 control-label">上传图标</label>
  205. <div class="col-sm-9 col-xs-12">
  206. {php echo tpl_form_field_image('iconfile', $category['icon']);}
  207. <span class="help-block">自定义上传图标图片,“系统图标”优先于此项</span>
  208. </div>
  209. </div>
  210. </div>
  211. </div>
  212. </div>
  213. <div class="form-group">
  214. <div class="col-sm-12">
  215. <input name="submit" type="submit" value="提交" class="btn btn-primary col-lg-1">
  216. <input type="hidden" name="token" value="{$_W['token']}" />
  217. </div>
  218. </div>
  219. </form>
  220. </div>
  221. <script type="text/javascript">
  222. <!--
  223. $("#form1").submit(function(){
  224. if($("input[name='cname']").val() == '') {
  225. util.message('请输入分类名称', '', 'error');
  226. return false;
  227. }
  228. });
  229. $('.change-style').click(function() {
  230. var styleId = parseInt($(this).data('styleid'));
  231. var title = $('.title-' + styleId).text();
  232. var preview = $('.preview-' + styleId).attr('src');
  233. $('.item-style').removeClass('active');
  234. $('#styleid').val(styleId);
  235. $('#current-title').text(title);
  236. $('#current-preview').attr('src', preview);
  237. $(this).parent().parent().addClass('active');
  238. $('#ListStyle').modal('hide');
  239. });
  240. //-->
  241. </script>
  242. {elseif $do == 'display'}
  243. <div class="main">
  244. <div class="category">
  245. <form action="" method="post" onsubmit="return formcheck(this)">
  246. <div class="panel panel-default">
  247. <div class="panel-body table-responsive">
  248. <table class="table table-hover">
  249. <thead>
  250. <tr>
  251. <th style="width:5%; text-align:center;">显示顺序</th>
  252. <th style="width:25%;">分类名称</th>
  253. <th style="width:5%; text-align:center;">设为栏目</th>
  254. <th style="width:15%; text-align:center">操作</th>
  255. </tr>
  256. </thead>
  257. <tbody>
  258. {loop $category $row}
  259. <tr>
  260. <td class="text-center">
  261. <input type="text" class="form-control" name="displayorder[{$row['id']}][displayorder]}]" value="{$row['displayorder']}">
  262. <input type="hidden" class="form-control" name="displayorder[{$row['id']}][nid]" value="{$row['nid']}">
  263. </td>
  264. <td class="text-left"><div style="height:30px;line-height:30px">{$row['name']}&nbsp;&nbsp;{if empty($row['parentid'])}<a href="{php echo url('site/category/post', array('parentid' => $row['id']))}" title="添加子分类"><i class="fa fa-plus"></i> 添加子分类</a>{/if}</div></td>
  265. <td class="text-center">{php echo $row['nid'] ? '是' : '否'}</td>
  266. <td class="text-right" style="position:relative;">
  267. <a href="javascript:;" data-url="{php echo murl('site/site', array('cid' => $row['id']), true, true)}" class="js-clip" title="复制链接">复制链接</a>&nbsp;-&nbsp;
  268. <a href="{php echo url('site/article/post', array('pcate' => $row['id']));}" title="添加文章">添加文章</a>&nbsp;-&nbsp;
  269. <a href="{php echo url('site/category/post', array('id' => $row['id']));}" title="编辑">编辑</a>&nbsp;-&nbsp;
  270. <a href="{php echo url('site/category/delete', array('id' => $row['id']));}" onclick="return confirm('确认删除此分类吗?');return false;" title="删除">删除</a>
  271. </td>
  272. </tr>
  273. {loop $children[$row['id']] $row}
  274. <tr>
  275. <td class="text-center">
  276. <input type="text" class="form-control" name="displayorder[{$row['id']}][displayorder]" value="{$row['displayorder']}">
  277. <input type="hidden" class="form-control" name="displayorder[{$row['id']}][nid]" value="{$row['nid']}">
  278. </td>
  279. <td class="text-left"><div style="padding-left:50px;height:30px;line-height:30px;background:url('./resource/images/bg_repno.gif') no-repeat -245px -545px;">{$row['name']}&nbsp;&nbsp;{if empty($row['parentid'])}<a href="{php echo url('category', array('foo' => 'post', 'parentid' => $row['id']))}"><i class="fa fa-plus" title="添加子分类"></i></a>{/if}</div></td>
  280. <td class="text-center">{php echo $row['enabled'] ? '是' : '否'}</td>
  281. <td class="text-right" style="position:relative;">
  282. <a href="javascript:;" data-url="{php echo murl('site/site', array('cid' => $row['id']), true, true)}" class="js-clip" title="复制链接">复制链接</a>&nbsp;-&nbsp;
  283. <a href="{php echo url('site/article/post', array('pcate' => $row['parentid'], 'ccate' => $row['id']));}" title="添加文章">添加文章</a>&nbsp;-&nbsp;
  284. <a href="{php echo url('site/category/post', array('id' => $row['id'], 'parentid' => $row['parentid']));}" title="编辑">编辑</a>&nbsp;-&nbsp;
  285. <a href="{php echo url('site/category/delete', array('id' => $row['id']));}" onclick="return confirm('确认删除此分类吗?');return false;" title="删除">删除</a>
  286. </td>
  287. </tr>
  288. {/loop}
  289. {/loop}
  290. <tr>
  291. <td colspan="4">
  292. <a href="{php echo url('site/category/post');}"><i class="fa fa-plus-circle" title="添加新分类"></i> 添加新分类</a>
  293. </td>
  294. </tr>
  295. </tbody>
  296. </table>
  297. </div>
  298. </div>
  299. <div class="form-group col-sm-12">
  300. <input name="submit" type="submit" class="btn btn-primary col-lg-1" value="提交">
  301. <input type="hidden" name="token" value="{$_W['token']}" />
  302. </div>
  303. </form>
  304. </div>
  305. </div>
  306. {/if}
  307. {template 'common/footer'}