var LocString = String(window.document.location.href);
//接收地址的参数值
function GetQueryString(str) {
var rs = new RegExp("(^|)" + str + "=([^&]*)(&|$)", "gi").exec(LocString), tmp;
if (tmp = rs) { return tmp[2] };
return "";
}
var page = 1;
var issift = GetQueryString("issift");
$(GetData_Sift);
//上一页下一页点击
function NextClick(e) {
page = page - e;
fenye();
}
//页数选择
function YeShu(e) {
page = $(e).val();
fenye();
}
//页数
function GetData_Page() {
var html = "";
$("#fenye").html(html);
var pagenum = 1;
if (RecordData != null) {
pagenum = Math.ceil(RecordData.length / 10);
}
if (page == 1) {
html += "<span style="margin-right:15px;color:#888;">上一页</span>";
}
else {
html += "<span onclick='NextClick(1)' style="margin-right:15px;cursor:pointer;">上一页</span>";
}
html += "<select onchange='YeShu(this)'>";
for (var i = 1; i <= pagenum; i++) {
if (page == i) {
html += "<option selected='selected' value='" + i + "'>" + i + "</option>";
}
else {
html += "<option value='" + i + "'>" + i + "</option>";
}
}
html += "</select>";
if (page == pagenum) {
html += "<span style="margin-left:15px;color:#888;">下一页</span>";
}
else {
html += "<span onclick='NextClick(-1)' style="margin-left:15px;cursor:pointer;">下一页</span>";
}
$("#fenye").html(html);
}
//总排名分页显示
function fenye() {
var irank = (parseInt(page) - 1) * 10;
var html = '';
$("#list").html(html);
var sift = "0";
var ischeck = "";
var time = "";
for (var i = 0; i < 10; i++) {
if (RecordData != null) {
if (irank < RecordData.length) {
sift = RecordData[irank].issift;
time = RecordData[irank].created;
html += "<li onmouseover='ShowQRCode(this)' onmouseout='HideQRCode(this)'>";
html += "<input type='text' class='sift' value='" + RecordData[irank].id + "' style='display:none;'>";
html += "<span class='title'>作品名称:" + RecordData[irank].title + "</span><span class='line'></span>";
html += "<span class='pic'>图标:</span><img style='display:block;float:left;100px;height:100px;' src='" + RecordData[irank].picture + "' /><span class='line'></span>";
html += "<span class='creator'>发布人:" + RecordData[irank].creator + "</span><span class='line'></span>";
html += "<span class='created'>发布时间:" + time.substring(0, 10) + "</span><span class='line'></span>";
if (sift) {
html += "<span>是否精选:<input disabled='disabled' checked='checked' type='checkbox' /></span>";
}
else {
html += "<span>是否精选:<input type='checkbox' onclick='IsSift(this)' /></span>";
}
html += "<span><a style='color:#fff;text-decoration:none;padding:8px 12px;background:#ccc;margin-left:20px;border-radius:5px;' href='" + RecordData[irank].preview + "' target='_blank'>查看作品</a></span>";
html += "<img class='qrcode' style='100px;display:none;margin-top:0px;margin-left:30px;' src='../../QRCode.aspx?Code=" + RecordData[irank].preview + "' />";
html += "</li>";
}
irank++;
}
else {
html = "没有数据";
}
}
$("#list").html(html);
GetData_Page();
}
var RecordData = null;
//按条件查询作品
function GetData_Sift() {
RecordData = null;
var title = '', creator = '', created = '';
if ($("#title").val() != "") {
title = $("#title").val();
}
if ($("#creator").val() != "") {
creator = $("#creator").val();
}
if ($("#created").val() != "") {
created = $("#created").val();
}
if (issift == "1") {
$(".two").attr("selected", "selected");
}
else if (issift == "0") {
$(".one").attr("selected", "selected");
}
else {
$(".allthis").attr("selected", "selected");
}
var ParasJson = { "title": title, "creator": creator, "created": created, "issift": issift };
$.ajax({
type: 'post',
url: '../DataManage.ashx?Type=GetData_Sift',
dataType: 'json',
data: ParasJson,
async: false,
success: function (result) {
if (result != null) {
var rank = result.Rows;
if (rank.length > 0) {
RecordData = result.Rows;
}
fenye();
}
}
});
}