You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
7.0 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/*create by2016-01-22! The author:118154194@qq.com! */
define(["jquery","base","kkpager"],function(){function a(a,b){var c=new Date(1e3*a),d=c.getFullYear(),e=c.getMonth()+1<10?"0"+(c.getMonth()+1):c.getMonth()+1,f=c.getDate()<10?"0"+c.getDate():c.getDate(),g=c.getHours()<10?"0"+c.getHours():c.getHours(),h=c.getMinutes()<10?"0"+c.getMinutes():c.getMinutes();return"y-m-dd h:i"==b?d+"-"+e+"-"+f+" "+g+":"+h:"m-d"==b?e+"-"+f:"h:i"==b?g+":"+h:void 0}var b={u:window.location.href,api:"http://api.65.com/"},c={seagift:"#seagift",btnsergift:"#btn-sergift",getgifts:".get-gifts",seagift:"#seagift",btnsergift:"#btn-sergift"},d={giftlist:function(c){$.getJSON(b.api+"65api/mplantform_info.php?callback=?",{action:"card_list",page:c,end:12},function(b){if(1==b.code){for(var e="",f=b.card_list.length,g=0;f>g;g++)0==b.card_list[g].card_isuse?e+='<li><img class="abs gift-img" src="'+b.card_list[g].game_pic+'" alt="'+b.card_list[g].game_name+'"><div class="abs gift-name"><div><strong>'+b.card_list[g].game_name+"</strong><span>"+b.card_list[g].type_name+'</span><p class="fl ico-3 ginfo"><i class="ico-3 ico-'+b.card_list[g].card_gtype+'"></i></p></div></div><p class="abs gift-tab"><a title="礼包内容" href="javascript:" class="fl gift-info on">礼包内容</a><a title="使用说明" href="javascript:" class="fr gift-dec">使用说明</a></p><p class="abs gift-tab-cont" style="display: block;">'+b.card_list[g].gift_content+'</p><p class="abs gift-tab-cont hide" style="display: none;">'+b.card_list[g].gift_direction+'</p><p class="abs gift-time">(兑换截止:<span>'+a(b.card_list[g].type_die_time,"y-m-dd h:i")+'</span></p><p class="abs login-tip">请先 <a class="login-link login-link2" href="javascript:" title="登录">[登录]</a> 或 <a class="registet-link" href="javascript:" title="注册">[注册]</a></p><p class="abs get-gifts-show get-gifts-btn" style="display: none;"></p><a href="javascript:;" class="abs ico-3 ico-btn-ani get-gifts get-gifts-btn" data-type-id="'+b.card_list[g].type_id+'">领取礼包</a></li>':1==b.card_list[g].card_isuse&&(e+='<li><img class="abs gift-img" src="'+b.card_list[g].game_pic+'" alt="'+b.card_list[g].game_name+'"><div class="abs gift-name"><div><strong>'+b.card_list[g].game_name+"</strong><span>"+b.card_list[g].type_name+'</span><p class="fl ico-3 ginfo"><i class="ico-3 ico-'+b.card_list[g].card_gtype+'"></i></p></div></div><p class="abs gift-tab"><a title="礼包内容" href="javascript:" class="fl gift-info on">礼包内容</a><a title="使用说明" href="javascript:" class="fr gift-dec">使用说明</a></p><p class="abs gift-tab-cont" style="display: block;">'+b.card_list[g].gift_content+'</p><p class="abs gift-tab-cont hide" style="display: none;">'+b.card_list[g].gift_direction+'</p><p class="abs gift-time">(兑换截止:<span>'+a(b.card_list[g].type_die_time,"y-m-dd h:i")+'</span></p><p class="abs get-gifts-btn">激活码:'+b.card_list[g].card_num+"</p></li>");$("#gift-list").html(e);var h=b.total,i=Math.ceil(h/12);kkpager.generPageHtml({pno:c,total:i,totalRecords:h,isShowTotalPage:!1,isShowCurrPage:!1,isGoPage:!1,mode:"click",click:function(a){return d.giftlist(a),this.selectPage(a),!1}})}})},sergiftlist:function(e,f){var g=$(c.seagift).val(),h=""==g||null==g?e:g;$.getJSON(b.api+"65api/mplantform_info.php?callback=?",{action:"card_list",page:f,end:12,keyword:h},function(e){if(1==e.code){var g="",h=e.card_list.length;if(0==h||""==h)return alert("您搜索的内容不存在,请重新输入"),!1;for(var i=0;h>i;i++)0==e.card_list[i].card_isuse?g+='<li><img class="abs gift-img" src="'+e.card_list[i].game_pic+'" alt="'+e.card_list[i].game_name+'"><div class="abs gift-name"><div><strong>'+e.card_list[i].game_name+"</strong><span>"+e.card_list[i].type_name+'</span><p class="fl ico-3 ginfo"><i class="ico-3 ico-'+e.card_list[i].card_gtype+'"></i></p></div></div><p class="abs gift-tab"><a title="礼包内容" href="javascript:" class="fl gift-info on">礼包内容</a><a title="使用说明" href="javascript:" class="fr gift-dec">使用说明</a></p><p class="abs gift-tab-cont" style="display: block;">'+e.card_list[i].gift_content+'</p><p class="abs gift-tab-cont hide" style="display: none;">'+e.card_list[i].gift_direction+'</p><p class="abs gift-time">(兑换截止:<span>'+a(e.card_list[i].type_die_time,"y-m-dd h:i")+'</span></p><p class="abs login-tip">请先 <a class="login-link login-link2" href="javascript:" title="登录">[登录]</a> 或 <a class="registet-link" href="javascript:" title="注册">[注册]</a></p><p class="abs get-gifts-show get-gifts-btn" style="display: none;"></p><a href="javascript:;" class="abs ico-3 ico-btn-ani get-gifts get-gifts-btn" data-type-id="'+e.card_list[i].type_id+'">领取礼包</a></li>':1==e.card_list[i].card_isuse&&(g+='<li><img class="abs gift-img" src="'+e.card_list[i].game_pic+'" alt="'+e.card_list[i].game_name+'"><div class="abs gift-name"><div><strong>'+e.card_list[i].game_name+"</strong><span>"+e.card_list[i].type_name+'</span><p class="fl ico-3 ginfo"><i class="ico-3 ico-'+e.card_list[i].card_gtype+'"></i></p></div></div><p class="abs gift-tab"><a title="礼包内容" href="javascript:" class="fl gift-info on">礼包内容</a><a title="使用说明" href="javascript:" class="fr gift-dec">使用说明</a></p><p class="abs gift-tab-cont" style="display: block;">'+e.card_list[i].gift_content+'</p><p class="abs gift-tab-cont hide" style="display: none;">'+e.card_list[i].gift_direction+'</p><p class="abs gift-time">(兑换截止:<span>'+a(e.card_list[i].type_die_time,"y-m-dd h:i")+'</span></p><p class="abs get-gifts-btn">激活码:'+e.card_list[i].card_num+"</p></li>");$("#gift-list").html(g);var j=e.total,k=Math.ceil(j/12);kkpager.generPageHtml({pno:f,total:k,totalRecords:j,isShowTotalPage:!1,isShowCurrPage:!1,isGoPage:!1,mode:"click",click:function(a){var e=$(c.seagift).val();if(""!=e)d.sergiftlist(e,a);else if(location.href.indexOf("gift/?word")>=0){var f=b.u,g=decodeURI(f.split("?")[1].split("=")[1]);""!=g&&d.sergiftlist(g,"1")}else location.href.indexOf("gift")>=0&&d.giftlist(1);return this.selectPage(a),!1}})}})},getgiftnum:function(a){var c=$(a).attr("data-type-id");$.getJSON(b.api+"65api/mplantform_info.php?callback=?",{action:"get_card",tid:c},function(b){1==b.code||-3==b.code?($(a).hide(),$(a).siblings("p.get-gifts-show").show().html("激活码:"+b.card_num)):-2==b.code?$(a).siblings("p.login-tip").show():($(a).hide(),$(a).siblings("p.get-gifts-show").show().html(b.msg))})}};if($(c.getgifts).live("click",function(){d.getgiftnum(this)}),$(c.seagift).focus(function(){$(this).parent().addClass("on")}).blur(function(){$(this).parent().removeClass("on")}),$(c.btnsergift).click(function(){d.sergiftlist("",1)}),$(".gift-tab a").live("mouseenter",function(){var a=$(this).index();$(this).siblings("a").removeClass("on"),$(this).addClass("on"),$(this).parent().siblings("p.gift-tab-cont").hide(),$(this).parent().siblings("p.gift-tab-cont:eq("+a+")").fadeIn(200)}),location.href.indexOf("gift/?word")>=0){var e=b.u,f=decodeURI(e.split("?")[1].split("=")[1]);""!=f&&d.sergiftlist(f,"1")}else location.href.indexOf("gift")>=0&&d.giftlist(1)});