import{a6 as e,_ as s,b as i,c as l,d as o,e as t,C as n,B as a,X as c,D as r}from"./index-4cb6f38c.js";const d={class:"wheel-container"},m={class:"top-section"},h={class:"expire-time"},g={class:"top-right"},u={class:"icon-item"},p=["src"],f=["src"],v=["src"],b={class:"wheel-section"},I={class:"wheel-wrapper"},T=["src"],w=["src"],z=["src"],M={class:"remaining-section"},k=["src"],R={class:"remaining-text"},x=["disabled"],y=["src"],C={key:0,class:"prize-modal"},A={class:"modal-content"},B=["src"],F=["src"],P={class:"prize-info"},S={class:"prize-title"},V={class:"prize-amount-wrapper"},W=["src"],L={class:"prize-amount"},N={key:1,class:"no-times-modal"},U={class:"no-times-content"},D=["src"],_={key:2,class:"rule-modal"},q={class:"rule-content"},H=["src"],Q=["src"],E={key:3,class:"rule-modal"},X={class:"rule-content"},j=["src"],G=["src"];var K=s({name:"FortuneWheel",data:()=>({historyImg:"https://d31zlh4on95l9h.cloudfront.net/images/aed693de6beb9faae015fd0628c4f052.png",ruleImg:"https://d31zlh4on95l9h.cloudfront.net/images/9a3f7680b29e31b60151cf562c0d43cb.png",homeImg:"https://d31zlh4on95l9h.cloudfront.net/images/453475456dad8e6832e9904c901c1274.png",titleImg:"https://d31zlh4on95l9h.cloudfront.net/images/a87d19806fed47b7fdf18d4b5dd70e65.png",wheelImg:"https://d31zlh4on95l9h.cloudfront.net/images/d925f375c9ef15a751500ae130d91fe5.png",pointerImg:"https://d31zlh4on95l9h.cloudfront.net/images/9c09631c202b78cc06b8935c17431dac.png",pointerCoverImg:"https://d31zlh4on95l9h.cloudfront.net/images/536c171c263990b12f1cc0a6e511b5e7.png",remainingBgImg:"https://d31zlh4on95l9h.cloudfront.net/images/a43f0c383d55fc56b34768f039a401a8.png",spinBtnImg:"https://d31zlh4on95l9h.cloudfront.net/images/11b749e0fd4b08238980b74c6e80b2e6.png",disabledSpinBtnImg:"https://d31zlh4on95l9h.cloudfront.net/images/9b7383c1f80bb32a279791879947791a.png",modalBgImg:"https://d31zlh4on95l9h.cloudfront.net/images/f75ce9ca2703662fd3176dd0493f6d7b.png",prizeAmountImg:"https://d31zlh4on95l9h.cloudfront.net/images/878b8ea0c78bcafdaf4f6eb63a0b2eef.png",closeBtnImg:"https://d31zlh4on95l9h.cloudfront.net/images/453475456dad8e6832e9904c901c1274.png",noTimesImg:"https://d31zlh4on95l9h.cloudfront.net/images/a67e8b3de6e441af7bcb8fbbb2153ec2.png",ruleBgImg:"https://d31zlh4on95l9h.cloudfront.net/images/9f585ee0ab251f348a4568355ad36816.png",closeRuleBtnImg:"https://d31zlh4on95l9h.cloudfront.net/images/ca2ddd411ffb85968bc261382477c984.png",token:"",expireTime:"",remainingTimes:0,isSpinning:!1,showPrizeModal:!1,showNoTimesModal:!1,showRuleModal:!1,isFirstVisit:!0,currentRotation:0,noTimesTimer:null,prizeMessage:"",prizeAmount:""}),mounted(){this.token=decodeURIComponent(this.getQueryString("token")),this.fetchWheelInfo(),this.getTokenFromURL()},methods:{getQueryString(e){var s=new RegExp("(^|&)"+e+"=([^&]*)(&|$)","i"),i=window.location.search.substr(1).match(s);return console.log("获取token方法getQueryString"+s),console.log("获取token方法getQueryString"+i),null!=i?unescape(i[2]):null},getTokenFromURL(){const e=new URLSearchParams(window.location.search).get("token");console.log("getTokenFromURL"+e),e?(this.token=decodeURIComponent(e),console.log("getTokenFromURL"+this.token),console.log("获取到Token:",this.token)):console.log("URL中没有找到token参数")},fetchWheelInfo(){var s;(s={token:"pC134lIG1xDIbIi1ohnnbZi0+fEeMx8pywnIlrmTxdwROKkuwWqAWu9orpkpeXVqL98DPfeonNYpHv+mucA"},e({url:"http://h4698ee4.natappfree.cc/api/goldWheel/info",method:"post",data:s})).then((e=>{200===e.code?(this.expireTime=e.data.deadline,this.remainingTimes=e.data.count):console.error("API返回错误:",e.msg)})).catch((e=>{console.error("API调用失败:",e)}))},fetchPrizeInfo(){return(s={token:"pC134lIG1xDIbIi1ohnnbZi0+fEeMx8pywnIlrmTxdwROKkuwWqAWu9orpkpeXVqL98DPfeonNYpHv+mucA"},e({url:"http://h4698ee4.natappfree.cc/api/goldWheel/drawPrize",method:"post",data:s})).then((e=>{if(200===e.code){const s=e.data.split(" ");return this.prizeMessage=s.slice(0,-1).join(" "),this.prizeAmount=s[s.length-1],this.fetchWheelInfo(),!0}return console.error("抽奖API返回错误:",e.msg),this.prizeMessage="抽奖失败",this.prizeAmount="请重试",!1})).catch((e=>(console.error("抽奖API调用失败:",e),this.prizeMessage="网络错误",this.prizeAmount="请重试",!1)));var s},async handleSpin(){if(this.showRuleModal||this.isFirstVisit)return;if(this.remainingTimes<=0)return this.showNoTimesModal=!0,this.noTimesTimer&&clearTimeout(this.noTimesTimer),void(this.noTimesTimer=setTimeout((()=>{this.showNoTimesModal=!1}),3e3));if(this.isSpinning)return;this.isSpinning=!0;const e=this.currentRotation+1440;this.currentRotation=e;const s=await this.fetchPrizeInfo();setTimeout((()=>{this.isSpinning=!1,s&&setTimeout((()=>{this.showPrizeModal=!0}),500)}),3e3)},handleRuleClick(){this.showRuleModal=!0},closeModal(){this.showPrizeModal=!1},closeNoTimesModal(){this.showNoTimesModal=!1,this.noTimesTimer&&clearTimeout(this.noTimesTimer)},closeRuleModal(){this.showRuleModal=!1},closeFirstVisitModal(){this.isFirstVisit=!1}}},[["render",function(e,s,K,O,Y,Z){return i(),l("div",d,[o(" 顶部区域 "),t("div",m,[t("div",h,"财富金轮到期时间:"+n(Y.expireTime),1),t("div",g,[t("div",u,[t("img",{src:Y.historyImg,class:"history-icon",alt:"历史记录"},null,8,p),s[9]||(s[9]=t("span",{class:"icon-text"},"历史记录",-1))]),t("div",{class:"icon-item",onClick:s[0]||(s[0]=(...e)=>Z.handleRuleClick&&Z.handleRuleClick(...e))},[t("img",{src:Y.ruleImg,class:"rule-icon",alt:"活动规则"},null,8,f),s[10]||(s[10]=t("span",{class:"icon-text"},"活动规则",-1))])])]),o(" 主标题图片 "),t("img",{src:Y.titleImg,class:"title-img",alt:"转动财富金轮 开启财富人生"},null,8,v),o(" 转盘区域 "),t("div",b,[t("div",I,[o(" 转盘图片尺寸:333x333 "),t("img",{src:Y.wheelImg,class:a(["wheel-img",{spinning:Y.isSpinning}]),style:c({transform:`rotate(${Y.currentRotation}deg)`}),alt:"财富金轮",ref:"wheel"},null,14,T),o(" 指针图片尺寸:137x137 "),t("img",{src:Y.pointerImg,class:"pointer-img",alt:"指针"},null,8,w),o(" 指针盖图片尺寸:104x106 "),t("img",{src:Y.pointerCoverImg,class:"pointer-cover-img",alt:"指针盖"},null,8,z)])]),o(" 剩余次数 "),t("div",M,[t("img",{src:Y.remainingBgImg,class:"remaining-bg",alt:"今日剩余"},null,8,k),t("span",R,"今日剩余:"+n(Y.remainingTimes)+"次",1)]),o(" 转动按钮 "),t("button",{class:"spin-btn",disabled:Y.isSpinning||Y.showPrizeModal||Y.showRuleModal||Y.isFirstVisit||0===Y.remainingTimes,onClick:s[1]||(s[1]=(...e)=>Z.handleSpin&&Z.handleSpin(...e))},[t("img",{src:Y.remainingTimes>0&&!Y.showPrizeModal&&!Y.showRuleModal&&!Y.isFirstVisit?Y.spinBtnImg:Y.disabledSpinBtnImg,alt:"转动金轮",class:"spin-btn-img"},null,8,y)],8,x),o(" 中奖弹窗 "),Y.showPrizeModal?(i(),l("div",C,[t("div",{class:"modal-overlay",onClick:s[2]||(s[2]=(...e)=>Z.closeModal&&Z.closeModal(...e))}),t("div",A,[t("img",{src:Y.modalBgImg,class:"modal-bg",alt:"弹窗背景"},null,8,B),o(" 右上角关闭按钮 "),t("button",{class:"close-modal",onClick:s[3]||(s[3]=(...e)=>Z.closeModal&&Z.closeModal(...e))},[t("img",{src:Y.closeBtnImg,alt:"关闭弹窗"},null,8,F)]),t("div",P,[t("div",S,n(Y.prizeMessage),1),t("div",V,[t("img",{src:Y.prizeAmountImg,class:"prize-amount-bg",alt:"奖品数量背景"},null,8,W),t("div",L,n(Y.prizeAmount),1)])])])])):o("v-if",!0),o(" 剩余次数为0时的提示弹窗 "),Y.showNoTimesModal?(i(),l("div",N,[t("div",{class:"modal-overlay",onClick:s[4]||(s[4]=(...e)=>Z.closeNoTimesModal&&Z.closeNoTimesModal(...e))}),t("div",U,[t("img",{src:Y.noTimesImg,class:"no-times-bg",alt:"今日次数已用完"},null,8,D)])])):o("v-if",!0),o(" 活动规则弹窗 "),Y.showRuleModal?(i(),l("div",_,[t("div",{class:"modal-overlay",onClick:s[5]||(s[5]=(...e)=>Z.closeRuleModal&&Z.closeRuleModal(...e))}),t("div",q,[t("img",{src:Y.ruleBgImg,class:"rule-bg",alt:"活动规则背景"},null,8,H),o(" 右上角关闭按钮 "),t("button",{class:"close-rule-btn",onClick:s[6]||(s[6]=(...e)=>Z.closeRuleModal&&Z.closeRuleModal(...e))},[t("img",{src:Y.closeRuleBtnImg,alt:"关闭活动规则"},null,8,Q)]),s[11]||(s[11]=r('