// 获取指定栏目ID前N条信息列表
function getTopNProByProjectID(columnid, topN, insertPanelID, showDate) {
// 首先验证其是否为空,然后验证其是否为数字
if (!isInteger(columnid))
return;
if (!isInteger(topN)) {
return;
}
if (!isInteger(showDate)) {
return;
}
$.getJSON('handlers/cistcProjectInfoList.ashx', { 'columnid': columnid, 'topN': topN, 'isall': 1 }, function (pageData) {
// alert(columnid);
//alert(insertPanelID);
var RProjectInfoList = pageData.Projectlist;
var Uptd = document.getElementById(insertPanelID);
// 构造信息列表
for (var i = 0; i < RProjectInfoList.length; i++) {
// 创建li及其样式
var li = document.createElement("li");
// li.setAttribute("class", "uk-active");
if (showDate == "1")
li.innerHTML = "" + RProjectInfoList[i].ProjectTitle + " (" + RProjectInfoList[i].Projectsystemtime + ")";
else
li.innerHTML = "" + RProjectInfoList[i].ProjectTitle + "";
Uptd.appendChild(li);
}
});
}
// 获取指定栏目ID及其所有子栏目的前N条信息列表
function getTopNAllProByProjectID(columnid, topN, insertPanelID, showDate) {
// 首先验证其是否为空,然后验证其是否为数字
if (!isInteger(columnid)) {
return;
}
if (!isInteger(topN)) {
return;
}
if (!isInteger(showDate)) {
return;
}
$.getJSON('handlers/cistcProjectInfoList.ashx', { 'columnid': columnid, 'topN': topN, 'isall': 1 }, function (pageData) {
//alert(insertPanelID);
var RProjectInfoList = pageData.Projectlist;
var Uptd = document.getElementById(insertPanelID);
// 构造信息列表
for (var i = 0; i < RProjectInfoList.length; i++) {
// 创建li及其样式
var li = document.createElement("li");
// li.setAttribute("class", "uk-article-lead");
if (showDate == "1")
li.innerHTML = "" + RProjectInfoList[i].ProjectTitle + " (" + RProjectInfoList[i].Projectsystemtime + ")";
else
li.innerHTML = "" + RProjectInfoList[i].ProjectTitle + "";
var div = document.createElement("div");
Uptd.appendChild(li);
Uptd.appendChild(div);
}
});
}
// 获取指定栏目ID前N条信息列表(支持关键字查询)
function getTopNProByProjectIDAndKey(columnid, topN, insertPanelID, keyword) {
// 首先验证其是否为空,然后验证其是否为数字
if (columnid == "") {
return;
}
if (!isInteger(topN)) {
return;
}
$.getJSON('handlers/cistcProjectInfoList.ashx', { 'columnid': columnid, 'topN': topN, 'keyword': keyword }, function (pageData) {
//alert(insertPanelID);
var RProjectInfoList = pageData.Projectlist;
var Uptd = document.getElementById(insertPanelID);
// 构造信息列表
for (var i = 0; i < RProjectInfoList.length; i++) {
// 创建li及其样式
var li = document.createElement("li");
// li.setAttribute("class", "uk-active");
li.innerHTML = "" + RProjectInfoList[i].ProjectTitle + " (" + RProjectInfoList[i].Projectsystemtime + ")";
Uptd.appendChild(li);
}
});
}
// 获取指定栏目ID的第N页项目信息列表(支持关键字查询)
function getPageAllProByProjectIDAndKey(columnid, insertPanelID, showDate, keyword, pagenum, pagesize) {
// 首先验证其是否为空,然后验证其是否为数字
// 首先验证其是否为空,然后验证其是否为数字
if (!isInteger(columnid)) {
return;
}
if (!isInteger(pagenum)) {
return;
}
if (!isInteger(pagesize)) {
return;
}
if (!isInteger(showDate)) {
return;
}
if (pagenum == "")
pagenum = GetQueryString("pagenum");
if (!isInteger(parseInt(pagenum))) {
return;
}
$.getJSON('handlers/cistcProjectInfoList.ashx', { 'columnid': columnid, 'isall': 1, 'keyword': keyword, 'pagenum': pagenum }, function (pageData) {
//alert(insertPanelID);
var RProjectInfoList = pageData.Projectlist;
var Uptd = document.getElementById(insertPanelID);
// 构造信息列表
for (var i = 0; i < RProjectInfoList.length; i++) {
// 创建li及其样式
var li = document.createElement("li");
if (showDate == "1")
li.innerHTML = "" + RProjectInfoList[i].ProjectTitle + " (" + RProjectInfoList[i].Projectsystemtime + ")";
else
li.innerHTML = "" + RProjectInfoList[i].InfoTitle + "";
Uptd.appendChild(li);
}
// 处理翻页开始
var ul = document.createElement("ul");
ul.setAttribute("class", "uk-pagination uk-pagination-left");
var currentpage = parseInt(pageData.Pagenum);
var startpage = 1;
if (currentpage > 10) {
startpage = currentpage - 8;
var li = document.createElement("li");
li.setAttribute("class", "");
li.innerHTML = "" + 1 + "";
ul.appendChild(li)
var lieto = document.createElement("li");
lieto.innerHTML = "...";
ul.appendChild(lieto)
}
var endpage = parseInt(pageData.Maxpage);
if (currentpage < parseInt(pageData.Maxpage) - 8) {
endpage = currentpage + 6;
endpage = startpage > (startpage + 12) ? startpage : (startpage + 12);
endpage = endpage > parseInt(pageData.Maxpage) ? parseInt(pageData.Maxpage) : endpage;
}
for (var i = startpage; i <= endpage; i++) {
var li = document.createElement("li");
if (parseInt(pageData.Pagenum) == i) {
li.setAttribute("class", "uk-active");
li.innerHTML = "" + i + "";
}
else {
li.setAttribute("class", "");
li.innerHTML = "" + i + "";
}
ul.appendChild(li);
}
if (endpage < parseInt(pageData.Maxpage) - 1) {
var lieto = document.createElement("li");
lieto.innerHTML = "...";
ul.appendChild(lieto)
var li = document.createElement("li");
li.setAttribute("class", "");
li.innerHTML = "" + pageData.Maxpage + "";
ul.appendChild(li)
}
Uptd.appendChild(ul);
// 翻页处理完成
});
}
// 判断输入是否为整数
function isInteger(obj) {
return typeof obj === 'number' && obj % 1 === 0
}
// 判断输入是否为正整数
function isABSInteger(obj) {
return Math.floor(obj) === obj
}