<!DOCTYPE html>
|
<html lang="zh-cn">
|
|
<head>
|
<meta charset="utf-8">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<title>管理-圆形图标栏目</title>
|
<link href="css/bootstrap.min.css" rel="stylesheet">
|
<link href="css/maincontent.css" rel="stylesheet">
|
<style>
|
.search {
|
display: inline;
|
width: auto;
|
}
|
|
.img {
|
width: 223px;
|
height: 120px;
|
}
|
</style>
|
|
</head>
|
|
<body>
|
<nav class="navbar navbar-default navbar-fixed-top">
|
|
</nav>
|
<div id="mainbody">
|
<div id="sidebar">
|
|
</div>
|
<div id="neirong">
|
<div class="erjidh">
|
<table class="table">
|
<tbody>
|
<tr>
|
<td>
|
<form class="form-inline" role="form">
|
<div class="form-group" role="search">
|
<input type="text" class="form-control searchText" style="width:200px;" placeholder="活动名称">
|
</div>
|
<button type="button" class="btn btn-default searchBtn">搜索</button>
|
</form>
|
</td>
|
<td>
|
<div class="tianjia">
|
<a href="add-IconColumn.html" class="btn btn-primary" role="button">添加圆形图标栏目 +</a>
|
</div>
|
</td>
|
</tr>
|
<tr></tr>
|
</tbody>
|
</table>
|
</div>
|
<div class="zhuti" width: 1600px;>
|
<div class="liebiao">
|
<table class="table">
|
<thead>
|
<th width="10%">选择</th>
|
<th width="10%">活动名称</th>
|
<th width="15%">圆形图标</th>
|
<!-- <th width="10%">跳转后展示大图</th> -->
|
<th width="20%">跳转地址</th>
|
<th width="10%">排序值</th>
|
<th width="15%">跳转详情</th>
|
<th width="10%">删除</th>
|
<th width="10%">编辑</th>
|
</thead>
|
|
<tbody>
|
<tr style="">
|
<!-- 复选框 -->
|
<td width="10%">
|
<div class="xuanze">
|
<label>
|
<input type="checkbox" class="check-item" value="#"/>
|
</label>
|
</div>
|
</td>
|
<!-- 活动名称 -->
|
<td width="10%" style="text-align: center; line-height: 105px;">
|
<div class="name"></div>
|
</td>
|
<!-- 圆形图标 -->
|
<td width="15%" style="text-align: center; line-height: 105px;">
|
<div class="imgDiv">
|
<img src="#" class="picture"></img>
|
</div>
|
</td>
|
<!-- 跳转后展示大图 -->
|
<!-- <td width="10%" style="text-align: center; line-height: 105px;">
|
<div class="imgDiv1">
|
<img src="#" class="bigImg"></img>
|
</div>
|
</td> -->
|
<!-- 跳转地址 -->
|
<td width="20%" style="line-height: 30px;max-width: 600px; overflow: hidden">
|
<div class="url"></div>
|
</td>
|
<!-- 排序值 -->
|
<td width="10%" style="text-align: center; line-height: 105px;">
|
<div class="orderBy"></div>
|
</td>
|
<!-- 跳转详情 -->
|
<td width="15%" style="text-align: center; line-height: 105px;max-width: 600px;">
|
<div class="jumpDetail"></div>
|
</td>
|
|
<!-- 删除按钮 -->
|
<td width="10%" style="text-align: center; line-height: 105px;">
|
<div class="anniu delete" ><img src="image/dustbin.png" />
|
</div>
|
</td>
|
<!-- 编辑按钮 -->
|
<td width="10%" style="text-align: center; line-height: 105px;">
|
<div class="anniu edit">
|
<a key="" class="edit"><img src="image/bianji.png"></a>
|
</div>
|
</td>
|
</tr>
|
</tbody>
|
|
</table>
|
</div>
|
</div>
|
<div class="bottom">
|
<div class="qx">
|
<div class="checkbox">
|
<label>
|
<input type="checkbox" class="check-all checkAll" value="#">
|
全选</label>
|
</div>
|
</div>
|
<button class="btn btn-warning batchDel " type="button">批量删除</button>
|
<!-- 页面跳转 -->
|
<div class="page ">
|
<ul class="pagination ">
|
<li class="disabled pre ">
|
<a href="#">«</a>
|
</li>
|
<li>
|
<a href="#" class="next">»</a>
|
</li>
|
</ul>
|
<div class="form-group ">
|
<div class="tzan ">
|
<button type="button" class="btn btn-primary ">跳转</button>
|
</div>
|
<div class="tz">
|
<input class="form-control " type="text " id="customPage " placeholder="页数 ">
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
<script src="//cdn.bootcss.com/jquery/1.10.1/jquery.min.js"></script>
|
<script src="js/jquery.min.js"></script>
|
<script src="js/bootstrap.min.js"></script>
|
<script src="js/page.js"></script>
|
<script src="js/nav.js"></script>
|
<script src="js/common.js"></script>
|
<script src="layer/layer.js"></script>
|
<script src="js/utli.js"></script>
|
|
<script>
|
var trHtml;
|
var resultTrHtml;
|
var state=0;
|
$(function() {
|
var curpageIndex = getArgsFromHref(location.href,"page");
|
if(curpageIndex==""){
|
curpageIndex=1;
|
}
|
trHtml = $(".liebiao tbody").html();
|
resultTrHtml = $(".search-result > table tbody").html();
|
$(".liebiao tbody").empty();
|
|
getHonestListData(curpageIndex);
|
|
//搜索
|
$(".searchBtn").bind("click", function(){
|
state=0;
|
getHonestListData(1);
|
});
|
|
//全选
|
$(".checkAll").bind("click", function() {
|
if(this.checked) {
|
$(".xuanze > label >input ").prop('checked', true)
|
} else {
|
$(".xuanze > label >input ").prop('checked', false)
|
}
|
});
|
});
|
|
//获取圆形图标数据
|
function getHonestListData(pageIndex) {
|
var lay = layer.load(0, {
|
'shade': false
|
});
|
var searchText = $(".searchText").val();
|
|
|
$.post("api/v1/honest/getHonestList", {"pageIndex": pageIndex, "key": searchText}, function(data) {
|
if(data.code == 0) {
|
setHonestListData(pageIndex, data);
|
fillPage(data.data.pageEntity, function(pageindex) {
|
getHonestListData(pageindex);
|
});
|
} else {
|
layer.msg("数据访问出错");
|
}
|
layer.close(lay);
|
|
}, 'json');
|
|
}
|
|
function setHonestListData(index, data) {
|
$(".liebiao tbody").empty();
|
index = index - 1;
|
var pageSize = data.data.pageEntity.pageSize;
|
var totalCount = data.data.pageEntity.totalCount;
|
var len = (pageSize < totalCount - (index * pageSize)) ? pageSize : totalCount - (index * pageSize);
|
len = (index * pageSize) + len;
|
var tt = index * pageSize;
|
|
for(var ii = 0; tt < len && tt < totalCount < pageSize; ii++, tt++) {
|
var honest = data.data.honestList[ii];
|
|
if(honest == undefined)
|
continue;
|
console.log(honest);
|
var id = honest.id;
|
var name = honest.name;
|
var picture = honest.picture;
|
var bigImg = honest.bigImg;
|
var url = honest.url;
|
var orderBy = honest.orderBy;
|
var jumpDetail = honest.jumpDetail;
|
|
|
$(".liebiao tbody").append(trHtml);
|
var $curTr = $(".liebiao tbody tr").eq(ii);
|
$curTr.find(".xuanze input").attr("key", id);
|
$curTr.find(".name").text(name);
|
/* $curTr.find(".picture").attr("href",picture); */
|
$curTr.find(".imgDiv > img").attr("src", picture);
|
$curTr.find(".imgDiv1 > img").attr("src", bigImg);
|
$curTr.find(".url").text(url);
|
$curTr.find(".orderBy").text(orderBy);
|
$curTr.find(".jumpDetail").text(jumpDetail);
|
|
$curTr.find(".anniu").attr("key", id);
|
$curTr.find(".anniu .edit").attr("href", "edit-IconColumn.html?key="+id+"&page="+(index+1));
|
var kg = " ";
|
}
|
|
//批量删除
|
$(".batchDel").bind("click", function() {
|
var arr = new Array();
|
var selectAll = $(".xuanze input[type='checkbox']").each(function() {
|
var cur = $(this);
|
var ck = this.checked;
|
if(ck) {
|
var val = cur.attr("key");
|
arr.push(val);
|
}
|
if(arr.length == 0) {
|
layer.msg("请先选择数据!");
|
return;
|
}
|
layer.confirm('是否批量删除?', {
|
btn: ['否', '是']
|
}, function(index) {
|
layer.close(index);
|
return false;
|
}, function() {
|
deleteHonest(arr);
|
$(".checkAll").prop("checked", false);
|
});
|
});
|
});
|
|
//删除
|
$(".liebiao tbody .delete").bind("click",function(){
|
var $obj=$(this);
|
layer.confirm('是否删除?', {
|
btn: ['否', '是']
|
}, function(index) {
|
layer.close(index);
|
return false;
|
}, function() {
|
var key = $obj.attr("key");
|
var array = new Array();
|
array.push(key);
|
deleteHonest(array);
|
});
|
});
|
|
//修改商品
|
$(".liebiao tbody .edit").bind("click",function(){
|
var key = $(this).attr("key");
|
location.href="edit-IconColumn.htmlkey="+key+"&page="+(index+1);
|
});
|
}
|
|
function deleteHonest(arr){
|
$.ajax({
|
type:"post",
|
url:"api/v1/honest/deleteHonest",
|
async:true,
|
data:{"ids":arr},
|
dataType:'json',
|
traditional: true, //阻止深度序列化
|
success:function(data){
|
if(data.code==0){
|
layer.msg("删除成功");
|
getHonestListData(1);
|
}else{
|
layer.msg("删除失败");
|
}
|
},
|
error:function(data){
|
layer.msg("删除失败");
|
}
|
});
|
}
|
</script>
|
</body>
|
</html>
|