list.html 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <!DOCTYPE HTML>
  2. <html xmlns:th="http://www.thymeleaf.org"
  3. xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
  4. layout:decorate="~{admin/common/common}">
  5. <head>
  6. <title>活动管理列表</title>
  7. </head>
  8. <body layout:fragment="content">
  9. <nav class="breadcrumb">
  10. <i class="Hui-iconfont">&#xe67f;</i>
  11. 首页 <span class="c-gray en">&gt;</span>
  12. 活动管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
  13. href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
  14. </nav>
  15. <form id="myForm" th:action="@{/activity/review}" th:method="get">
  16. <div class="page-container">
  17. <div style="text-align:center">
  18. <label>类型:</label>
  19. <span class="select-box" style="width:200px; margin-right: 20px;">
  20. <select class="select" th:name="activity_type">
  21. <option value="">--请选择类型--</option>
  22. <option th:each="item : ${activity_type}" th:value="${item.value}" th:text="${item.name}"
  23. th:selected="${condition.activity_type}==${item.value}">
  24. </option>
  25. </select>
  26. </span>
  27. <input type="text" class="input-text" style="width:200px" placeholder="请输入活动标题" name="title"
  28. th:value="${condition.title}"/>
  29. <button type="submit" class="btn btn-primary">
  30. 搜索
  31. </button>
  32. </div>
  33. <div class="cl pd-5 bg-1 bk-gray mt-20">
  34. <span class="l">
  35. <a th:onclick="'javascript:activity_add(\'新增\',\'/activity/review/add\');'"
  36. class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 新增</a>
  37. <a onClick="bacthUpdate(1)" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe605;</i> 启用</a>
  38. <a onclick="bacthUpdate(0)" class="btn btn-default radius"><i class="Hui-iconfont">&#xe60e;</i> 禁用</a>
  39. <a onclick="batchDelete()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>
  40. </span>
  41. <span class="r">共有数据:<strong th:text="${pageInfo?.total}" id="total">0</strong> 条</span>
  42. </div>
  43. <table class="table table-border table-bordered table-bg table-hover" style="table-layout: fixed;width:100%;">
  44. <thead>
  45. <tr class="text-c">
  46. <th width="25"><input type="checkbox"></th>
  47. <th>标题</th>
  48. <th>关联活动名称</th>
  49. <th width="120">发布时间</th>
  50. <th>发布人</th>
  51. <th>置顶</th>
  52. <th>状态</th>
  53. <th width="180">操作</th>
  54. </tr>
  55. </thead>
  56. <tbody>
  57. <tr class="text-c" th:each="m,iterStat:${pageInfo.list}">
  58. <td>
  59. <input type="checkbox" th:value="${m.id}" th:id="${iterStat.index+1}" name="id"/>
  60. </td>
  61. <td class="text-overflow" th:text="${m.title}" th:title="${m.title}"></td>
  62. <td th:text="${m.activity_title}" th:title="${m.activity_title}"></td>
  63. <td th:text="${#strings.substring(m.activity_publishtime,0,16)}"></td>
  64. <td th:text="${m.publisher}"></td>
  65. <td th:if="${m.is_top} == false">否</td>
  66. <td th:if="${m.is_top} == true">是</td>
  67. <td th:if="${m.status} == 0">草稿</td>
  68. <td th:if="${m.status} == 1">启用</td>
  69. <td th:if="${m.status} == 2">停用</td>
  70. <td class="td-manage">
  71. <a class="ml-5" th:onclick="'javascript:editActivity(\'编辑活动回顾\',\'/activity/review/edit/'+${m.id}+'\');'">编辑</a>
  72. <a class="ml-5" th:onclick="'javascript:activityDetail(\'查看活动详情\',\'/activity/review/detail/'+${m.id}+'\');'">详情</a>
  73. <a th:if="${m.is_top} == false" class="ml-5" th:onclick="'javascript:isTop(\'true\',\''+${m.id}+'\');'">置顶</a>
  74. <a th:if="${m.is_top == true}" class="ml-5" th:id="${m.id}"
  75. th:onclick="'javascript:isTop(\'false\',\''+${m.id}+'\');'">取消置顶</a>
  76. </td>
  77. </tr>
  78. </tbody>
  79. </table>
  80. <div th:replace="admin/common/page :: page"></div>
  81. </div>
  82. </form>
  83. <script type="text/javascript" th:src="@{/js/common/page.js}"></script>
  84. <script>
  85. /*新增活动*/
  86. function activity_add(title,url,w,h){
  87. var index = layer_show(title,pagePath+url,w,h);
  88. layer.full(index);
  89. }
  90. /*编辑*/
  91. function editActivity(title,url,w,h) {
  92. var index = layer_show(title,pagePath+url,w,h);
  93. layer.full(index);
  94. }
  95. /*详情*/
  96. function activityDetail(title,url,w,h) {
  97. var index = layer_show(title,pagePath+url,w,h);
  98. layer.full(index);
  99. }
  100. function isTop(is_top, id) {
  101. var message = "确定取消吗?";
  102. console.log(is_top);
  103. if(is_top === 'true'){
  104. console.log(message);
  105. message = "确定置顶吗?"
  106. }
  107. layer.confirm(message, function (index) {
  108. $.ajax({
  109. type:"get",
  110. dataType:"json",
  111. url: pagePath + "/activity/review/isTop/"+ id,
  112. data:{
  113. "is_top":is_top
  114. },
  115. success: function (result) {
  116. if (result.success) {
  117. smileMessage(result.message)
  118. setTime();
  119. } else {
  120. errorMessage(result.message);
  121. }
  122. },
  123. error: function () {
  124. errorMessage('系统错误!');
  125. }
  126. });
  127. });
  128. }
  129. function bacthUpdate(status) {
  130. getSelectedItem();
  131. var ids = [];
  132. if(null != item_selected_arr){
  133. ids = getIdsFromItemArr(item_selected_arr);
  134. }
  135. var obj = $("input[name='id']:checked");
  136. if (obj.length == 0) {
  137. errorMessage("请选择活动反馈");
  138. return false;
  139. }
  140. layer.confirm('确认要启用吗?', function (index) {
  141. $.ajax({
  142. type: "POST",
  143. dataType: "json",
  144. url: pagePath + "/activity/review/batch",
  145. data: {
  146. "ids" : ids,
  147. "status" : status
  148. },
  149. success: function (result) {
  150. if (result.success) {
  151. smileMessage(result.message);
  152. window.location.href=pagePath + "/activity/review";
  153. } else {
  154. errorMessage(result.message);
  155. }
  156. },
  157. error: function () {
  158. errorMessage('系统错误!');
  159. }
  160. });
  161. });
  162. }
  163. function batchDelete() {
  164. getSelectedItem();
  165. var ids = [];
  166. if(null != item_selected_arr){
  167. ids = getIdsFromItemArr(item_selected_arr);
  168. }
  169. var obj = $("input[name='id']:checked");
  170. if (obj.length == 0) {
  171. errorMessage("请选择活动反馈");
  172. return false;
  173. }
  174. layer.confirm('确认要删除吗?', function (index) {
  175. $.ajax({
  176. type: "POST",
  177. dataType: "json",
  178. url: pagePath + "/activity/review/batch",
  179. data: {
  180. "ids" : ids,
  181. "del_flag" : true
  182. },
  183. success: function (result) {
  184. if (result.success) {
  185. smileMessage(result.message);
  186. window.location.href=pagePath + "/activity/review";
  187. } else {
  188. errorMessage(result.message);
  189. }
  190. },
  191. error: function () {
  192. errorMessage('系统错误!');
  193. }
  194. });
  195. });
  196. }
  197. </script>
  198. </body>
  199. </html>