feat:初始化项目
This commit is contained in:
commit
ca52cf1bc0
486 files changed
+56656
No files matched your search
@@ -0,0 +1 @@
|
||||
"use strict";function getMessage(e,t){info[e]=t}function getScrollTip(){$(".container").hide(),$.ajax({type:"GET",url:api+"/act/queryPrizeMsg",success:function(e){if(200===e.code){for(var t in e.data)e.data[t].nick.length>4&&(e.data[t].nick=e.data[t].nick.substring(0,4)+"..."),1===e.data[t].drawType?e.data[t].table="春暖花开":e.data[t].table="满园春色";e.data.push(e.data[0]);var a={scrollMaskList:e.data};$(".container").html(template("scrollTmp",a)),$(".container").show(),animateScroll()}}})}function getGiftInfo(){turntable[clickTab].prizeIndex=[],giftIntro.giftIdArr=[],$.ajax({type:"GET",url:api+"/act/queryPrizeInfo",timeout:15e3,data:{drawType:0===clickTab?"turntable1":"turntable2"},success:function(e){if(200===e.code){for(var t in e.data)turntable[clickTab].prizeIndex.push(e.data[t].prizeId),giftIntro.giftIdArr.push(e.data[t].prizeId);console.log("giftIntro",giftIntro),info.clickStatu=!0}else $(".toast").html(e.message||"获取礼物信息出错了!").fadeIn(30).fadeOut(2e3)},error:function(e){$(".toast").html("哎呀太挤了,请稍等").fadeIn(30).fadeOut(2e3)}})}function animateScroll(){var e=$(".scrollMask").find(".container").height(),t=0;clearInterval(scrollTimer),scrollTimer=setInterval(function(){e+t>30?t-=30:($(".scrollMask").find(".container").css({top:0}),t=0),$(".scrollMask").find(".container").stop(!0,!0).animate({top:t})},2e3)}function getticketChooseShow(){var e={0:"turntable1",1:"turntable2"};$.ajax({type:"GET",url:api+"/act/queryTicketRule",data:{drawType:e[clickTab]},success:function(e){200===e.code&&($(".turnNum").find(".ticket").eq(0).html("消耗"+e.data.one+"门票"),$(".turnNum").find(".ticket").eq(1).html("消耗"+e.data.ten+"门票"),$(".turnNum").find(".ticket").eq(2).html("消耗"+e.data.hundred+"门票"))}})}function configTurnNumClass(){0===clickTab?$(".turnNum").find("li").removeClass("joy").addClass("ball"):$(".turnNum").find("li").removeClass("ball").addClass("joy")}function openSocket(){var e=null,t=0;if("undefined"==typeof WebSocket)alert("暂不支持转盘socket");else{var a=window.location.href.match("apibeta")||window.location.href.match("local")?"http://apibeta.qxjiaoyou.com:8081":"https://api.qxjiaoyou.com:8081";window.location.href.match("preview")&&(a="https://preview.qxjiaoyou.com:8081");var i=a+"/websocket/activity/"+info.roomUid;i=i.replace("https","wss").replace("http","ws"),null!==e&&(e.close(),e=null),e=new WebSocket(i),e.onopen=function(){clearInterval(tabTimer),tabTimer=setInterval(function(){t!==clickTab&&(t=clickTab)},10)},e.onmessage=function(e){var t=JSON.parse(e.data);t.data&&renderExp(t.data)},e.onclose=function(){e=null,clearTimeout(openSocketTimer),openSocketTimer=setTimeout(function(){openSocket()},5e3)},e.onerror=function(){console.log("socket错误")}}}function getExp(){$.ajax({type:"GET",url:api+"/activities/draw/getRunawayData",data:{drawType:0===clickTab?"turntable1":"turntable2",roomUid:info.roomUid},success:function(e){200===e.code&&renderExp(e.data)}})}function renderExp(e){if(tableFlag="turntable1"===e.drawType?0:1,e.runawaySwitch&&$(".experience").show(),tableFlag===clickTab){var t,a=$(".exp-container").height(),i=e.curValue/e.runawayConfigValue;t=a*i,$(".strip").stop(!0).animate({height:t},200),$(".experience").find(".maxNum").html(e.runawayConfigValue),$(".experience").find(".num").html(e.curValue)}"{}"!==JSON.stringify(e.poolPrize)?e.poolTime>0&&tableFlag===clickTab&&renderTime(e):$(".giftBox").addClass("hide")}function renderTime(e){times=e.poolTime,$(".giftBox").find("img").attr("src",e.poolPrize.prizeImgUrl),$(".giftBox").removeClass("hide"),$(".experience").find(".times").html(times+"秒"),clearInterval(timeTimer),timeTimer=setInterval(function(){times--,0===times&&(clearInterval(timeTimer),$(".giftBox").addClass("hide")),$(".experience").find(".times").html(times+"秒")},1e3)}function getTicketNum(){$.ajax({type:"GET",url:api+"/act/queryTicketNum",data:{uid:info.uid},success:function(e){200===e.code&&$(".info").find(".ticketNum").html(e.data.num)}})}function preloadImg(e){var t={imageArr:turntable[e].prizeImg,doneFunc:function(){clearInterval(imgTimer),imgTimer=setTimeout(function(){getCanvas(e)},50)}};preloadImage(t)}function getCanvas(e){var t;0===e?($("#table").show(),$("#table2").hide()):($("#table").hide(),$("#table2").show());for(var a in turntable[e].prizeImg)t=new Image,t.src=turntable[e].prizeImg[a],turntable[e].prizeImgArr.push(t);var i=turntable[e].prizeImg.length;t.onload=function(){var t=2*Math.PI/i,a=0===e?document.getElementById("table"):document.getElementById("table2"),n=a.getContext("2d");clearTimeout(canvasTimer),canvasTimer=setTimeout(function(){for(var i=0;i<turntable[e].prizeImg.length;i++){n.save(),n.translate(a.width/2,a.height/2),n.strokeStyle="transparent";var r=i*t,o=i%2;n.fillStyle=turntable[e].colors[o],n.beginPath(),n.moveTo(0,0),n.arc(0,0,214,r,r+t,!1),n.stroke(),n.fill(),n.rotate(r+t/2+Math.PI/2),n.imageSmoothEnabled=!1,n.drawImage(turntable[e].prizeImgArr[i],-55,-210,100,100),n.restoLine truncated
|
||||
Reference in new issue
Block a user