沙钢智慧能源系统前端代码
houzhongjian
2024-10-09 314507f8ddadd9c66e98d260c3b2a5dad1a04015
1
import{d as B,r as d,u as C,v as D,ad as G,a as e,A as H,w as Q,b as W,P as X,ae as Y,o as b,g as v,B as n,k as o,h as Z,a2 as $,O as V,D as N,J as aa,Q as ea,y as oa,aI as la,ar as k,ai as na,aj as ta,ak as ra,al as sa,ag as ia,aJ as pa,S as da,am as ma,a7 as ua,an as ga,ao as ca,ap as fa,W as ha,aq as wa,H as ya}from"./index-BP6bNRoi.js";import{_ as xa}from"./Verify-Caf2Rnns.js";import{_ as _a}from"./XButton-BfzTlH8o.js";import{u as Fa,L as ba,_ as va,a as Va}from"./LoginFormTitle.vue_vue_type_script_setup_true_lang-BdHKqTBo.js";import{u as c}from"./useIcon-DZqEaX5R.js";import{r as f}from"./formRules-9V-NAySD.js";const Na=ya(B({name:"LoginForm",__name:"LoginForm",setup(ka){const{t:p}=aa();ea();const L=c({icon:"ep:house"}),P=c({icon:"ep:avatar"}),M=c({icon:"ep:lock"}),h=d(),{validForm:S}=Va(h),{setLoginState:La,getLoginState:E}=Fa(),{currentRoute:z,push:U}=C(),I=D(),m=d(""),u=d(!1),w=d(),O=d("blockPuzzle"),T=G(()=>e(E)===ba.LOGIN),j={tenantName:[f],username:[f],password:[f]},a=H({isShowPassword:!1,captchaEnable:"true",tenantEnable:"true",loginForm:{tenantName:"iailab",username:"admin",password:"admin123",captchaVerification:"",rememberMe:!0}}),y=async()=>{a.captchaEnable==="false"?await _({}):w.value.show()},x=d(),_=async t=>{u.value=!0;try{if(await(async()=>{if(a.tenantEnable==="true"){const s=await wa(a.loginForm.tenantName);k(s)}})(),!await S())return;a.loginForm.captchaVerification=t.captchaVerification;const l=await na(a.loginForm);if(!l)return;x.value=ta.service({lock:!0,text:"\u6B63\u5728\u52A0\u8F7D\u7CFB\u7EDF\u4E2D...",background:"rgba(0, 0, 0, 0.7)"}),a.loginForm.rememberMe?ra(a.loginForm):sa(),ia(l),m.value||(m.value="/"),pa(),m.value.indexOf("sso")!==-1?window.location.href=window.location.href.replace("/login?redirect=",""):U({path:m.value||I.addRouters[0].path})}finally{u.value=!1,x.value.close()}};return Q(()=>z.value,t=>{var l;m.value=(l=t==null?void 0:t.query)==null?void 0:l.redirect},{immediate:!0}),W(()=>{(()=>{const t=oa();t&&(a.loginForm={...a.loginForm,username:t.username?t.username:a.loginForm.username,password:t.password?t.password:a.loginForm.password,rememberMe:t.rememberMe,tenantName:t.tenantName?t.tenantName:a.loginForm.tenantName})})(),(async()=>{const t=location.host,l=await la(t);l&&(a.loginForm.tenantName=l.name,k(l.id))})()}),(t,l)=>{const s=da,i=ma,g=ua,q=ga,J=ca,F=fa,K=_a,R=xa,A=ha;return X((b(),v(A,{ref_key:"formLogin",ref:h,model:e(a).loginForm,rules:j,class:"login-form","label-position":"top","label-width":"120px",size:"large"},{default:n(()=>[o(F,{style:{"margin-right":"-10px","margin-left":"-10px"}},{default:n(()=>[o(i,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:n(()=>[o(s,null,{default:n(()=>[o(va,{style:{width:"100%"}})]),_:1})]),_:1}),o(i,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:n(()=>[e(a).tenantEnable==="true"?(b(),v(s,{key:0,prop:"tenantName"},{default:n(()=>[o(g,{modelValue:e(a).loginForm.tenantName,"onUpdate:modelValue":l[0]||(l[0]=r=>e(a).loginForm.tenantName=r),placeholder:e(p)("login.tenantNamePlaceholder"),"prefix-icon":e(L),link:"",type:"primary"},null,8,["modelValue","placeholder","prefix-icon"])]),_:1})):Z("",!0)]),_:1}),o(i,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:n(()=>[o(s,{prop:"username"},{default:n(()=>[o(g,{modelValue:e(a).loginForm.username,"onUpdate:modelValue":l[1]||(l[1]=r=>e(a).loginForm.username=r),placeholder:e(p)("login.usernamePlaceholder"),"prefix-icon":e(P)},null,8,["modelValue","placeholder","prefix-icon"])]),_:1})]),_:1}),o(i,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:n(()=>[o(s,{prop:"password"},{default:n(()=>[o(g,{modelValue:e(a).loginForm.password,"onUpdate:modelValue":l[2]||(l[2]=r=>e(a).loginForm.password=r),placeholder:e(p)("login.passwordPlaceholder"),"prefix-icon":e(M),"show-password":"",type:"password",onKeyup:l[3]||(l[3]=$(r=>y(),["enter"]))},null,8,["modelValue","placeholder","prefix-icon"])]),_:1})]),_:1}),o(i,{span:24,style:{"padding-right":"10px","padding-left":"10px","margin-top":"-20px","margin-bottom":"-20px"}},{default:n(()=>[o(s,null,{default:n(()=>[o(F,{justify:"space-between",style:{width:"100%"}},{default:n(()=>[o(i,{span:6},{default:n(()=>[o(q,{modelValue:e(a).loginForm.rememberMe,"onUpdate:modelValue":l[4]||(l[4]=r=>e(a).loginForm.rememberMe=r)},{default:n(()=>[V(N(e(p)("login.remember")),1)]),_:1},8,["modelValue"])]),_:1}),o(i,{offset:6,span:12},{default:n(()=>[o(J,{style:{float:"right"},type:"primary"},{default:n(()=>[V(N(e(p)("login.forgetPassword")),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),o(i,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:n(()=>[o(s,null,{default:n(()=>[o(K,{loading:e(u),title:e(p)("login.login"),class:"w-[100%]",type:"primary",onClick:l[5]||(l[5]=r=>y())},null,8,["loading","title"])]),_:1})]),_:1}),o(R,{ref_key:"verify",ref:w,captchaType:e(O),imgSize:{width:"400px",height:"200px"},mode:"pop",onSuccess:_},null,8,["captchaType"])]),_:1})]),_:1},8,["model"])),[[Y,e(T)]])}}}),[["__scopeId","data-v-5121b518"]]);export{Na as default};