/*! 版权所有,翻版必究 */!function(t){var e={};function n(a){if(e[a])return e[a].exports;var r=e[a]={i:a,l:!1,exports:{}};return t[a].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,a){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(a,r,function(e){return t[e]}.bind(null,r));return a},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=9)}([function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",a=t[3];if(!a)return n;if(e&&"function"==typeof btoa){var r=(o=a,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */"),i=a.sources.map((function(t){return"/*# sourceURL="+a.sourceRoot+t+" */"}));return[n].concat(i).concat([r]).join("\n")}var o;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n})).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var a={},r=0;r=0&&l.splice(e,1)}function g(t){var e=document.createElement("style");return t.attrs.type="text/css",u(e,t.attrs),k(t,e),e}function u(t,e){Object.keys(e).forEach((function(n){t.setAttribute(n,e[n])}))}function y(t,e){var n,a,r,i;if(e.transform&&t.css){if(!(i=e.transform(t.css)))return function(){};t.css=i}if(e.singleton){var o=c++;n=f||(f=g(e)),a=v.bind(null,n,o,!1),r=v.bind(null,n,o,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return t.attrs.type="text/css",t.attrs.rel="stylesheet",u(e,t.attrs),k(t,e),e}(e),a=O.bind(null,n,e),r=function(){w(n),n.href&&URL.revokeObjectURL(n.href)}):(n=g(e),a=z.bind(null,n),r=function(){w(n)});return a(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;a(t=e)}else r()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=o()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=b(t,e);return p(n,e),function(t){for(var a=[],r=0;r{this.element.classList.remove("bounceInRight"),this.element.classList.add("bounceOutRight"),this.onComplete&&this.onComplete()},4e3)}}let m=(()=>{let t=[];return function(e){let n;n=t.length>0?t.shift():new s({onComplete(){t.push(n)}}),n.start(e)}})();function f(t){let e=a[t];e.type===r&&e.count;let n=`
正在抽取,剩余
",document.querySelector("#prizeBar").innerHTML=n}let c=function(t,e,n){let r=a[t],s=r.type,m=i[s],f=r.count;if(m||(m={box:document.querySelector("#prize-item-"+s),bar:document.querySelector("#prize-bar-"+s),text:document.querySelector("#prize-count-"+s)},i[s]=m),i.prizeType||(i.prizeType=document.querySelector("#prizeType"),i.prizeLeft=document.querySelector("#prizeLeft"),i.prizeText=document.querySelector("#prizeText")),n)for(let e=a.length-1;e>t;e--){let t=a[e].type;document.querySelector("#prize-item-"+t).className="prize-item done",document.querySelector("#prize-bar-"+t).style.width="0",document.querySelector("#prize-count-"+t).textContent="0/"+a[e].count}if(o!==t){let e=a[o],n=document.querySelector("#prize-item-"+e.type);n.classList.remove("shine"),n.classList.add("done"),m.box&&m.box.classList.add("shine"),i.prizeType.textContent=r.text,i.prizeText.textContent=r.title,o=t}if(0===t)return i.prizeType.textContent="特别奖",i.prizeText.textContent=" ",void(i.prizeLeft.textContent="不限制");let c=((e=(e=f-e)<0?0:e)/f).toFixed(2);m.bar&&(m.bar.style.width=100*c+"%"),m.text&&(m.text.textContent=e+"/"+f),i.prizeLeft.textContent=e};var l=n(2);let d,p,b,k,w,g,u,y,h,x,v,z={enter:document.querySelector("#enter"),lotteryBar:document.querySelector("#lotteryBar"),lottery:document.querySelector("#lottery"),fullScreen:document.querySelector("#fullScreen")},O=[],I=[],X={table:[],sphere:[]},L=[],U=!1,R={prizes:[],users:[],luckyUsers:{},leftUsers:[]},E=!1,Y=[];function D(t=!1){E=t}function T(t){switch(t){case"enter":z.enter.classList.remove("none"),z.lotteryBar.classList.add("none"),M(X.table,2e3);break;default:z.enter.classList.add("none"),z.lotteryBar.classList.remove("none"),M(X.sphere,2e3)}}function S(t,e){let n=document.createElement("div");return n.className=t||"",n.innerHTML=e||"",n}function B(t,e,n,a){var r=S();return r.id="card-"+n,e?(r.className="element lightitem",a&&r.classList.add("highlight")):(r.className="element",r.style.backgroundColor="rgba(0,127,127,"+(.7*Math.random()+.25)+")"),r.appendChild(S("company",k)),r.appendChild(S("name",t[1])),r.appendChild(S("details",t[2])),r}function M(t,e){for(var n=0;n{let n=I[e],a=X.sphere[e];new TWEEN.Tween(n.position).to({x:a.position.x,y:a.position.y,z:a.position.z},Math.random()*t+t).easing(TWEEN.Easing.Exponential.InOut).start(),new TWEEN.Tween(n.rotation).to({x:a.rotation.x,y:a.rotation.y,z:a.rotation.z},Math.random()*t+t).easing(TWEEN.Easing.Exponential.InOut).start()}),new Promise((e,n)=>{new TWEEN.Tween(this).to({},2*t).onUpdate(j).start().onComplete(()=>{L.forEach(t=>{I[t].element.classList.remove("prize")}),e()})}))}function q(){z.lottery.innerHTML="结束抽奖",new Promise((t,e)=>{g.rotation.y=0,h=new TWEEN.Tween(g.rotation),h.to({y:6*Math.PI*1e3},3e6).onUpdate(j).start().onStop(()=>{g.rotation.y=0,t()}).onComplete(()=>{t()})}).then(()=>{Y=[],L=[];let t=b[x],e=R.luckyUsers[v.type],n=R.leftUsers.length,a=v.count-(e?e.length:0);n5){let t=[-87,87],a=L.length,r=Math.ceil(a/2);e=-(r-1)/2;for(let a=0;a0;t--)n.push({x:140*e*1,y:0}),e++;let a=Y.map(t=>t[1]);m(`恭喜${a.join("、")}获得${v.title}, 新的一年必定旺旺旺。`),L.forEach((a,r)=>{W(a,Y[r]);var i=I[a];new TWEEN.Tween(i.position).to({x:n[r].x,y:1*n[r].y,z:2200},Math.random()*t+t).easing(TWEEN.Easing.Exponential.InOut).start(),new TWEEN.Tween(i.rotation).to({x:0,y:0,z:0},Math.random()*t+t).easing(TWEEN.Easing.Exponential.InOut).start(),i.element.classList.add("prize"),e++}),new TWEEN.Tween(this).to({},2*t).onUpdate(j).start().onComplete(()=>{D()})}()})}function N(){if(!v)return;let t=v.type,e=R.luckyUsers[t]||[];return e=e.concat(Y),R.luckyUsers[t]=e,v.count<=e.length&&(x--,x<=-1&&(x=0),v=R.prizes[x]),Y.length>0?function(t,e){return new Promise((n,a)=>{window.AJAX({url:"/saveData",data:{type:t,data:e},success(){n()},error(){a()}})})}(t,Y):Promise.resolve()}function $(t){return Math.floor(Math.random()*t)}function W(t,e){I[t].element.innerHTML=`
${k}
${e[1]}
${e[2]||"PSST"}
`}function H(t,e){I[t].element.style.backgroundColor=e||"rgba(0,127,127,"+(.7*Math.random()+.25)+")"}window.AJAX({url:"/getTempData",success(t){var e;p=t.cfgData.prizes,b=t.cfgData.EACH_COUNT,k=t.cfgData.COMPANY,O=function(){let t=(new Date).getFullYear()+"",e=1,n=[];return t.split("").forEach(t=>{n=n.concat(l.NUMBER_MATRIX[t].map(t=>`${t[0]+e}-${t[1]+1}`)),e+=4}),n}(),R.prizes=p,a=e=p,r=a[0].type,o=e.length-1,d=119,R.leftUsers=t.leftUsers,R.luckyUsers=t.luckyData;let n=R.prizes.length-1;for(;n>-1;n--)if(!(t.luckyData[n]&&t.luckyData[n].length>=R.prizes[n].count)){x=n,v=R.prizes[x];break}f(x);let i=R.luckyUsers[v.type];c(x,i?i.length:0,!0)}}),window.AJAX({url:"/getUsers",success(t){R.users=t,function(){let t=R.users.slice(),e=t.length,n=!1,a=R.leftUsers.length===R.users.length,r=0,s=(t.length,{x:1180,y:620});w=new THREE.PerspectiveCamera(40,window.innerWidth/window.innerHeight,1,1e4),w.position.z=3e3,g=new THREE.Scene;for(let i=0;i<7;i++)for(let o=0;o<17;o++){n=O.includes(o+"-"+i);var l=B(t[r%e],n,r,a);(L=new THREE.CSS3DObject(l)).position.x=4e3*Math.random()-2e3,L.position.y=4e3*Math.random()-2e3,L.position.z=4e3*Math.random()-2e3,g.add(L),I.push(L),(L=new THREE.Object3D).position.x=140*o-s.x,L.position.y=-180*i+s.y,X.table.push(L),r++}for(var d=new THREE.Vector3,p=0,k=I.length;p{t.classList.remove("highlight")}),m(`马上抽取[${v.title}],不要走开。`),U=!0,T("lottery");break;case"reset":if(!window.confirm("是否确认重置数据,重置后,当前已抽的奖项全部清空?"))return;m("重置所有数据,重新抽奖"),document.querySelectorAll(".lightitem").forEach(t=>{t.classList.add("highlight")}),A(),Y=[],R.leftUsers=Object.assign([],R.users),R.luckyUsers={},x=R.prizes.length-1,v=R.prizes[x],function(t){i={},o=t,f(t)}(x),window.AJAX({url:"/reset",success(t){console.log("重置成功")}}),T("enter");break;case"lottery":D(!0),N(),function(){let t=R.luckyUsers[v.type],e=(t?t.length:0)+b[x];c(x,e)}(),A().then(t=>{q()}),m(`正在抽取[${v.title}],调整好姿势`);break;case"reLottery":if(0===Y.length)return void m("当前还没有抽奖,无法重新抽取喔~~");e=Y,new Promise((t,n)=>{window.AJAX({url:"/errorData",data:{data:e},success(){t()},error(){n()}})}),m(`重新抽取[${v.title}],做好准备`),D(!0),A().then(t=>{q()});break;case"save":N().then(t=>{A().then(t=>{Y=[]}),window.AJAX({url:"/export",success(t){"success"===t.type&&(location.href=t.url)}}),m("数据已保存到EXCEL中。")});break;case"fullScreen":document.fullscreenElement?(document.exitFullscreen(),z.fullScreen.innerHTML="全屏"):(document.documentElement.requestFullscreen(),z.fullScreen.innerHTML="退出全屏")}var e})),window.addEventListener("resize",Z,!1),T(a?"enter":"lottery")}(),C(),function(){let t,e=10+$(10);setInterval(()=>{if(!E){t=R.leftUsers.length;for(let n=0;n{n=!1,function t(){requestAnimationFrame((function(){n||(e%=360,a.style.transform="rotate("+e+"deg)",e+=1,t())}))}()},()=>{m("背景音乐自动播放失败,请手动播放!")}):(t.pause(),n=!0)}),!1),setTimeout((function(){a.click()}),1e3)}}]);