123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <%@ page contentType="text/html;charset=UTF-8" %>
- <%@ include file="/WEB-INF/views/include/taglib.jsp"%>
- <html>
- <head>
- <title>呵呵轮播图管理</title>
- <meta name="decorator" content="default"/>
- <style type="text/css">
- .table th{text-align: center;}
- .table td{text-align: center;}
- </style>
- <script type="text/javascript">
- $(document).ready(function() {
-
- });
- function page(n,s){
- $("#pageNo").val(n);
- $("#pageSize").val(s);
- $("#searchForm").submit();
- return false;
- }
- </script>
- </head>
- <body>
- <ul class="nav nav-tabs">
- <li class="active"><a href="${ctx}/hehe/cmHeheImage/">轮播图列表</a></li>
- </ul>
- <form:form id="searchForm" modelAttribute="cmHeheImage" action="${ctx}/hehe/cmHeheImage/" method="post" class="breadcrumb form-search">
- <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
- <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
- <div class="ul-form">
- <label>主题:</label>
- <form:input path="topic" htmlEscape="false" maxlength="50" class="input-medium"/>
- <label>状态:</label>
- <form:select path="status" class="input-medium">
- <form:option value="" label="请选择"/>
- <form:option value="1" label="启用"/>
- <form:option value="2" label="停用"/>
- </form:select>
- <input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
- <input class="btn btn-primary" type="button" value="一键排序" onclick="batchSaveSort()" style="margin-left: 15px"/>
- <input class="btn btn-primary" style="width: 80px" onclick="window.location='${ctx}/hehe/cmHeheImage/form'" value="添加轮播图"/>
- <div class="clearfix"></div>
- </div>
- </form:form>
- <sys:message content="${message}"/>
- <table id="contentTable" class="table table-striped table-bordered table-condensed">
- <thead>
- <tr>
- <th>主题</th>
- <th>图片</th>
- <th>排序值</th>
- <th>小程序状态</th>
- <th>添加时间</th>
- <th>操作</th>
- </tr>
- </thead>
- <tbody>
- <c:forEach items="${page.list}" var="cmHeheImage">
- <tr>
- <input class="check-item" type="hidden" id="preferredProductSort${cmHeheImage.id}" value='${cmHeheImage.id}-${cmHeheImage.sort}'/>
- <td>
- ${cmHeheImage.topic}
- </td>
- <td>
- <img src="${cmHeheImage.image}" width="50px" height="50px">
- </td>
- <td>
- <input id="sort" name="sort" style="width:50px;" value="${cmHeheImage.sort}" onkeyup="onlynum(this)" onchange="changeSort(${cmHeheImage.id},this)">
- </td>
- <td>
- <c:if test="${cmHeheImage.status eq 1 }">
- <font color="green">已启用</font>
- <a href="javascript:void(0);" onclick="updateStatus('2','${cmHeheImage.id}');" >
- 停用
- </a>
- </c:if>
- <c:if test="${cmHeheImage.status ne 1 }">
- <font color="red">已停用</font>
- <a href="javascript:void(0)" onclick="updateStatus('1','${cmHeheImage.id}');">
- 启用
- </a>
- </c:if>
- </td>
- <td>
- <fmt:formatDate value="${cmHeheImage.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
- </td>
- <td>
- <a href="${ctx}/hehe/cmHeheImage/form?id=${cmHeheImage.id}">编辑</a>
- <a href="${ctx}/hehe/cmHeheImage/delete?id=${cmHeheImage.id}" onclick="return confirmx('确定删除该轮播图吗?删除后需要重新添加', this.href)">删除</a>
- </td>
- </tr>
- </c:forEach>
- </tbody>
- </table>
- <div class="pagination">${page}</div>
- <script>
- //状态修改
- function updateStatus(status,id){
- var msg='确定启用该轮播图吗?';
- if('2'==status){
- msg='确定停用该轮播图吗?';
- }
- top.$.jBox.confirm(msg,'系统提示',function(v,h,f){
- if(v=='ok'){
- $.post("${ctx}/hehe/cmHeheImage/updateStatus",{'status':status,'id':id}, function(data) {
- if(true==data.success){
- $.jBox.tip(data.msg, 'info');
- } else {
- $.jBox.tip(data.msg,'error');
- }
- $("#searchForm").submit();
- },"JSON");//这里返回的类型有:json,html,xml,text
- }
- return;
- },{buttonsFocus:1,persistent: true});
- }
- //修改排序值
- function changeSort(id, sortThis) {
- var value = sortThis.value;
- $("#preferredProductSort" + id).val(id + "-" + value);
- }
- //批量保存排序
- function batchSaveSort() {
- var items = new Array();
- var $items = $('.check-item');
- $items.each(function(){
- items.push($(this).val());
- });
- //保存批量排序
- $.post("${ctx}/hehe/cmHeheImage/batchSaveSort?sortList="+items, function(data) {
- if(true==data.success){
- $.jBox.tip(data.msg, 'info');
- window.location.href = "${ctx}/hehe/cmHeheImage";
- } else {
- $.jBox.tip(data.msg,'error');
- }
- },"JSON");//这里返回的类型有:json,html,xml,text
- }
- /**
- * @param obj
- * jquery控制input只能输入数字
- */
- function onlynum(obj) {
- obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
- }
- </script>
- </body>
- </html>
|