import{aK as a,a8 as e,T as s,a6 as l,a as t,v as n,o as i,e as c,h as r,w as u,i as o,F as f,B as _,I as d,y as m,l as g,m as p,k as y,A as x,j as b,p as v}from"./index-d4baa715.js";import{H as I}from"./index.704ebef3.js";import{u as j}from"./useScroll.dcb46f58.js";import{al as w,am as k,an as h,ao as S}from"./images.f0a6f614.js";import{u as D}from"./useInterface.2c7749ae.js";import{P as R}from"./Popup.965f3d92.js";import{h as $}from"./moment.dc0d6ca6.js";import{_ as P}from"./_plugin-vue_export-helper.1b428a4d.js";import"./uv-icon.b5ddbe11.js";import"./uv-icon.vue_vue_type_style_index_0_scoped_23936b10_lang.7145f5b2.js";import"./utils.052a93d2.js";const T=P({__name:"index",setup(P){const{scrollTop:T}=j();e((()=>{}));const C=s(),{user:L,integralName:M}=l(C),{toast:N}=D(),U=t({signInDays:0,todaySignIn:!1,signInRecordList:[]}),A=t(!1);async function B(){try{A.value=!0,U.value=await a.get("/member/sign-in-record/signInInfo"),await async function(){W.value=await a.get("/member/sign-in-record/integralRule")}()}finally{A.value=!1}}const F=t(0),H=t();async function J(){await B(),F.value=0,H.value.close()}async function K(){if(!A.value){if(U.value.todaySignIn)return N({title:"今日已签到"});try{A.value=!0,F.value=await a.get("/member/sign-in-record/signIn"),await C.getUserInfo(),H.value.show()}finally{A.value=!1}}}const W=t([]);return n((()=>{B()})),(a,e)=>{const s=_,l=x,t=v;return i(),c(f,null,[r(I,{"scroll-top":o(T),"system-bar-area-bg":"#fff","header-area-bg":"#fff"},{default:u((()=>[d(" 签到 ")])),_:1},8,["scroll-top"]),r(s,{class:"sign-in"},{default:u((()=>[r(s,{class:"bg",style:m({backgroundImage:`url(${o(w)})`})},null,8,["style"]),r(s,{class:"sign-in__inner"},{default:u((()=>[r(s,{class:"bg-mask"},{default:u((()=>[r(s,{class:"header-row flex flex-ai__end"},{default:u((()=>[d(g(o(L).integral||"0.00")+" ",1),r(l,{class:"sub"},{default:u((()=>[d(g(o(M)),1)])),_:1})])),_:1}),r(s,{class:"sign-btn-row"},{default:u((()=>[r(s,{class:"title"},{default:u((()=>[d(" 您已经连续签到 "),r(l,{class:"primary-color"},{default:u((()=>[d(g(U.value.signInDays),1)])),_:1}),d(" 天 ")])),_:1}),r(s,{onClick:K,class:p([{disable:U.value.todaySignIn},"btn"])},{default:u((()=>[d(g(U.value.todaySignIn?"已签到":"立即签到"),1)])),_:1},8,["class"])])),_:1}),r(s,{class:"sign-calendar"},{default:u((()=>[r(s,{class:"sign-calendar__inner"},{default:u((()=>[(i(!0),c(f,null,y(U.value.signInRecordList,(a=>(i(),b(s,{key:a.timestamp,class:p(["item flex flex-column flex-ai__center flex-jc__center",{none:!a.isSign}])},{default:u((()=>[r(s,{class:"item-box flex flex-column flex-ai__center flex-jc__center"},{default:u((()=>[null!==a.integral?(i(),b(l,{key:0},{default:u((()=>[d("+"+g(a.integral),1)])),_:2},1024)):(i(),b(l,{key:1},{default:u((()=>[d(" ")])),_:1})),r(t,{src:a.isSign?o(h):o(S)},null,8,["src"])])),_:2},1024),d(" "+g(o($)(a.createTime).format("MM-DD")),1)])),_:2},1032,["class"])))),128))])),_:1})])),_:1})])),_:1}),r(s,{class:"sign-card"},{default:u((()=>[r(s,{class:"title"},{default:u((()=>[d(" 每日任务")])),_:1}),r(s,{class:"sign-list"},{default:u((()=>[(i(!0),c(f,null,y(W.value,(a=>(i(),b(s,{key:a.id,class:"row flex flex-ai__center"},{default:u((()=>[r(t,{class:"row-icon",src:a.iconUrl},null,8,["src"]),r(s,{class:"row-info flex flex-ai__center flex-jc__sb"},{default:u((()=>[r(s,{class:"left"},{default:u((()=>[r(s,{class:"name"},{default:u((()=>[d(g(a.typeName)+g(a.attribute1?`${a.attribute1}天`:""),1)])),_:2},1024),r(s,{class:"sub flex flex-ai__center"})])),_:2},1024),r(s,{class:"btn flex flex-ai__center"},{default:u((()=>[r(t,{src:o(S)},null,8,["src"]),d(" +"+g(a.integral),1)])),_:2},1024)])),_:2},1024)])),_:2},1024)))),128))])),_:1})])),_:1})])),_:1})])),_:1}),r(R,{ref_key:"successPopupRef",ref:H,mode:"center","show-closeable":!1},{default:u((()=>[r(s,{class:"success-card",style:m({backgroundImage:`url(${o(k)})`})},{default:u((()=>[r(s,{class:"inner"},{default:u((()=>[r(s,{class:"count-row flex"},{default:u((()=>[r(s,{class:"count"},{default:u((()=>[d(g(F.value),1)])),_:1}),d(" "+g(o(M)),1)])),_:1}),r(s,{class:"info"},{default:u((()=>[d(" 签到成功，恭喜您获得 ")])),_:1}),r(s,{class:"button animation-button",onClick:J},{default:u((()=>[d(" 我知道了 ")])),_:1}),r(s,{class:"tips"},{default:u((()=>[d(" 连续签到奖励更丰富 ")])),_:1})])),_:1})])),_:1},8,["style"])])),_:1},512)],64)}}},[["__scopeId","data-v-b79d20de"]]);export{T as default};
