2 lines
5.0 KiB
JavaScript
2 lines
5.0 KiB
JavaScript
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 j,al as K,bb as C,bc as E,a$ as I,bd as $,bw as D,am as L,ap as N,P as R,bx as U,an as q,Q as A,b4 as B}from"./index.Cc2OLQyj.js";import{E as F}from"./el-card.CdUMUeuS.js";import{_ as G}from"./index.BAZQEME3.js";import{E as H,a as O,b as Q}from"./el-dropdown-item.tUmkud6J.js";import"./dropdown.BGD_BX04.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}),j(()=>u.path,e=>{e.startsWith("/login/")&&ue.value.active}),(e,a)=>{const l=$,s=W,u=G,g=L,f=D,_=N,h=U,b=q,w=y,x=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(s,{class:"ml-2 cursor-pointer"})]),m(ue).active?(d(),o(x,{key:0,class:"login-input-container !border-none !bg-transparent !rounded-[4%] w-100 <sm:w-85"},{default:n(()=>{var l;return[t("div",P,[t("h2",null,v(null==(l=m(ue).list.find(e=>e.identity===m(ue).active))?void 0:l.name),1)]),i(w,{ref_key:"loginFormRef",ref:O,model:m(le),rules:m(oe),class:"login-form"},{default:n(()=>[i(f,{prop:"user_name"},{default:n(()=>[t("div",Z,[i(u,{"icon-class":"user",class:"mx-2"}),i(g,{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(_,{visible:m(H),content:e.$t("login.capsLock"),placement:"right"},{default:n(()=>[i(f,{prop:"password"},{default:n(()=>[t("div",X,[i(u,{"icon-class":"lock",class:"mx-2"}),i(g,{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(f,{prop:"google_code"},{default:n(()=>[t("div",Y,[i(u,{"icon-class":"captcha",class:"mx-2"}),i(g,{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(h,{class:"google-code-image",src:m(se)},null,8,["src"])])):K("",!0),i(b,{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})):K("",!0)])}}}),[["__scopeId","data-v-1c2f3619"]]);export{ae as default};
|