2 lines
2.5 KiB
JavaScript
2 lines
2.5 KiB
JavaScript
var k=(w,i,r)=>new Promise((t,d)=>{var f=n=>{try{u(r.next(n))}catch(c){d(c)}},g=n=>{try{u(r.throw(n))}catch(c){d(c)}},u=n=>n.done?t(n.value):Promise.resolve(n.value).then(f,g);u((r=r.apply(w,i)).next())});import{a as E,I as C,c as R,b as h,q as D,r as y,s as N,f as T,k as s,o as M,h as U,w as I,v as L,p as a,x as l,B as _,y as b,z as V,F as q,C as K}from"./index.caefd1ac.js";import{m as P}from"./md5.92f4ba89.js";import{F as $}from"./index.eb967d29.js";import"./index.1159119f.js";import{u as G,a as O,L as j,_ as A,b as H}from"./LoginFormTitle.17257dce.js";import"./_baseIteratee.3eabc135.js";import"./get.373dfd79.js";import"./useSize.de9063a9.js";const ae=E({__name:"LoginForm",setup(w){const i=$.Item,r=C.Password,{t}=R(),{notification:d,createErrorModal:f}=K(),{prefixCls:g}=h("login"),u=D(),{setLoginState:n,getLoginState:c}=G(),{getFormRules:B}=O(),F=y(),p=y(!1);y(!1);const m=N({account:"",password:""}),{validForm:z}=H(F),x=T(()=>s(c)===j.LOGIN);function v(S){return k(this,null,function*(){const e=yield z();if(!!e)try{p.value=!0;const o=yield u.login({password:P(e.password),username:e.account,mode:"none",homeRouter:S});o&&d.success({message:t("sys.login.loginSuccessTitle"),description:`${t("sys.login.loginSuccessDesc")}: ${o.name}`,duration:3})}catch(o){f({title:t("sys.api.errorTip"),content:o.message||t("sys.api.networkExceptionMsg"),getContainer:()=>document.body.querySelector(`.${g}`)||document.body})}finally{p.value=!1}})}return(S,e)=>(M(),U(q,null,[I(a(A,{class:"enter-x"},null,512),[[L,s(x)]]),I(a(s($),{class:"p-4 enter-x",model:m,rules:s(B),ref_key:"formRef",ref:F,onKeypress:e[4]||(e[4]=V(o=>v("/"),["enter"]))},{default:l(()=>[a(s(i),{name:"account",class:"enter-x"},{default:l(()=>[a(s(C),{size:"large",value:m.account,"onUpdate:value":e[0]||(e[0]=o=>m.account=o),placeholder:s(t)("sys.login.userName"),class:"fix-auto-fill"},null,8,["value","placeholder"])]),_:1}),a(s(i),{name:"password",class:"enter-x"},{default:l(()=>[a(s(r),{size:"large",visibilityToggle:"",value:m.password,"onUpdate:value":e[1]||(e[1]=o=>m.password=o),placeholder:s(t)("sys.login.password")},null,8,["value","placeholder"])]),_:1}),a(s(i),{class:"enter-x"},{default:l(()=>[a(s(_),{size:"large",block:"",onClick:e[2]||(e[2]=o=>v("/v")),loading:p.value},{default:l(()=>[b(" \u767B\u5F55\u5927\u5C4F ")]),_:1},8,["loading"]),a(s(_),{type:"primary",class:"mt-4",size:"large",block:"",onClick:e[3]||(e[3]=o=>v("/")),loading:p.value},{default:l(()=>[b(" \u767B\u5F55\u540E\u53F0 ")]),_:1},8,["loading"])]),_:1})]),_:1},8,["model","rules"]),[[L,s(x)]])],64))}});export{ae as default};
|