| 1 |
- import{d as A,r as m,u as B,a2 as C,e as Y,a as o,f as D,M as J,x as Q,B as W,a4 as X,o as b,j as v,w as t,i as l,k as Z,l as $,R as ee,m as V,t as N,z as ae,a5 as oe,cA as le,ae as k,a8 as te,a9 as ne,aa as re,ab as se,Y as ie,G as pe,E as me,V as de,ac as ue,s as ce,H as ge,ad as fe}from"./index-a9400b59.js";import{_ as he}from"./Verify-c82534ad.js";import{_ as we}from"./XButton-fd461f49.js";import{E as ye}from"./el-link-0250aa20.js";import{u as g}from"./useIcon-318bcdcf.js";import{u as xe,L as _e,a as Fe}from"./useLogin-184e72e3.js";import{u as be}from"./useMessage-4f48661e.js";import{r as f}from"./formRules-3ba7efef.js";import{_ as ve}from"./_plugin-vue_export-helper-1b428a4d.js";const Ve=ve(A({name:"LoginForm",__name:"LoginForm",setup(Ne){const{t:p}=ae();be();const E=g({icon:"ep:house"}),L=g({icon:"ep:avatar"}),M=g({icon:"ep:lock"}),h=m(),{validForm:z}=Fe(h),{setLoginState:ke,getLoginState:P}=xe(),{currentRoute:S,push:U}=B(),j=C(),d=m(""),u=m(!1),w=m(),R=m("blockPuzzle"),G=Y(()=>o(P)===_e.LOGIN),H={tenantName:[f],username:[f],password:[f]},a=D({isShowPassword:!1,captchaEnable:"false",tenantEnable:"false",loginForm:{tenantName:"\u975E\u7E41\u79D1\u6280",username:"",password:"",captchaVerification:"",rememberMe:!1}}),y=async()=>{a.captchaEnable==="false"?await _({}):w.value.show()},x=m(),_=async n=>{u.value=!0;try{if(await(async()=>{if(a.tenantEnable==="true"){const s=await fe(a.loginForm.tenantName);k(s)}})(),!await z())return;a.loginForm.captchaVerification=n.captchaVerification;const e=await te(a.loginForm);if(!e)return;x.value=ne.service({lock:!0,text:"\u6B63\u5728\u52A0\u8F7D\u7CFB\u7EDF\u4E2D...",background:"rgba(0, 0, 0, 0.7)"}),a.loginForm.rememberMe?re(a.loginForm):se(),ie(e),d.value||(d.value="/"),d.value.indexOf("sso")!==-1?window.location.href=window.location.href.replace("/login?redirect=",""):U({path:d.value||j.addRouters[0].path})}finally{u.value=!1,x.value.close()}};return J(()=>S.value,n=>{var e;d.value=(e=n==null?void 0:n.query)==null?void 0:e.redirect},{immediate:!0}),Q(()=>{(()=>{const n=oe();n&&(a.loginForm={...a.loginForm,username:n.username?n.username:a.loginForm.username,password:n.password?n.password:a.loginForm.password,rememberMe:!!n.rememberMe,tenantName:n.tenantName?n.tenantName:a.loginForm.tenantName})})(),(async()=>{const n=location.host,e=await le(n);e&&(a.loginForm.tenantName=e.name,k(e.id))})()}),(n,e)=>{const s=pe,i=me,c=de,I=ue,K=ye,F=ce,O=we,T=he,q=ge;return W((b(),v(q,{ref_key:"formLogin",ref:h,model:o(a).loginForm,rules:H,class:"login-form","label-position":"top","label-width":"120px",size:"large"},{default:t(()=>[l(F,{style:{"margin-right":"-10px","margin-left":"-10px"}},{default:t(()=>[l(i,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:t(()=>[l(s,{class:"justify-center flex"},{default:t(()=>e[6]||(e[6]=[Z("img",{alt:"",class:"w-100px",style:{margin:"0 auto"},src:"/assets/zxlogo-ba620d76.png"},null,-1)])),_:1})]),_:1}),l(i,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:t(()=>[o(a).tenantEnable==="true"?(b(),v(s,{key:0,prop:"tenantName"},{default:t(()=>[l(c,{modelValue:o(a).loginForm.tenantName,"onUpdate:modelValue":e[0]||(e[0]=r=>o(a).loginForm.tenantName=r),placeholder:o(p)("login.tenantNamePlaceholder"),"prefix-icon":o(E),link:"",type:"primary"},null,8,["modelValue","placeholder","prefix-icon"])]),_:1})):$("",!0)]),_:1}),l(i,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:t(()=>[l(s,{prop:"username"},{default:t(()=>[l(c,{modelValue:o(a).loginForm.username,"onUpdate:modelValue":e[1]||(e[1]=r=>o(a).loginForm.username=r),placeholder:o(p)("login.usernamePlaceholder"),"prefix-icon":o(L)},null,8,["modelValue","placeholder","prefix-icon"])]),_:1})]),_:1}),l(i,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:t(()=>[l(s,{prop:"password"},{default:t(()=>[l(c,{modelValue:o(a).loginForm.password,"onUpdate:modelValue":e[2]||(e[2]=r=>o(a).loginForm.password=r),placeholder:o(p)("login.passwordPlaceholder"),"prefix-icon":o(M),"show-password":"",type:"password",onKeyup:e[3]||(e[3]=ee(r=>y(),["enter"]))},null,8,["modelValue","placeholder","prefix-icon"])]),_:1})]),_:1}),l(i,{span:24,style:{"padding-right":"10px","padding-left":"10px","margin-top":"-20px","margin-bottom":"-20px"}},{default:t(()=>[l(s,null,{default:t(()=>[l(F,{justify:"space-between",style:{width:"100%"}},{default:t(()=>[l(i,{span:6},{default:t(()=>[l(I,{modelValue:o(a).loginForm.rememberMe,"onUpdate:modelValue":e[4]||(e[4]=r=>o(a).loginForm.rememberMe=r)},{default:t(()=>[V(N(o(p)("login.remember")),1)]),_:1},8,["modelValue"])]),_:1}),l(i,{offset:6,span:12},{default:t(()=>[l(K,{style:{float:"right"},type:"primary"},{default:t(()=>[V(N(o(p)("login.forgetPassword")),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),l(i,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:t(()=>[l(s,null,{default:t(()=>[l(O,{loading:o(u),title:o(p)("login.login"),class:"w-[100%]",type:"primary",onClick:e[5]||(e[5]=r=>y())},null,8,["loading","title"])]),_:1})]),_:1}),l(T,{ref_key:"verify",ref:w,captchaType:o(R),imgSize:{width:"400px",height:"200px"},mode:"pop",onSuccess:_},null,8,["captchaType"])]),_:1})]),_:1},8,["model"])),[[X,o(G)]])}}}),[["__scopeId","data-v-d0160542"]]);export{Ve as default};
|