index.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <article class="cl pd-10" style="min-width: 900px;">
  2. <div class="cl pd-5 bg-1 bk-gray mt-20">
  3. <span class="l">
  4. <a href="javascript:void(0);" onclick="del_all()" class="btn btn-danger radius">
  5. <i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>
  6. <a class="btn btn-success radius" href="{:url('/sys/article/save')}">
  7. <i class="Hui-iconfont">&#xe600;</i> 添加文章</a>
  8. <a class="btn btn-success radius" href="{:url('/sys/article/save', ['content_type'=>1])}">
  9. <i class="Hui-iconfont">&#xe600;</i> 添加MarkDown文章</a>
  10. <a class="btn btn-primary radius" href="javascript:void(0);" onclick="moveArticle()">
  11. <i class="Hui-iconfont">&#xe600;</i>移动到指定栏目</a>
  12. </span>
  13. <span class="r">
  14. <span class="select-box inline ml-50">
  15. <select name="cid" id="sel_option" class="select">
  16. <option value="0" {eq name='cid' value="0" }selected{/eq}>所有栏目</option>
  17. {foreach $category_tree as $value}
  18. <option value="{$value.id}" {eq name='cid' value="$value.id" }selected{/eq}>{$value.name}</option>
  19. {notempty name="value.child"}
  20. {foreach $value.child as $val}
  21. <option value="{$val.id}" {eq name='cid' value="$val.id" }selected{/eq}>--{$val.name}</option>
  22. {notempty name="val.child"}
  23. {foreach $val.child as $vo}
  24. <option value="{$vo.id}" {eq name='cid' value="$vo.id" }selected{/eq}>&nbsp;&nbsp;└ --{$vo.name}
  25. </option>
  26. {/foreach}
  27. {/notempty}
  28. {/foreach}
  29. {/notempty}
  30. {/foreach}
  31. </select>
  32. </span>
  33. <span>
  34. <button type="button" class="btn btn-success radius" onclick="search()">确&nbsp;定</button>
  35. </span>
  36. </span>
  37. </div>
  38. <div id="edatalist">
  39. <table class="table table-border table-bordered table-bg">
  40. <thead>
  41. <tr class="text-c">
  42. <th width="25px;">
  43. <input type="checkbox" name="allcheck" value="">
  44. </th>
  45. <th width="60px;">ID</th>
  46. <th style="min-width: 260px;">标题</th>
  47. <th width="240px;">栏目</th>
  48. <th width="160px;">发布者</th>
  49. <th width="180px;">发布时间</th>
  50. <th width="140px;">点击量</th>
  51. <th width="80px;">排序</th>
  52. <th width="80px;">状态</th>
  53. <th width="100px;">操作</th>
  54. </tr>
  55. </thead>
  56. <tbody>
  57. {foreach $list as $val}
  58. <tr class="text-c va-m">
  59. <td>
  60. <input type="checkbox" value="{$val.id}" name="checkbox[]">
  61. </td>
  62. <td>{$val.id}</td>
  63. <td class="text-l">
  64. <a href="/{$val.id}" style="text-decoration:none"
  65. title="浏览" target="_blank">{$val.title}</a>
  66. </td>
  67. <td>{$val.category_name}</td>
  68. <td>{$val.username}</td>
  69. <td>{$val.create_time}</td>
  70. <td>{$val.hits}</td>
  71. <td><input type="text" class="input-text input-sort" value="{$val.sort}" data-id="{$val.id}"
  72. style="text-align: center;"></td>
  73. <td class="td-status">
  74. <div class="switch size-S" data-on-label="是" data-off-label="否" data-id="{$val.id}">
  75. <input type="checkbox" {if $val.status==1}checked{/if}>
  76. </div>
  77. </td>
  78. <td class="td-manage">
  79. <a href="{:url('/sys/article/save',['content_type'=>$val['content_type'], 'id'=>$val['id']])}" title="编辑"
  80. class="btn btn-primary radius">
  81. <i class="Hui-iconfont">&#xe6df;</i></a>
  82. <a href="javascript:;" title="删除" class="ml-10 btn btn-danger radius"
  83. onClick="del(this,'{$val.id}')">
  84. <i class="Hui-iconfont">&#xe6e2;</i></a>
  85. </td>
  86. </tr>
  87. {/foreach}
  88. </tbody>
  89. </table>
  90. </div>
  91. <div class="cl pd-5 bg-1 bk-gray mt-20 ">
  92. <span>共有数据:<strong id="total">{$list->total()}</strong>条</span>
  93. <span class="r">{$list->render()|raw}</span>
  94. </div>
  95. </article>
  96. <script>
  97. function search() {
  98. var cid = $("#sel_option").val();
  99. console.log(cid);
  100. if (cid) {
  101. window.location.href = '/sys/article/index?cid=' + cid;
  102. } else {
  103. window.location.href = '/sys/article/index';
  104. }
  105. return false;
  106. }
  107. function moveArticle() {
  108. var checkbox = $('.text-c input[name="checkbox[]"]');
  109. var ids = new Array();
  110. checkbox.each(function (x) {
  111. if (this.checked)
  112. ids.push(this.value);
  113. })
  114. var length = ids.length;
  115. if (length == 0) {
  116. layer.msg('请选择要移动的选项', {
  117. icon: 5,
  118. time: 1000
  119. });
  120. return false;
  121. }
  122. var cid = $("#sel_option").val();
  123. if (cid == 0) {
  124. layer.msg('请选择要移动到的栏目', {
  125. icon: 5,
  126. time: 1000
  127. });
  128. return false;
  129. }
  130. layer.confirm('确认要移动选中项吗?', function (index) {
  131. $.post('move', {
  132. 'ids': ids,
  133. 'cid': cid
  134. }, function (data) {
  135. if (data.code == 0) {
  136. layer.msg(data.msg, {
  137. icon: 1,
  138. time: 2000
  139. });
  140. window.location.reload();
  141. } else {
  142. layer.msg(data.msg, {
  143. icon: 5,
  144. time: 2000
  145. });
  146. return false;
  147. }
  148. }, 'json');
  149. });
  150. }
  151. </script>