123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296 |
- var thisPageIndex = 1;
- var thisTotalPage = $("#totalpage").val();
- var thisRow = 30;
- var thisType = $(".tuku-category.tuku-active").data("type");
- var thisQs = $("#currentqs").data("qs");
- $(function () {
- setTimeout(function () { initWrapperTop(true) },150);
- setTimeout(wrapperScroll, 1000);
- $('.tuku-category').click(function () {
- var index = $(".tuku-category").index(this);
- $(".tuku-category").removeClass('tuku-active').eq(index).addClass('tuku-active');
- thisType = $(".tuku-category").eq(index).data('type');
- thisPageIndex = 0;
- thisq = $("#currentqs").data("qs");
- if (thisType == 1) {
- $('#qishu').show();
- getAll(1, "A", thisq, 1);
- }
- if (thisType == 2) {
- $('#qishu').show();
- getHot(1, "彩吧图谜", thisq, 1);
- }
- if (thisType == 3) {
- $('#qishu').hide();
- getNewest(1);
- }
- if (thisType == 4) {
- $('#qishu').hide();
- getHistory();
- }
- })
- $("body").delegate(".tuku-area-item", "click", function () {
- var index = $(".tuku-area-item").index(this);
- $(".tuku-area-item").removeClass('area-selected').eq(index).addClass('area-selected');
- thisPageIndex = 0;
- var text = $(this).find("span:eq(0)").text();
- text = text.replace(/^\s+|\s+$/g, "");
- var qs = $("#currentqs").data("qs");
- if (thisType == 1) {
- getAll(2, text, qs ,3);
- }
- if (thisType == 2) {
- getHot(2, text, qs, 3);
- }
- $(".tuku-list-wrapper")[0].scrollTop = 0;
- })
- })
- function getAll(t, a, q, add) {
- initWrapperTop(true);
- //$(".tuku-wrapper").css("top", "140px");
- if (t == 1) {
- el = $(".tuku-wrapper");
- }
- if (t == 2) {
- el = $(".tuku-list-wrapper");
- }
- var load = layer.load(2, {
- shade: [0.1, '#000']
- });
- $.ajax({
- url: "/TK/GetTKQB",
- type: "post",
- async:false,
- data: {
- t: t,
- p: thisPageIndex + 1,
- r: thisRow,
- a: a,
- q: q
- },
- success: function (res) {
- if (res != "") {
- thisPageIndex = thisPageIndex + 1;
- if (add == 1) {
- el.eq(0).html(res);
- thisTotalPage = $("#totalpage").val();
- setTimeout(wrapperScroll, 1000);
- }
- if (add==2) {
- el.eq(0).append(res);
- }
- if (add == 3) {
- el.eq(0).html(res);
- thisTotalPage = $("#totalpage").val();
- setTimeout(wrapperScroll, 1000);
- if (thisTotalPage == 0) {
- el.eq(0).html("<li style='line-height:300px;text-align:center;'>暂无图片信息!</li>");
- }
- }
- }
- else {
- layer.msg("没有更多数据了!")
- }
- layer.close(load);
- }
- })
- }
- function getHot(t, n, q, add) {
- initWrapperTop(true);
- var load = layer.load(2, {
- shade: [0.1, '#000']
- });
- //$(".tuku-wrapper").css("top", "140px");
- if (t == 1) {
- el = $(".tuku-wrapper");
- }
- if (t == 2) {
- el = $(".tuku-list-wrapper");
- }
- $.ajax({
- url: "/TK/GetTKRM",
- type: "post",
- async: false,
- data: {
- t: t,
- p: thisPageIndex+1,
- r: thisRow,
- n: n,
- q: q
- },
- success: function (res) {
- if (res != "") {
- thisPageIndex = thisPageIndex + 1;
- if (add == 1) {
- el.eq(0).html(res);
- thisTotalPage = $("#totalpage").val();
- setTimeout(wrapperScroll, 1000);
- }
- if (add == 2) {
- el.eq(0).append(res);
- }
- if (add == 3) {
- el.eq(0).html(res);
- thisTotalPage = $("#totalpage").val();
- setTimeout(wrapperScroll, 1000);
- if (thisTotalPage == 0) {
- el.eq(0).html("<li style='line-height:300px;text-align:center;padding-left: 98px;'>暂无图片信息!</li>");
- }
- }
- }
- else {
- layer.msg("没有更多数据了!")
- }
- layer.close(load);
- }
- })
- }
- function getNewest(t) {
- initWrapperTop();
- var load = layer.load(2, {
- shade: [0.1, '#000']
- });
- //$(".tuku-wrapper").css("top", "100px");
- $.ajax({
- url: "/TK/GetTKZX",
- type: "post",
- async: false,
- data: {
- t:t,
- p: thisPageIndex+1,
- r: thisRow,
- q: thisQs
- },
- success: function (res) {
- if (res != "") {
- thisPageIndex = thisPageIndex + 1;
- if (t == 1) {
- $(".tuku-wrapper").html(res);
- thisTotalPage = $("#totalpage").val();
- setTimeout(wrapperScroll, 1000);
- }
- else if (t == 2) {
- $(".tuku-list-wrapper").append(res);
- }
- }
- else {
- layer.msg("没有更多数据了!")
- }
- thisTotalPage = $("#totalpage").val();
- layer.close(load);
- }
- })
- }
- function getHistory() {
- initWrapperTop();
- var load = layer.load(2, {
- shade: [0.1, '#000']
- });
- $.ajax({
- url: "/TK/GetTKLS",
- type: "post",
- success: function (res) {
- $(".tuku-wrapper").html(res).css("top", "100px");
- layer.close(load);
- }
- })
- }
- function getPeriods(el, t) {
- if ($(el).hasClass("notActive")) {
- layer.msg("当前已经是最近一期!");
- return;
- }
- thisPageIndex = 0;
- var curentQs = $("#currentqs").data("qs");
- var a = $(".tuku-area-item.area-selected").find("span:eq(0)").text().replace(/^\s+|\s+$/g, "");
- if (t == 1) {
- var qs = String(curentQs - 1);
- var year = Number(qs.substr(0, 4))-1;
- var num = qs.substr(4);
- if (num == '000') {
- $.ajax({
- url: "/TK/Getqs",
- type: "post",
- async: false,
- data: { y: year },
- success: function (data) {
- qs = data;
- $(".tuku-qishu-left").attr("data-"+year,data);
- }
- })
- }
- }
- else if (t == 2) {
- var qs = String(curentQs);
- var year = Number(qs.substr(0, 4));
- if ($(".tuku-qishu-left").attr("data-" + year)) {
- var ynum = $(".tuku-qishu-left").attr("data-" + year);
- if (Number(qs) < Number(ynum)) {
- qs = Number(qs) + 1;
- }
- else {
- qs = (year + 1) + "001";
- }
- }
- else {
- qs = Number(qs) + 1;
- }
- }
- $("#currentqs").text("第" + qs + "期").data("qs", qs);
- if (thisType == 1) {
- getAll(2, a, qs, 3);
- }
- if (thisType == 2) {
- getHot(2, a, qs, 3);
- }
- if (thisQs != qs) {
- $(".tuku-qishu-right").removeClass("notActive");
- } else {
- $(".tuku-qishu-right").addClass("notActive");
- }
- $(".tuku-list-wrapper")[0].scrollTop = 0;
- }
- function wrapperScroll() {
- var wrapper = $(".tuku-list-wrapper")[0];
- wrapper.addEventListener("scroll", function () {
- var ch = wrapper.clientHeight;
- var st = wrapper.scrollTop;
- var sh = wrapper.scrollHeight;
- if (st + ch - sh >= -10) {
- if (thisPageIndex < thisTotalPage) {
- if (thisType == 1) {
- var a = $(".tuku-area-item.area-selected").find("span:eq(0)").text().replace(/^\s+|\s+$/g, "");
- var q = $("#currentqs").data("qs");
- getAll(2, a, q, 2);
- }
- if (thisType == 2) {
- var a = $(".tuku-area-item.area-selected").find("span:eq(0)").text().replace(/^\s+|\s+$/g, "");
- var q = $("#currentqs").data("qs");
- getHot(2, a, q, 2);
- }
- if (thisType == 3) {
- getNewest(2);
- }
- }
- }
- })
- }
- function toAll(el) {
- var q = $(el).find("span:eq(0)").text();
- $(".tuku-category").removeClass('tuku-active').eq(0).addClass('tuku-active');
- thisType = $(".tuku-category").eq(0).data('type');
- $("#currentqs").data("qs", q).text("第" + q + "期");
- thisPageIndex = 0;
- $('#qishu').show();
- getAll(1, "A", q, 1);
- }
- function initWrapperTop(qs) {
- $("#ads-wrapper").show();
- var h1 = $("#ads-wrapper").height();
- var h = h1 + 40;
- if (qs) {
- h = h + 40;
- }
- $("#wrapper1").css({ top: h + "px" })
- }
|