cmHeheImageList.jsp 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <%@ page contentType="text/html;charset=UTF-8" %>
  2. <%@ include file="/WEB-INF/views/include/taglib.jsp"%>
  3. <html>
  4. <head>
  5. <title>呵呵轮播图管理</title>
  6. <meta name="decorator" content="default"/>
  7. <style type="text/css">
  8. .table th{text-align: center;}
  9. .table td{text-align: center;}
  10. </style>
  11. <script type="text/javascript">
  12. $(document).ready(function() {
  13. });
  14. function page(n,s){
  15. $("#pageNo").val(n);
  16. $("#pageSize").val(s);
  17. $("#searchForm").submit();
  18. return false;
  19. }
  20. </script>
  21. </head>
  22. <body>
  23. <ul class="nav nav-tabs">
  24. <li class="active"><a href="${ctx}/hehe/cmHeheImage/">轮播图列表</a></li>
  25. </ul>
  26. <form:form id="searchForm" modelAttribute="cmHeheImage" action="${ctx}/hehe/cmHeheImage/" method="post" class="breadcrumb form-search">
  27. <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
  28. <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
  29. <div class="ul-form">
  30. <label>主题:</label>
  31. <form:input path="topic" htmlEscape="false" maxlength="50" class="input-medium"/>
  32. <label>状态:</label>
  33. <form:select path="status" class="input-medium">
  34. <form:option value="" label="请选择"/>
  35. <form:option value="1" label="启用"/>
  36. <form:option value="2" label="停用"/>
  37. </form:select>
  38. &nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
  39. <input class="btn btn-primary" type="button" value="一键排序" onclick="batchSaveSort()" style="margin-left: 15px"/>
  40. &nbsp;&nbsp;<input class="btn btn-primary" style="width: 80px" onclick="window.location='${ctx}/hehe/cmHeheImage/form'" value="添加轮播图"/>
  41. <div class="clearfix"></div>
  42. </div>
  43. </form:form>
  44. <sys:message content="${message}"/>
  45. <table id="contentTable" class="table table-striped table-bordered table-condensed">
  46. <thead>
  47. <tr>
  48. <th>主题</th>
  49. <th>图片</th>
  50. <th>排序值</th>
  51. <th>小程序状态</th>
  52. <th>添加时间</th>
  53. <th>操作</th>
  54. </tr>
  55. </thead>
  56. <tbody>
  57. <c:forEach items="${page.list}" var="cmHeheImage">
  58. <tr>
  59. <input class="check-item" type="hidden" id="preferredProductSort${cmHeheImage.id}" value='${cmHeheImage.id}-${cmHeheImage.sort}'/>
  60. <td>
  61. ${cmHeheImage.topic}
  62. </td>
  63. <td>
  64. <img src="${cmHeheImage.image}" width="50px" height="50px">
  65. </td>
  66. <td>
  67. <input id="sort" name="sort" style="width:50px;" value="${cmHeheImage.sort}" onkeyup="onlynum(this)" onchange="changeSort(${cmHeheImage.id},this)">
  68. </td>
  69. <td>
  70. <c:if test="${cmHeheImage.status eq 1 }">
  71. <font color="green">已启用</font>
  72. <a href="javascript:void(0);" onclick="updateStatus('2','${cmHeheImage.id}');" >
  73. 停用
  74. </a>
  75. </c:if>
  76. <c:if test="${cmHeheImage.status ne 1 }">
  77. <font color="red">已停用</font>
  78. <a href="javascript:void(0)" onclick="updateStatus('1','${cmHeheImage.id}');">
  79. 启用
  80. </a>
  81. </c:if>
  82. </td>
  83. <td>
  84. <fmt:formatDate value="${cmHeheImage.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
  85. </td>
  86. <td>
  87. <a href="${ctx}/hehe/cmHeheImage/form?id=${cmHeheImage.id}">编辑</a>
  88. <a href="${ctx}/hehe/cmHeheImage/delete?id=${cmHeheImage.id}" onclick="return confirmx('确定删除该轮播图吗?删除后需要重新添加', this.href)">删除</a>
  89. </td>
  90. </tr>
  91. </c:forEach>
  92. </tbody>
  93. </table>
  94. <div class="pagination">${page}</div>
  95. <script>
  96. //状态修改
  97. function updateStatus(status,id){
  98. var msg='确定启用该轮播图吗?';
  99. if('2'==status){
  100. msg='确定停用该轮播图吗?';
  101. }
  102. top.$.jBox.confirm(msg,'系统提示',function(v,h,f){
  103. if(v=='ok'){
  104. $.post("${ctx}/hehe/cmHeheImage/updateStatus",{'status':status,'id':id}, function(data) {
  105. if(true==data.success){
  106. $.jBox.tip(data.msg, 'info');
  107. } else {
  108. $.jBox.tip(data.msg,'error');
  109. }
  110. $("#searchForm").submit();
  111. },"JSON");//这里返回的类型有:json,html,xml,text
  112. }
  113. return;
  114. },{buttonsFocus:1,persistent: true});
  115. }
  116. //修改排序值
  117. function changeSort(id, sortThis) {
  118. var value = sortThis.value;
  119. $("#preferredProductSort" + id).val(id + "-" + value);
  120. }
  121. //批量保存排序
  122. function batchSaveSort() {
  123. var items = new Array();
  124. var $items = $('.check-item');
  125. $items.each(function(){
  126. items.push($(this).val());
  127. });
  128. //保存批量排序
  129. $.post("${ctx}/hehe/cmHeheImage/batchSaveSort?sortList="+items, function(data) {
  130. if(true==data.success){
  131. $.jBox.tip(data.msg, 'info');
  132. window.location.href = "${ctx}/hehe/cmHeheImage";
  133. } else {
  134. $.jBox.tip(data.msg,'error');
  135. }
  136. },"JSON");//这里返回的类型有:json,html,xml,text
  137. }
  138. /**
  139. * @param obj
  140. * jquery控制input只能输入数字
  141. */
  142. function onlynum(obj) {
  143. obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
  144. }
  145. </script>
  146. </body>
  147. </html>