import{aM as a,a7 as s,T as e,a6 as l,a as t,v as n,o as c,e as i,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 x,A as y,j as v,p as b}from"./index-90c12cc1.js";import{H as I}from"./index.0e2fd26a.js";import{u as j}from"./useScroll.50272fa4.js";import{al as w,am as k,an as h,ao as S}from"./images.cf3befb9.js";import{u as D}from"./useInterface.bd4f041a.js";import{P as R}from"./Popup.4e72ea57.js";import{h as M}from"./moment.6466d922.js";import{_ as P}from"./_plugin-vue_export-helper.1b428a4d.js";import"./uv-icon.c815b875.js";import"./uv-icon.vue_vue_type_style_index_0_scoped_23936b10_lang.7145f5b2.js";import"./utils.80a0ac72.js";import"./u-icon.ec8b667f.js";const T=P({__name:"index",setup(P){const{scrollTop:T}=j();s((()=>{}));const $=e(),{user:C}=l($),{toast:L}=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 N(){if(!A.value){if(U.value.todaySignIn)return L({title:"今日已签到"});try{A.value=!0,F.value=await a.get("/member/sign-in-record/signIn"),await $.getUserInfo(),H.value.show()}finally{A.value=!1}}}const W=t([]);return n((()=>{B()})),(a,s)=>{const e=_,l=y,t=b;return c(),i(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(e,{class:"sign-in"},{default:u((()=>[r(e,{class:"bg",style:m({backgroundImage:`url(${o(w)})`})},null,8,["style"]),r(e,{class:"sign-in__inner"},{default:u((()=>[r(e,{class:"bg-mask"},{default:u((()=>[r(e,{class:"header-row flex flex-ai__end"},{default:u((()=>[d(g(o(C).integral||"0.00")+" ",1),r(l,{class:"sub"},{default:u((()=>[d("积分")])),_:1})])),_:1}),r(e,{class:"sign-btn-row"},{default:u((()=>[r(e,{class:"title"},{default:u((()=>[d(" 您已经连续签到 "),r(l,{class:"primary-color"},{default:u((()=>[d(g(U.value.signInDays),1)])),_:1}),d(" 天 ")])),_:1}),r(e,{onClick:N,class:p([{disable:U.value.todaySignIn},"btn"])},{default:u((()=>[d(g(U.value.todaySignIn?"已签到":"立即签到"),1)])),_:1},8,["class"])])),_:1}),r(e,{class:"sign-calendar"},{default:u((()=>[r(e,{class:"sign-calendar__inner"},{default:u((()=>[(c(!0),i(f,null,x(U.value.signInRecordList,(a=>(c(),v(e,{key:a.timestamp,class:p(["item flex flex-column flex-ai__center flex-jc__center",{none:!a.isSign}])},{default:u((()=>[r(e,{class:"item-box flex flex-column flex-ai__center flex-jc__center"},{default:u((()=>[r(l,null,{default:u((()=>[d("+"+g(a.integral),1)])),_:2},1024),r(t,{src:a.isSign?o(h):o(S)},null,8,["src"])])),_:2},1024),d(" "+g(o(M)(a.createTime).format("MM-DD")),1)])),_:2},1032,["class"])))),128))])),_:1})])),_:1})])),_:1}),r(e,{class:"sign-card"},{default:u((()=>[r(e,{class:"title"},{default:u((()=>[d(" 每日任务")])),_:1}),r(e,{class:"sign-list"},{default:u((()=>[(c(!0),i(f,null,x(W.value,(a=>(c(),v(e,{key:a.id,class:"row flex flex-ai__center"},{default:u((()=>[r(t,{class:"row-icon",src:a.iconUrl},null,8,["src"]),r(e,{class:"row-info flex flex-ai__center flex-jc__sb"},{default:u((()=>[r(e,{class:"left"},{default:u((()=>[r(e,{class:"name"},{default:u((()=>[d(g(a.typeName),1)])),_:2},1024),r(e,{class:"sub flex flex-ai__center"})])),_:2},1024),r(e,{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(e,{class:"success-card",style:m({backgroundImage:`url(${o(k)})`})},{default:u((()=>[r(e,{class:"inner"},{default:u((()=>[r(e,{class:"count-row flex"},{default:u((()=>[r(e,{class:"count"},{default:u((()=>[d(g(F.value),1)])),_:1}),d(" 积分 ")])),_:1}),r(e,{class:"info"},{default:u((()=>[d(" 签到成功，恭喜您获得 ")])),_:1}),r(e,{class:"button animation-button",onClick:J},{default:u((()=>[d(" 我知道了 ")])),_:1}),r(e,{class:"tips"},{default:u((()=>[d(" 连续签到奖励更丰富 ")])),_:1})])),_:1})])),_:1},8,["style"])])),_:1},512)],64)}}},[["__scopeId","data-v-2ed1426e"]]);export{T as default};
