人人商城

category-display.html 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. {template 'common/header'}
  2. <div class="we7-page-title">微官网</div>
  3. <ul class="we7-page-tab">
  4. {loop $active_sub_permission $active_menu}
  5. {if permission_check_account_user($active_menu['permission_name'], false) && (empty($active_menu['is_display']) || is_array($active_menu['is_display']) && in_array($_W['account']['type'], $active_menu['is_display']))}
  6. <li {if $action == $active_menu['active']}class="active"{/if}><a href="{$active_menu['url']}">{$active_menu['title']}</a></li>
  7. {/if}
  8. {/loop}
  9. </ul>
  10. <div class="we7-page-search we7-padding-bottom clearfix">
  11. <div class="pull-right">
  12. {if empty($id)}<a href="{php echo url('site/category/post')}" class="btn btn-primary we7-padding-horizontal">+新建文章分类</a>{/if}
  13. {if !empty($id)}<a href="{php echo url('site/category/post', array('id' => $id))}" class="btn btn-primary we7-padding-horizontal">编辑文章分类</a>{/if}
  14. </div>
  15. </div>
  16. <form action="./index.php?c=site&a=category&do=delete" class="we7-form" method="post">
  17. <table class="table we7-table table-hover article-list vertical-middle" id="js-wesite-category-display">
  18. <col width="80px">
  19. <col width="130px"/>
  20. <col width="235px">
  21. <col width="90px"/>
  22. <col width=""/>
  23. <tr>
  24. <th></th>
  25. <th class="text-left">排序</th>
  26. <th class="text-left">分类名称</th>
  27. <th>设为栏目</th>
  28. <th class="text-right">操作</th>
  29. </tr>
  30. {loop $category $row}
  31. <tr>
  32. <td>
  33. <input type="checkbox" we7-check-all="1" name="rid[]" id="rid-{$row['id']}" value="{$row['id']}">
  34. <label for="rid-{$row['id']}">&nbsp;</label>
  35. </td>
  36. <td class="text-left">{$row['displayorder']}</td>
  37. <td class="text-left">
  38. <span>{$row['name']}</span>
  39. </td>
  40. <td>
  41. <label>
  42. <div class="switch switch{php echo $row['enabled'] ? 'On' : 'Off'}" onclick="changeStatus({$row['id']})"></div>
  43. </label>
  44. </td>
  45. <td style="position: relative;">
  46. <div class="link-group">
  47. {if empty($row['parentid'])}
  48. <a href="{php echo url('site/category/post', array('parentid' => $row['id']))}" >&nbsp;+添加子分类</a>
  49. {/if}
  50. <a href="javascript:;" data-url="{php echo murl('site/site', array('cid' => $row['id']), true, true)}" class="js-clip">复制链接</a>
  51. <a href="{php echo url('site/article/post', array('pcate' => $row['id']));}" >添加文章</a>
  52. <a href="{php echo url('site/category/post', array('id' => $row['id']));}" >编辑</a>
  53. <a href="{php echo url('site/category/delete', array('id' => $row['id']));}" class="del" onclick="return confirm('确认删除此分类吗?');return false;">删除</a>
  54. </div>
  55. </td>
  56. </tr>
  57. {loop $children[$row['id']] $row}
  58. <tr class="bg-light-gray">
  59. <td>
  60. <input type="checkbox" name="rid[]" id="rid-{$row['id']}" value="{$row['id']}">
  61. <label for="rid-{$row['id']}">&nbsp;</label>
  62. </td>
  63. <td class="text-left">
  64. <div class="pad-left">
  65. {$row['displayorder']}
  66. </div>
  67. </td>
  68. <td class="text-left"><span class="color-gray" style="margin-left: 50px;">{$row['name']}</span></td>
  69. <td>
  70. <label>
  71. <div class="switch switch{php echo $row['enabled'] ? 'On' : 'Off'}" onclick="changeStatus({$row['id']})"></div>
  72. </label>
  73. </td>
  74. <td style="position: relative;" class="text-right">
  75. <div class="link-group">
  76. <a href="javascript:;" data-url="{php echo murl('site/site', array('cid' => $row['id']), true, true)}" class="we7-margin-right-sm js-clip">复制链接</a>
  77. <a href="{php echo url('site/article/post', array('pcate' => $row['parentid'], 'ccate' => $row['id']));}" class="we7-margin-right-sm">添加文章</a>
  78. <a href="{php echo url('site/category/post', array('id' => $row['id'], 'parentid' => $row['parentid']));}" class="we7-margin-right-sm">编辑</a>
  79. <a href="{php echo url('site/category/delete', array('id' => $row['id']));}" class="del" onclick="return confirm('确认删除此分类吗?');return false;">删除</a>
  80. </div>
  81. </td>
  82. </tr>
  83. {/loop}
  84. {/loop}
  85. </table>
  86. <div class="clearfix"></div>
  87. <div class="we7-margin-left">
  88. <input type="checkbox" we7-check-all="1" name="rid[]" id="select_all" value="1">
  89. <label for="select_all">&nbsp;</label>
  90. <input type="submit" class="btn btn-danger" name="submit" value="删除" onclick="if(!confirm('确定删除选中的规则吗?')) return false;"/>
  91. <input type="hidden" name="token" value="{$_W['token']}" />
  92. </div>
  93. </form>
  94. <script>
  95. $('#select_all').click(function(){
  96. $('.article-list :checkbox').prop('checked', $(this).prop('checked'));
  97. });
  98. $('.js-clip').each(function(){
  99. util.clip(this, $(this).attr('data-url'));
  100. });
  101. var changeStatus = function(id) {
  102. var id = parseInt(id);
  103. $.post('./index.php?c=site&a=category&do=change_status', {id: id},function(data) {
  104. if (data.message.errno == 0){
  105. util.message(data.message.message, data.redirect, 'success');
  106. } else {
  107. if (data.message.errno == 1) util.toast('更改失败!', 'error');
  108. if (data.message.errno == -1) util.toast('分类不存在,请刷新重试!');
  109. }
  110. }, 'json');
  111. }
  112. </script>
  113. {template 'common/footer'}