var jq = jQuery.noConflict(); jq(function(){ //请求领取礼包 jq(".giftbag-samll").on("click",function(){ jq(".giftbag-getbox").show(); popCenter('giftbagBig','giftbagMask'); }); jq(".giftbag-btn").on("click",function(){ jq.post("http://music.52jianpu.com/tanqin/codeindex.php?d=member&c=goldCenter&m=vipUserGetGold",function(data){ var allData = eval('(' + data + ')'); jq("#giftbagCoinNum").text(allData.gold); jq("#giftbagVip").text(allData.Coupon); }); jq(".giftbag-getbox").hide(); jq(".giftbag-award").show(); popCenter('giftbagBig','giftbagMask'); }); jq(".giftbag-coupon").on("click",function(){ jq(".giftbag-coupon-popup").show(); popCenter('giftbagBig','giftbagMask'); }); jq(".giftbag-close").on("click",function(){ giftbagHide(); location.reload(); }); jq(".giftbag-close-success").on("click",function(){ giftbagHide(); }); }) //居中显示函数 function popCenter(myId,mask){ var windowHeight=jq(window).height(); var windowWidth=jq(window).width(); var popHeight=jq('#'+myId).height(); var popWidth=jq('#'+myId).width(); var popY=(windowHeight-popHeight)/2; var popX=(windowWidth-popWidth)/2; jq('#'+myId).css({"top":popY,"left":popX}).fadeIn(); jq('#'+mask).fadeIn(); }; // 复制用户名 function copyToClip(content){ var aux = document.createElement("input"); aux.setAttribute("value", content); document.body.appendChild(aux); aux.select(); document.execCommand("copy"); document.body.removeChild(aux); layer.open({ content: '复制成功', skin: 'msg', time: 3 }) }; // 时间戳转换格式 function formatDate(timestamp) { var date = new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000 var Y = date.getFullYear() + '-'; var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-'; var D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()); var h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':'; var m = (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) + ':'; var s = (date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds()); return Y+M+D; } function giftbagHide(){ jq(".giftbag-getbox").hide(); jq(".giftbag-award").hide(); jq("#giftbagBig").hide(); jq("#giftbagMask").hide(); jq(".giftbag-coupon-popup").hide(); };