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

1 lines
4.2 KiB

var t=Object.defineProperty,o=Object.prototype.hasOwnProperty,n=Object.getOwnPropertySymbols,e=Object.prototype.propertyIsEnumerable,i=(o,n,e)=>n in o?t(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e,s=(t,s)=>{for(var a in s||(s={}))o.call(s,a)&&i(t,a,s[a]);if(n)for(var a of n(s))e.call(s,a)&&i(t,a,s[a]);return t};import{p as a,m as r,x as c,n as l,K as u,v as d,T as f,G as w,c as p,u as g,s as T,y as m,z as y,t as h,B as k,w as x,o as C}from"./vendor.269b2875.js";const v={name:"taskCountDown",props:{configTaskStyle:{type:Object,default:{}},configTaskTime:{type:Number,default:300},configTaskStatus:{type:Boolean,default:!0},configTaskType:{type:String,default:""}},setup(t){const{proxy:o}=k(),n=c({showCountdown:!1,endCircum:0,originCountDown:t.configTaskTime,countDown:t.configTaskTime,countDownText:"00:00",fontSize:26,size:70,width:5,backgroundColor:"#fff",color:"#3796ff",fontColor:"#333",configTaskCssBottom:"1rem",countdownFinish:!1,cx:l((function(){return n.size/2})),r:l((function(){return n.size/2-n.width})),circum:l((function(){return parseInt(n.r*Math.PI*2)})),pointsTitle:"",pointsScore:"",pointsType:""});u((()=>t.configTaskStatus),((t,e)=>{let i=document.getElementsByTagName("svg")[0];t?(n.showCountdown=!0,o.timeConvert(),o.taskCountDown(),i&&i.unpauseAnimations()):(clearInterval(n.interval),i&&i.pauseAnimations())})),d((()=>{clearInterval(n.interval),o.$http.get(o.$API.GETPOINTSBYCODEANDCHECKISOVER,{params:{PointsCode:t.configTaskType||""}}).then((e=>{if(200==e.type){let i=e.data;i&&(n.pointsScore=i.pointsScore||"",n.pointsTitle=i.pointsTitle||"",o.originCountDown=i.pointsRuleDuration||t.configTaskTime,o.countDown=i.pointsRuleDuration||t.configTaskTime,!i.isOver&&t.configTaskStatus?(n.showCountdown=!0,o.timeConvert(),o.taskCountDown(),t.configTaskStyle.bottom):n.showCountdown=!1)}else f(e.content)})).catch((t=>{}))}));return s(s({},w(n)),{data:n,goPage:()=>{o.$router.push("/MineSignIn")},timeConvert:()=>{let t,o=0;n.countDown>=60?(o=Math.floor(n.countDown/60),t=Math.floor(n.countDown%60),n.countDownText=o<10?t<10?"0"+o+":0"+t:"0"+o+":"+t:t<10?o+":0"+t:o+":"+t):n.countDown<10?n.countDownText="00:0"+n.countDown:n.countDownText="00:"+n.countDown},taskCountDown:()=>{clearInterval(n.interval),n.interval=setInterval((()=>{n.countDown-="1",o.timeConvert(),n.countDown<=0&&(o.$nextTick((()=>{document.querySelector(".countdown").style.zIndex=101})),n.countdownFinish=!0,clearInterval(n.interval),o.addPointLog())}),1e3)},addPointLog:()=>{let e={PointsTitle:n.pointsTitle,PointsCode:t.configTaskType,PointsScore:n.pointsScore,PointsType:1};o.$http.post(o.$API.ADDPOINTLOG,e,{headers:{"Content-Type":"application/x-www-form-urlencoded"}}).then((t=>{200==t.type||f(t.content)})).catch((t=>{}))}})}},D=x("data-v-ba790a9e");a("data-v-ba790a9e");const b={key:0,class:"text"},P={src:"/assets/isCountdown-icon.0a8dca1a.png"};r();const S=D(((t,o,n,e,i,s)=>t.showCountdown?(C(),p("div",{key:0,class:"countdown",style:{bottom:t.configTaskCssBottom}},[t.countdownFinish?T("",!0):(C(),p("div",b,g(t.countDownText),1)),m(h("img",P,null,512),[[y,!t.countdownFinish]]),m(h("img",{src:"/assets/countdowned-icon.e0893dc6.png",onClick:o[1]||(o[1]=(...t)=>e.goPage&&e.goPage(...t))},null,512),[[y,t.countdownFinish]]),t.countdownFinish?(C(),p("div",{key:1,class:"finishText",onClick:o[2]||(o[2]=(...t)=>e.goPage&&e.goPage(...t))},"已完成")):T("",!0),(C(),p("svg",{class:"ring-container",style:`width: ${t.size}; height: ${t.size}`},[h("circle",{cx:t.cx,cy:t.cx,r:t.r,stroke:t.backgroundColor,"stroke-width":t.width,"stroke-linecap":"round",fill:"none"},null,8,["cx","cy","r","stroke","stroke-width"]),h("circle",{cx:t.cx,cy:t.cx,r:t.r,class:"ring","stroke-width":t.width,stroke:t.color,"stroke-dasharray":`${t.circum}`,"stroke-linecap":"round",fill:"none"},[h("animate",{attributeName:"stroke-dashoffset",from:t.circum,to:t.endCircum,dur:t.originCountDown},null,8,["from","to","dur"])],8,["cx","cy","r","stroke-width","stroke","stroke-dasharray"]),h("text",{x:t.cx+5,y:t.cx+10,"text-anchor":"end","font-size":t.fontSize+5,fill:t.fontColor},null,8,["x","y","font-size","fill"]),h("text",{x:t.cx+5,y:t.cx+10,"text-anchor":"start","font-size":t.fontSize-5,fill:t.fontColor},null,8,["x","y","font-size","fill"])],4))],4)):T("",!0)));v.render=S,v.__scopeId="data-v-ba790a9e";export{v as _};