import{h as M,y as S,r as C,p as m,l as y,q as t,N as n,k as e,a6 as w,o as r,V as i,M as z,W as _,a0 as G,t as u,a7 as B}from"./vue-a39e6937.js";import{F as $}from"./index-f0d8af94.js";import{b as f}from"./validate-4ecec794.js";import{f as K,g as U,_ as L}from"./index-ba596ae9.js";import{u as E,s as g,b as O,c as T}from"./store-5ff6cbac.js";import"./index-434d719f.js";import"./controllerUrls-941681c3.js";import"./index-7e56a0fa.js";const W={key:0,class:"userinfo"},j={class:"user-avatar-box"},H=["src"],J={class:"username"},Q={class:"user-integral"},X={class:"userinfo-buttons"},Y={key:1,class:"ba-login"},Z={class:"ba-title"},ee=["src"],oe={target:"_blank",class:"ba-account-register",href:"https://buildadmin.com/user/login?type=register"},ae=M({__name:"baAccount",setup(te){const{t:s}=K(),d=E(),b=S(),a=C({loading:!1,form:{tab:"login",username:"",password:"",captcha:"",captchaId:U(),keep:!1}}),F=C({username:[f({name:"required",title:s("module.User name")})],captcha:[f({name:"required",title:s("module.Verification Code")})],password:[f({name:"required",title:s("module.Password")}),f({name:"password"})]}),q=c=>{window.open(c)},V=(c=void 0)=>{c.validate(o=>{o?(a.loading=!0,T("post",a.form).then(v=>{g.dialog.baAccount=!1,a.loading=!1,d.dataFill(v.data.userInfo)}).catch(()=>{a.loading=!1,h()})):h()})},h=()=>{a.form.captcha="",a.form.captchaId=U()};return(c,o)=>{const v=u("Icon"),p=u("el-button"),x=u("el-input"),k=u("el-col"),D=u("el-row"),I=u("el-form-item"),N=u("el-form"),P=u("el-dialog"),A=B("blur"),R=B("loading");return m(),y("div",null,[t(P,{modelValue:e(g).dialog.baAccount,"onUpdate:modelValue":o[7]||(o[7]=l=>e(g).dialog.baAccount=l),class:"ba-account-dialog",width:"25%",title:e(s)("module.Member information")},{default:n(()=>[e(d).token?w((m(),y("div",W,[r("div",j,[r("img",{class:"user-avatar",src:e(d).avatar,alt:""},null,8,H),t(v,{class:"user-avatar-gender",name:e(d).getGenderIcon().name,size:"14",color:e(d).getGenderIcon().color},null,8,["name","color"])]),r("p",J,i(e(d).nickname),1),r("p",Q,[r("span",null,i(c.$t("module.Integral")+" "+e(d).score),1),r("span",null,i(c.$t("module.Balance")+" "+e(d).money),1)]),r("div",X,[w((m(),z(p,{onClick:o[0]||(o[0]=l=>q("https://buildadmin.com/user/account/moduleOrders")),size:"default",type:"primary"},{default:n(()=>[_(i(c.$t("module.My module")),1)]),_:1})),[[A]]),w((m(),z(p,{onClick:o[1]||(o[1]=l=>e(d).logout()),size:"default",type:"warning"},{default:n(()=>[_(i(c.$t("module.Logout login")),1)]),_:1})),[[A]])])])),[[R,e(g).loading.common]]):(m(),y("div",Y,[r("h3",Z,i(e(s)("module.Log in to the buildadmin module marketplace")),1),t(N,{onKeyup:o[6]||(o[6]=G(l=>V(b.value),["enter"])),ref_key:"baAccountFormRef",ref:b,rules:F,class:"ba-account-login-form",model:a.form},{default:n(()=>[t($,{modelValue:a.form.username,"onUpdate:modelValue":o[2]||(o[2]=l=>a.form.username=l),type:"string",prop:"username",placeholder:e(s)("module.Please enter buildadmin account name or email"),"input-attr":{size:"large"}},null,8,["modelValue","placeholder"]),t($,{modelValue:a.form.password,"onUpdate:modelValue":o[3]||(o[3]=l=>a.form.password=l),type:"password",prop:"password",placeholder:e(s)("module.Please enter the buildadmin account password"),"input-attr":{size:"large"}},null,8,["modelValue","placeholder"]),t(I,{prop:"captcha"},{default:n(()=>[t(D,{class:"w100"},{default:n(()=>[t(k,{span:16},{default:n(()=>[t(x,{modelValue:a.form.captcha,"onUpdate:modelValue":o[4]||(o[4]=l=>a.form.captcha=l),size:"large",clearable:"",autocomplete:"off",placeholder:e(s)("module.Please enter the login verification code")},null,8,["modelValue","placeholder"])]),_:1}),t(k,{class:"captcha-box",span:8},{default:n(()=>[r("img",{onClick:h,class:"captcha-img",src:e(O)()+"&id="+a.form.captchaId},null,8,ee)]),_:1})]),_:1})]),_:1}),t(I,{class:"form-buttons"},{default:n(()=>[t(p,{onClick:o[5]||(o[5]=l=>V(b.value)),loading:a.loading,round:"",type:"primary",size:"large"},{default:n(()=>[_(i(e(s)("module.Sign in")),1)]),_:1},8,["loading"]),r("a",oe,[t(p,{round:"",plain:"",type:"info",size:"large"},{default:n(()=>[_(i(e(s)("module.Register")),1)]),_:1})])]),_:1})]),_:1},8,["rules","model"])]))]),_:1},8,["modelValue","title"])])}}});const me=L(ae,[["__scopeId","data-v-3a2a3a6d"]]);export{me as default};