import{d as e,bs as a,aV as l,bt as s,m as o,w as n,l as t,N as i,c,a8 as u,a7 as r,e as d,g as m,O as p,t as v,bu as g,aQ as f,aW as _,r as h,b9 as b,bv as y,bm as w,F as x,a9 as V,ag as k,aT as z,o as S,b2 as T,D as K,al as j,bb as C,bc as E,a$ as I,bd as N,bw as $,am as D,ap as L,P as R,bx as U,an as q,Q as A,b4 as B}from"./index.B15cfAC-.js";import{E as F}from"./el-card.BP-nyCiW.js";import{_ as G}from"./index.B5f8yh3q.js";import{E as H,a as O,b as Q}from"./el-dropdown-item.kN0B5-Xn.js";import"./dropdown.C3slpOpD.js";const W=e({__name:"index",props:{size:{type:String,required:!1}},setup(e){const f=[{label:"中文",value:a.ZH_CN},{label:"English",value:a.EN}],_=l(),{locale:h,t:b}=s();function y(e){h.value=e,_.changeLanguage(e),g.success(b("langSelect.message.success"))}return(a,l)=>{const s=G,g=Q,h=O,b=H;return d(),o(b,{trigger:"click",onCommand:y},{dropdown:n(()=>[i(h,null,{default:n(()=>[(d(),c(r,null,u(f,e=>i(g,{key:e.value,disabled:m(_).language===e.value,command:e.value},{default:n(()=>[p(v(e.label),1)]),_:2},1032,["disabled","command"])),64))]),_:1})]),default:n(()=>[t("div",null,[i(s,{"icon-class":"language",size:e.size},null,8,["size"])])]),_:1})}}}),J={class:"login-container"},M={class:"absolute-lt flex-x-end p-3 w-full"},P={class:"text-center relative"},Z={class:"flex-y-center w-full"},X={class:"flex-y-center w-full"},Y={class:"flex-y-center w-full"},ee={key:0,class:"google-code-image-box"},ae=B(e({__name:"index",setup(e){l();const a=f(),s=_(),u=T(),r=h(s.theme===b.DARK),g=h(!0),B=h(!1),H=h(!1),O=h(y),{height:Q}=w(),ae=h(""),le=h({user_name:"",password:"",google_code:""}),se=h("");const oe=x(()=>({}));function ne(){const e="/"+ue.value.active;z.push({path:e})}function te(){O.value.validate(e=>{if(e){B.value=!0;const e=function(){let e=le.value;const a=ue.value.active;return"payer"===a?e={...le.value,mer_name:le.value.user_name}:"payee"===a&&(e={...le.value,ms_name:le.value.user_name}),e}();a.login(e).then(e=>{(null==e?void 0:e.qr_code_url)?se.value=null==e?void 0:e.qr_code_url:(se.value="",ne())}).catch(()=>{}).finally(()=>{B.value=!1})}})}h("");const ie=()=>{const e=s.theme===b.DARK?b.LIGHT:b.DARK;s.changeTheme(e)};function ce(e){e instanceof KeyboardEvent&&(H.value=e.getModifierState("CapsLock"))}V(()=>{Q.value<600?g.value=!1:g.value=!0});const ue=h({active:"",list:[{identity:"other",name:"管理员后台"},{identity:"payer",name:"商户后台"},{identity:"payee",name:"店铺后台"}]});k({visible:!1,type:"user-form",width:400,title:"",leftBtnText:"确 定",rightBtnText:""});let re=JSON.parse(sessionStorage.getItem("loginInfo")||"{}");ue.value.active=re.loginType,ae.value&&ae.value!==ue.value.active&&!["other","payee","payer"].includes(ue.value.active)&&(localStorage.clear(),z.push({path:"/login",replace:!0})),ae.value=ue.value.active;return localStorage.getItem(ae.value+"accessToken")&&ne(),S(()=>{ue.value.active}),K(()=>u.path,e=>{e.startsWith("/login/")&&ue.value.active}),(e,a)=>{const l=N,u=W,g=G,f=D,_=$,h=L,b=U,w=q,x=y,V=F;return d(),c("div",J,[t("div",M,[i(l,{modelValue:m(r),"onUpdate:modelValue":a[0]||(a[0]=e=>I(r)?r.value=e:null),"inline-prompt":"","active-icon":m(E),"inactive-icon":m(C),onChange:ie},null,8,["modelValue","active-icon","inactive-icon"]),i(u,{class:"ml-2 cursor-pointer"})]),m(ue).active?(d(),o(V,{key:0,class:"login-input-container !border-none !bg-transparent !rounded-[4%] w-100 {var l;return[t("div",P,[t("h2",null,v(m(s).getSystemName)+" - "+v(null==(l=m(ue).list.find(e=>e.identity===m(ue).active))?void 0:l.name),1)]),i(x,{ref_key:"loginFormRef",ref:O,model:m(le),rules:m(oe),class:"login-form"},{default:n(()=>[i(_,{prop:"user_name"},{default:n(()=>[t("div",Z,[i(g,{"icon-class":"user",class:"mx-2"}),i(f,{ref:"user_name",modelValue:m(le).user_name,"onUpdate:modelValue":a[1]||(a[1]=e=>m(le).user_name=e),placeholder:e.$t("login.username"),name:"user_name",size:"large",class:"h-[48px]"},null,8,["modelValue","placeholder"])])]),_:1}),i(h,{visible:m(H),content:e.$t("login.capsLock"),placement:"right"},{default:n(()=>[i(_,{prop:"password"},{default:n(()=>[t("div",X,[i(g,{"icon-class":"lock",class:"mx-2"}),i(f,{modelValue:m(le).password,"onUpdate:modelValue":a[2]||(a[2]=e=>m(le).password=e),placeholder:e.$t("login.password"),type:"password",name:"password",onKeyup:[ce,R(te,["enter"])],size:"large",class:"h-[48px] pr-2","show-password":""},null,8,["modelValue","placeholder"])])]),_:1})]),_:1},8,["visible","content"]),i(_,{prop:"google_code"},{default:n(()=>[t("div",Y,[i(g,{"icon-class":"captcha",class:"mx-2"}),i(f,{modelValue:m(le).google_code,"onUpdate:modelValue":a[3]||(a[3]=e=>m(le).google_code=e),"auto-complete":"off",size:"large",class:"flex-1",placeholder:"Google验证码,登录和重置密码首次请勿填写",onKeyup:R(te,["enter"])},null,8,["modelValue"])])]),_:1}),m(se)?(d(),c("div",ee,[i(b,{class:"google-code-image",src:m(se)},null,8,["src"])])):j("",!0),i(w,{loading:m(B),type:"primary",size:"large",class:"w-full",onClick:A(te,["prevent"])},{default:n(()=>[p(v(e.$t("login.login")),1)]),_:1},8,["loading"])]),_:1},8,["model","rules"])]}),_:1})):j("",!0)])}}}),[["__scopeId","data-v-43551b51"]]);export{ae as default};