<!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="#" class="btn btn-primary" role="button">添加二级问题 +</a>
|
</div>
|
</td>
|
</tr>
|
<tr></tr>
|
</tbody>
|
</table>
|
</div>
|
<div class="zhuti">
|
<div class="liebiao">
|
<table class="table">
|
<thead>
|
<th width="20%">选择</th>
|
<th width="20%">问题名称</th>
|
<th width="20%">创建时间</th>
|
<th width="20%">删除</th>
|
<th width="20%">编辑</th>
|
</thead>
|
|
<tbody>
|
<tr style="">
|
<!-- 复选框 -->
|
<td width="20%">
|
<div class="xuanze">
|
<label>
|
<input type="checkbox" class="check-item" value="#"/>
|
</label>
|
</div>
|
</td>
|
|
<!-- 问题名称 -->
|
<td width="20%" style="text-align: center; line-height: 105px;">
|
<div class="title"></div>
|
</td>
|
|
<!-- 创建时间 -->
|
<td width="20%" style="text-align: center; line-height: 105px;" class="createTime">1995-12-12</td>
|
|
<!-- 删除按钮 -->
|
<td width="20%" style="text-align: center; line-height: 105px;">
|
<div class="anniu delete" ><img src="image/dustbin.png" />
|
</div>
|
</td>
|
|
<!-- 编辑按钮 -->
|
<td width="20%" 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>
|
|
function getQueryString(name) {
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
var r = window.location.search.substr(1).match(reg);
|
if (r != null) return unescape(r[2]);
|
return null;
|
}
|
var id = getQueryString("key");
|
|
var trHtml;
|
var resultTrHtml;
|
var state=0;
|
$(function() {
|
var key = getArgsFromHref(location.href,"key");
|
var curpageIndex = getArgsFromHref(location.href,"page");
|
if(curpageIndex==""){
|
curpageIndex=1;
|
}
|
trHtml = $(".liebiao tbody").html();
|
resultTrHtml = $(".search-result > table tbody").html();
|
$(".liebiao tbody").empty();
|
|
getSecondProblemListData(curpageIndex);
|
|
//搜索
|
$(".searchBtn").bind("click", function(){
|
state=0;
|
getSecondProblemListData(1);
|
});
|
|
//全选
|
$(".checkAll").bind("click", function() {
|
if(this.checked) {
|
$(".xuanze > label >input ").prop('checked', true)
|
} else {
|
$(".xuanze > label >input ").prop('checked', false)
|
}
|
});
|
});
|
|
//获取数据
|
function getSecondProblemListData(pageIndex) {
|
var lay = layer.load(0, {
|
'shade': false
|
});
|
var searchText = $(".searchText").val();
|
|
$.post("api/v1/clientParams/getSecondProblemList", {"pageIndex": pageIndex, "key": searchText, "id": id}, function(data) {
|
if(data.code == 0) {
|
setSecondProblemListData(pageIndex, data);
|
fillPage(data.data.pageEntity, function(pageindex) {
|
getSecondProblemListData(pageindex);
|
});
|
} else {
|
layer.msg("数据访问出错");
|
}
|
layer.close(lay);
|
|
}, 'json');
|
|
}
|
|
function setSecondProblemListData(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 customerContent = data.data.getSecondProblemList[ii];
|
|
if(customerContent == undefined)
|
continue;
|
var id = customerContent.id;
|
var cnId = customerContent.cnId;
|
var title = customerContent.title;
|
var createTime = customerContent.createTime;
|
|
$(".liebiao tbody").append(trHtml);
|
var $curTr = $(".liebiao tbody tr").eq(ii);
|
$curTr.find(".xuanze input").attr("key", id);
|
$curTr.find(".title").text(title);
|
/* $curTr.find(".createTime").text(createTime); */
|
$curTr.find(".anniu").attr("key", id);
|
$curTr.find(".anniu .edit").attr("href", "edit_answerContent.html?key="+id+"&page="+(index+1));
|
var mydate = new Date(parseInt(createTime)).toLocaleString().replace(/年|月/g, "-").replace(/日/g, " ");
|
$curTr.find(".createTime").text(mydate);
|
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() {
|
deleteSecondProblem(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);
|
deleteSecondProblem(array);
|
});
|
});
|
|
//编辑 帮助中心
|
$(".liebiao tbody .edit").bind("click",function(){
|
var key = $(this).attr("key");
|
location.href="edit_answerContent.html?key="+key+"&page=1";
|
});
|
|
//给添加二级菜单传type值
|
$(".erjidh tbody .tianjia").bind("click",function(){
|
location.href="add-secondMenu.html?cnId="+cnId+"&page="+(index+1);
|
});
|
|
|
|
|
|
|
|
|
|
|
}
|
|
function deleteSecondProblem(arr){
|
$.ajax({
|
type:"post",
|
url:"api/v1/clientParams/deleteSecondProblem",
|
async:true,
|
data:{"ids":arr},
|
dataType:'json',
|
traditional: true, //阻止深度序列化
|
success:function(data){
|
if(data.code==0){
|
layer.msg("删除成功");
|
getSecondProblemListData(1);
|
}else{
|
layer.msg("删除失败");
|
}
|
},
|
error:function(data){
|
layer.msg("删除失败");
|
}
|
});
|
}
|
</script>
|
</body>
|
</html>
|