LoginForm-36a6ba52.js 6.2 KB

1
  1. import{d as X,r as d,u as A,$ as J,b as W,a as e,f as Y,aS as Z,B as ee,C as ae,a1 as te,o as E,l as L,w as n,i as a,a2 as le,Q as ne,j as R,t as S,n as oe,a3 as re,dk as se,af as z,a7 as ie,a8 as pe,a9 as de,aa as me,a5 as ue,H as ce,E as fe,U as ge,ab as _e,s as he,K as ye,ac as we,ad as xe,g as Fe,ae as be,_ as ve,__tla as Ve}from"./index-af173888.js";import{_ as ke,__tla as Ne}from"./Verify-1cc96873.js";import{_ as Ee,__tla as Le}from"./XButton-9933c2d2.js";import{E as Re,__tla as Se}from"./el-link-3e92dcd8.js";import{u as h,__tla as ze}from"./useIcon-12c7c71a.js";import{u as Ce,L as y,a as Pe,__tla as Ue}from"./useLogin-60285336.js";import{u as Me,__tla as je}from"./useMessage-170c1b43.js";import{r as w,__tla as Oe}from"./formRules-515a78c5.js";let C,Ie=Promise.all([(()=>{try{return Ve}catch{}})(),(()=>{try{return Ne}catch{}})(),(()=>{try{return Le}catch{}})(),(()=>{try{return Se}catch{}})(),(()=>{try{return ze}catch{}})(),(()=>{try{return Ue}catch{}})(),(()=>{try{return je}catch{}})(),(()=>{try{return Oe}catch{}})()]).then(async()=>{let x;x=(u=>(we("data-v-1de2631f"),u=u(),xe(),u))(()=>Fe("img",{alt:"",class:"h-59px w-143px",style:{margin:"0 auto"},src:"/assets/zxlogo-8cee8fbf.png"},null,-1)),C=ve(X({name:"LoginForm",__name:"LoginForm",setup(u){const{t:p}=oe();Me();const P=h({icon:"ep:house"}),U=h({icon:"ep:avatar"}),M=h({icon:"ep:lock"}),F=d(),{validForm:j}=Pe(F),{setLoginState:b,getLoginState:O}=Ce(),{currentRoute:I,push:Q}=A(),T=J(),m=d(""),c=d(!1),v=d(),D=d("blockPuzzle"),G=W(()=>e(O)===y.LOGIN),H={tenantName:[w],username:[w],password:[w]},l=Y({isShowPassword:!1,captchaEnable:"false",tenantEnable:"false",loginForm:{tenantName:"\u975E\u7E41\u79D1\u6280",username:"admin",password:"zx123",captchaVerification:"",rememberMe:!1}}),V=async()=>{l.captchaEnable==="false"?await N({}):v.value.show()},k=d(),N=async o=>{c.value=!0;try{if(await(async()=>{if(l.tenantEnable==="true"){const i=await be(l.loginForm.tenantName);z(i)}})(),!await j())return;l.loginForm.captchaVerification=o.captchaVerification,console.log(l.loginForm);const t=await ie(l.loginForm);if(!t)return;k.value=pe.service({lock:!0,text:"\u6B63\u5728\u52A0\u8F7D\u7CFB\u7EDF\u4E2D...",background:"rgba(0, 0, 0, 0.7)"}),l.loginForm.rememberMe?de(l.loginForm):me(),ue(t),m.value||(m.value="/"),m.value.indexOf("sso")!==-1?window.location.href=window.location.href.replace("/login?redirect=",""):Q({path:m.value||T.addRouters[0].path})}finally{c.value=!1,k.value.close()}};return Z(()=>I.value,o=>{var t;m.value=(t=o==null?void 0:o.query)==null?void 0:t.redirect},{immediate:!0}),ee(()=>{(()=>{const o=re();o&&(l.loginForm={...l.loginForm,username:o.username?o.username:l.loginForm.username,password:o.password?o.password:l.loginForm.password,rememberMe:!!o.rememberMe,tenantName:o.tenantName?o.tenantName:l.loginForm.tenantName})})(),(async()=>{const o=location.host,t=await se(o);t&&(l.loginForm.tenantName=t.name,z(t.id))})()}),(o,t)=>{const i=ce,r=fe,f=ge,K=_e,$=Re,g=he,_=Ee,q=ke,B=ye;return ae((E(),L(B,{ref_key:"formLogin",ref:F,model:e(l).loginForm,rules:H,class:"login-form","label-position":"top","label-width":"120px",size:"large"},{default:n(()=>[a(g,{style:{"margin-right":"-10px","margin-left":"-10px"}},{default:n(()=>[a(r,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:n(()=>[a(i,{class:"justify-center flex"},{default:n(()=>[x]),_:1})]),_:1}),a(r,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:n(()=>[e(l).tenantEnable==="true"?(E(),L(i,{key:0,prop:"tenantName"},{default:n(()=>[a(f,{modelValue:e(l).loginForm.tenantName,"onUpdate:modelValue":t[0]||(t[0]=s=>e(l).loginForm.tenantName=s),placeholder:e(p)("login.tenantNamePlaceholder"),"prefix-icon":e(P),link:"",type:"primary"},null,8,["modelValue","placeholder","prefix-icon"])]),_:1})):le("",!0)]),_:1}),a(r,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:n(()=>[a(i,{prop:"username"},{default:n(()=>[a(f,{modelValue:e(l).loginForm.username,"onUpdate:modelValue":t[1]||(t[1]=s=>e(l).loginForm.username=s),placeholder:e(p)("login.usernamePlaceholder"),"prefix-icon":e(U)},null,8,["modelValue","placeholder","prefix-icon"])]),_:1})]),_:1}),a(r,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:n(()=>[a(i,{prop:"password"},{default:n(()=>[a(f,{modelValue:e(l).loginForm.password,"onUpdate:modelValue":t[2]||(t[2]=s=>e(l).loginForm.password=s),placeholder:e(p)("login.passwordPlaceholder"),"prefix-icon":e(M),"show-password":"",type:"password",onKeyup:t[3]||(t[3]=ne(s=>V(),["enter"]))},null,8,["modelValue","placeholder","prefix-icon"])]),_:1})]),_:1}),a(r,{span:24,style:{"padding-right":"10px","padding-left":"10px","margin-top":"-20px","margin-bottom":"-20px"}},{default:n(()=>[a(i,null,{default:n(()=>[a(g,{justify:"space-between",style:{width:"100%"}},{default:n(()=>[a(r,{span:6},{default:n(()=>[a(K,{modelValue:e(l).loginForm.rememberMe,"onUpdate:modelValue":t[4]||(t[4]=s=>e(l).loginForm.rememberMe=s)},{default:n(()=>[R(S(e(p)("login.remember")),1)]),_:1},8,["modelValue"])]),_:1}),a(r,{offset:6,span:12},{default:n(()=>[a($,{style:{float:"right"},type:"primary"},{default:n(()=>[R(S(e(p)("login.forgetPassword")),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),a(r,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:n(()=>[a(i,null,{default:n(()=>[a(_,{loading:e(c),title:e(p)("login.login"),class:"w-[100%]",type:"primary",onClick:t[5]||(t[5]=s=>V())},null,8,["loading","title"])]),_:1})]),_:1}),a(q,{ref_key:"verify",ref:v,captchaType:e(D),imgSize:{width:"400px",height:"200px"},mode:"pop",onSuccess:N},null,8,["captchaType"]),a(r,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:n(()=>[a(i,null,{default:n(()=>[a(g,{gutter:5,justify:"space-between",style:{width:"100%"}},{default:n(()=>[a(r,{span:8},{default:n(()=>[a(_,{title:e(p)("login.btnQRCode"),class:"w-[100%]",onClick:t[6]||(t[6]=s=>e(b)(e(y).QR_CODE))},null,8,["title"])]),_:1}),a(r,{span:8},{default:n(()=>[a(_,{title:e(p)("login.btnRegister"),class:"w-[100%]",onClick:t[7]||(t[7]=s=>e(b)(e(y).REGISTER))},null,8,["title"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])),[[te,e(G)]])}}}),[["__scopeId","data-v-1de2631f"],["__file","/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-admin/src/views/Login/components/LoginForm.vue"]])});export{Ie as __tla,C as default};