index.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <div class="row-content am-cf">
  2. <div class="row">
  3. <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
  4. <div class="widget am-cf">
  5. <div class="widget-head am-cf">
  6. <div class="widget-title am-cf">页面设计</div>
  7. </div>
  8. <div class="widget-body am-fr">
  9. <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
  10. <div class="am-form-group">
  11. <div class="am-btn-toolbar">
  12. <?php if (checkPrivilege('wxapp.page/add')): ?>
  13. <div class="am-btn-group am-btn-group-xs">
  14. <a class="am-btn am-btn-default am-btn-success am-radius"
  15. href="<?= url('wxapp.page/add') ?>">
  16. <span class="am-icon-plus"></span> 新增
  17. </a>
  18. </div>
  19. <?php endif; ?>
  20. </div>
  21. </div>
  22. </div>
  23. <div class="am-scrollable-horizontal am-u-sm-12">
  24. <table width="100%" class="am-table am-table-compact am-table-striped
  25. tpl-table-black am-text-nowrap">
  26. <thead>
  27. <tr>
  28. <th>页面ID</th>
  29. <th width="40%">页面名称</th>
  30. <th>页面类型</th>
  31. <th>添加时间</th>
  32. <th>更新时间</th>
  33. <th>操作</th>
  34. </tr>
  35. </thead>
  36. <tbody>
  37. <?php if (!$list->isEmpty()): foreach ($list
  38. as $item): ?>
  39. <tr>
  40. <td class="am-text-middle"><?= $item['page_id'] ?></td>
  41. <td class="am-text-middle">
  42. <span><?= $item['page_name'] ?></span>
  43. </td>
  44. <td class="am-text-middle">
  45. <?php if ($item['page_type'] == 10) : ?>
  46. <span class="am-badge am-badge-warning">商城首页</span>
  47. <?php elseif ($item['page_type'] == 20) : ?>
  48. <span class="am-badge am-badge-secondary">自定义页</span>
  49. <?php endif; ?>
  50. </td>
  51. <td class="am-text-middle"><?= $item['create_time'] ?></td>
  52. <td class="am-text-middle"><?= $item['update_time'] ?></td>
  53. <td class="am-text-middle">
  54. <div class="tpl-table-black-operation">
  55. <?php if (checkPrivilege('wxapp.page/edit')): ?>
  56. <a href="<?= url('wxapp.page/edit', ['page_id' => $item['page_id']]) ?>">
  57. <i class="am-icon-pencil"></i> 编辑
  58. </a>
  59. <?php endif; ?>
  60. <?php if ($item['page_type'] == 20) : ?>
  61. <?php if (checkPrivilege('wxapp.page/delete')): ?>
  62. <a href="javascript:;"
  63. class="item-delete tpl-table-black-operation-del"
  64. data-id="<?= $item['page_id'] ?>">
  65. <i class="am-icon-trash"></i> 删除
  66. </a>
  67. <?php endif; ?>
  68. <?php if (checkPrivilege('wxapp.page/sethome')): ?>
  69. <a href="javascript:;"
  70. class="j-setHome tpl-table-black-operation-green"
  71. data-id="<?= $item['page_id'] ?>">
  72. <i class="iconfont icon-home"></i> 设为首页
  73. </a>
  74. <?php endif; ?>
  75. <?php endif; ?>
  76. </div>
  77. </td>
  78. </tr>
  79. <?php endforeach; else: ?>
  80. <tr>
  81. <td colspan="5" class="am-text-center">暂无记录</td>
  82. </tr>
  83. <?php endif; ?>
  84. </tbody>
  85. </table>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. <script>
  93. $(function () {
  94. // 删除元素
  95. $('.item-delete').delete('page_id', "<?= url('wxapp.page/delete') ?>");
  96. // 设为首页
  97. $('.j-setHome').click(function () {
  98. var pageId = $(this).attr('data-id');
  99. layer.confirm('确定要将此页面设置为默认首页吗?', function (index) {
  100. $.post("<?= url('wxapp.page/sethome') ?>", {page_id: pageId}, function (result) {
  101. result.code === 1 ? $.show_success(result.msg, result.url)
  102. : $.show_error(result.msg);
  103. });
  104. layer.close(index);
  105. });
  106. });
  107. });
  108. </script>