LoginForm.04c1025a.js 6.4 KB

1
  1. var I=(a,c,u)=>new Promise((i,o)=>{var f=s=>{try{l(u.next(s))}catch(v){o(v)}},t=s=>{try{l(u.throw(s))}catch(v){o(v)}},l=s=>s.done?i(s.value):Promise.resolve(s.value).then(f,t);l((u=u.apply(a,c)).next())});import{j as G,a as H,I as D,k as J,b as Q,l as W,m as X,p as Y,q as K,r as _,s as T,t as j,o as Z,e as ee,w as C,v as x,i as r,x as p,h as e,f as oe,y as $,z as L,B as te,A as re,C as se,D as ae,E as ne,F as V,G as ie}from"./index.ae52ebae.js";import"./index.9e0f8a6b.js";/* empty css */import{C as ce}from"./index.beed4ab5.js";import{u as le,_ as pe,a as ue}from"./LoginFormTitle.9ab6eda3.js";import de from"./FormModalPassword.5351fefd.js";import{b as q}from"./index.0c29338b.js";import{u as me}from"./index.3ccc18ac.js";import{F as O}from"./Form.1cc72784.js";import{R as N,C as b}from"./index.5e5e8ba1.js";import"./Checkbox.919eb32a.js";import"./BasicForm.d58d202f.js";import"./index.c1d6a1f9.js";import"./index.0321d0be.js";import"./index.4040b11d.js";import"./index.a995b471.js";import"./index.14e14872.js";import"./index.52c33256.js";import"./get.0b1c6ac7.js";import"./index.0fe57a5b.js";import"./_baseIteratee.432be787.js";import"./DeleteOutlined.707204c0.js";import"./index.87b4cc3a.js";import"./useRefs.fe3bdf15.js";import"./index.adbf62a5.js";import"./index.37fc506d.js";import"./useFlexGapSupport.3240d255.js";import"./index.5c0d538f.js";import"./uniqBy.7b5fdd96.js";import"./index.5d87e81e.js";import"./css.bcd121de.js";import"./index.3eedf359.js";import"./index.3b88ad02.js";import"./useContextMenu.6088df26.js";import"./useForm.e55162bc.js";import"./sysUserApi.82fd98c7.js";import"./onMountedOrActivated.c176aad3.js";import"./useWindowSizeFn.d176b3a5.js";import"./FullscreenOutlined.b9fd5be6.js";import"./Col.605699c9.js";import"./useSize.9b10dc05.js";/*! js-cookie v3.0.1 | MIT */function B(a){for(var c=1;c<arguments.length;c++){var u=arguments[c];for(var i in u)a[i]=u[i]}return a}var fe={read:function(a){return a[0]==='"'&&(a=a.slice(1,-1)),a.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(a){return encodeURIComponent(a).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function k(a,c){function u(o,f,t){if(typeof document!="undefined"){t=B({},c,t),typeof t.expires=="number"&&(t.expires=new Date(Date.now()+t.expires*864e5)),t.expires&&(t.expires=t.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var l="";for(var s in t)!t[s]||(l+="; "+s,t[s]!==!0&&(l+="="+t[s].split(";")[0]));return document.cookie=o+"="+a.write(f,o)+l}}function i(o){if(!(typeof document=="undefined"||arguments.length&&!o)){for(var f=document.cookie?document.cookie.split("; "):[],t={},l=0;l<f.length;l++){var s=f[l].split("="),v=s.slice(1).join("=");try{var h=decodeURIComponent(s[0]);if(t[h]=a.read(v,h),o===h)break}catch(M){}}return o?t[o]:t}}return Object.create({set:u,get:i,remove:function(o,f){u(o,"",B({},f,{expires:-1}))},withAttributes:function(o){return k(this.converter,B({},this.attributes,o))},withConverter:function(o){return k(B({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(c)},converter:{value:Object.freeze(a)}})}var g=k(fe,{path:"/"});const ge=["src"],ve=H({__name:"LoginForm",setup(a){const c=O.Item,u=D.Password,{t:i}=J(),{notification:o,createErrorModal:f}=ie(),{prefixCls:t}=Q("login"),l=W(),{getFormRules:s}=le(),[v,{openModal:h}]=me(),M=X();Y(()=>{g.get("account")&&(n.account=K(g.get("account"))||""),g.get("password")&&(n.password=K(g.get("password"))||"")});const z=_(),R=_(!1),F=_(!0),n=T({account:"",password:"",codeKey:q(),code:""}),{validForm:P}=ue(z),A=_(!0),S=T({loading:!1,captchaSrc:j(n.codeKey),showCaptcha:!0});function U(){return I(this,null,function*(){n.codeKey=q(),S.captchaSrc=j(n.codeKey)})}function E(){return I(this,null,function*(){var d;const y=yield P();if(!!y)try{R.value=!0;const m=(d=M.query)==null?void 0:d.redirect,he=new se(ae),w=yield l.login(ne({grantType:"1",password:y.password,username:y.account,mode:"none",codeKey:n.codeKey,code:n.code,redirect:m}));if(w){if((w==null?void 0:w.isReset)==1){h(!0,{});return}F.value?(g.set("account",V(n.account),{expires:30}),g.set("password",V(n.password),{expires:30})):(g.set("account",""),g.set("password","")),o.success({message:i("sys.login.loginSuccessTitle"),description:`${i("sys.login.loginSuccessDesc")}: ${w.realName}`,duration:3})}}catch(m){U(),f({title:i("sys.api.errorTip"),content:m.message||i("sys.api.networkExceptionMsg"),getContainer:()=>document.body.querySelector(`.${t}`)||document.body})}finally{R.value=!1}})}return(y,d)=>(Z(),ee("div",null,[C(r(pe,{class:"enter-x"},null,512),[[x,A.value]]),C(r(e(O),{class:"p-4 enter-x",model:n,rules:e(s),ref_key:"formRef",ref:z,onKeypress:re(E,["enter"]),layout:"vertical"},{default:p(()=>[r(e(c),{name:"account",class:"enter-x",label:"\u8D26\u53F7"},{default:p(()=>[r(e(D),{size:"large",value:n.account,"onUpdate:value":d[0]||(d[0]=m=>n.account=m),maxlength:255,placeholder:e(i)("sys.login.userName"),class:"fix-auto-fill"},null,8,["value","placeholder"])]),_:1}),r(e(c),{name:"password",class:"enter-x",label:"\u5BC6\u7801"},{default:p(()=>[r(e(u),{size:"large",visibilityToggle:"",maxlength:255,value:n.password,"onUpdate:value":d[1]||(d[1]=m=>n.password=m),placeholder:e(i)("sys.login.password")},null,8,["value","placeholder"])]),_:1}),C(r(e(N),{class:"enter-x"},{default:p(()=>[r(e(b),{span:"16"},{default:p(()=>[r(e(c),{class:"code-input",name:"code",label:"\u9A8C\u8BC1\u7801"},{default:p(()=>[r(e(D),{size:"large",visibilityToggle:"",value:n.code,"onUpdate:value":d[2]||(d[2]=m=>n.code=m),placeholder:"\u9A8C\u8BC1\u7801"},null,8,["value"])]),_:1})]),_:1}),r(e(b),{span:"8"},{default:p(()=>[C(oe("img",{src:S.captchaSrc,onClick:U,alt:"captcha",class:"code-image"},null,8,ge),[[x,!0]])]),_:1})]),_:1},512),[[x,S.showCaptcha]]),r(e(N),{class:"enter-x"},{default:p(()=>[r(e(b),{span:12},{default:p(()=>[r(e(c),null,{default:p(()=>[r(e(ce),{checked:F.value,"onUpdate:checked":d[3]||(d[3]=m=>F.value=m),size:"small"},{default:p(()=>[$(L(e(i)("sys.login.rememberMe")),1)]),_:1},8,["checked"])]),_:1})]),_:1})]),_:1}),r(e(c),{class:"enter-x"},{default:p(()=>[r(e(te),{type:"primary",size:"large",class:"btn-login",block:"",onClick:E,loading:R.value},{default:p(()=>[$(L(e(i)("sys.login.loginButton")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["model","rules","onKeypress"]),[[x,A.value]]),r(de,{onRegister:e(v),onSuccess:U},null,8,["onRegister"])]))}});var no=G(ve,[["__scopeId","data-v-2470d3e8"]]);export{no as default};