1 |
- import{d as j,r as v,aD as b,Z as R,k as V,j as E,_ as O,aC as z,aG as A,ai as r,o as $,M as q,O as s,a9 as G,U as a,a as U,I as J,R as Z,T as H}from"./vue.1RczIYhx.js";import{v as Q,u as W,c as P,S as B,t as T,x as D,y as K,D as X,N as Y,d as M,q as x}from"./index.DYFzjhQc.js";import{a as ee}from"./formatTime.in1fXasu.js";import{g as N,l as oe}from"./api.BWflhqc0.js";import{M as ae}from"./md5.DLPczxzP.js";import{e as L}from"./emitter.CmVdYeno.js";import{h as se}from"./elementPlus.CXoFsoPv.js";import{_ as te}from"./_plugin-vue_export-helper.DlAUqK2U.js";const ne=j({name:"loginAccount",setup(){const e=v(!1),{t:n}=Q.useI18n(),w=W(),{themeConfig:g}=b(w);b(P());const p=z(),h=A(),t=R({isShowPassword:!1,ruleForm:{username:"",password:"",captcha:"",captchaKey:"",captchaImgBase:""},loading:{signIn:!1}}),d=R({username:[{required:!0,message:"请填写账号",trigger:"blur"}],password:[{required:!0,message:"请填写密码",trigger:"blur"}],captcha:[{required:!0,message:"请填写验证码",trigger:"blur"}]}),l=v(),i=V(()=>ee(new Date)),_=V(()=>M().systemConfig["base.captcha_state"]),y=async()=>{N().then(o=>{t.ruleForm.captchaImgBase=o.data.image_base,t.ruleForm.captchaKey=o.data.key})},u=async()=>{t.ruleForm.captcha="",N().then(o=>{t.ruleForm.captchaImgBase=o.data.image_base,t.ruleForm.captchaKey=o.data.key})},C=async()=>{l.value&&await l.value.validate(o=>{o?(e.value=!0,oe({...t.ruleForm,password:ae.hashStr(t.ruleForm.password)}).then(m=>{m.code===2e3&&(B.set("token",m.data.access),T.set("username",m.data.name),g.value.isRequestRoutes?(K(),c()):(D(),c()))}).catch(m=>{u()}).finally(()=>{e.value=!1})):x("请填写登录信息")})},f=()=>{P().setUserInfos()};L.on("scan-wecomLogin",o=>{o.loginInfo.code==2e3&&(B.set("token",o.loginInfo.data.access),T.set("username",o.loginInfo.data.name),g.value.isRequestRoutes?(K(),c()):(D(),c()),L.off("scan-wecomLogin"))});const c=()=>{var k,S,F,I;f(),X().getSystemDictionarys();let o=i.value;(k=p.query)!=null&&k.redirect?h.push({path:(S=p.query)==null?void 0:S.redirect,query:Object.keys((F=p.query)==null?void 0:F.params).length>0?JSON.parse((I=p.query)==null?void 0:I.params):""}):h.push("/"),t.loading.signIn=!0;const m=n("message.signInText");se.success(`${o},${m}`),Y.start()};return E(()=>{y(),M().getSystemConfigs()}),{loginLoading:e,refreshCaptcha:u,loginClick:C,loginSuccess:c,isShowCaptcha:_,state:t,formRef:l,rules:d,...O(t)}}});function re(e,n,w,g,p,h){const t=r("ele-User"),d=r("el-icon"),l=r("el-input"),i=r("el-form-item"),_=r("ele-Unlock"),y=r("ele-Position"),u=r("el-col"),C=r("el-image"),f=r("el-button"),c=r("el-form");return $(),q(c,{ref:"formRef",model:e.state.ruleForm,rules:e.rules,class:"login-content-form",size:"large",onKeyup:G(e.loginClick,["enter"])},{default:s(()=>[a(i,{class:"login-animation1",prop:"username"},{default:s(()=>[a(l,{modelValue:e.ruleForm.username,"onUpdate:modelValue":n[0]||(n[0]=o=>e.ruleForm.username=o),placeholder:e.$t("message.account.accountPlaceholder1"),autocomplete:"off",clearable:"",type:"text"},{prefix:s(()=>[a(d,{class:"el-input__icon"},{default:s(()=>[a(t)]),_:1})]),_:1},8,["modelValue","placeholder"])]),_:1}),a(i,{class:"login-animation2",prop:"password"},{default:s(()=>[a(l,{modelValue:e.ruleForm.password,"onUpdate:modelValue":n[2]||(n[2]=o=>e.ruleForm.password=o),placeholder:e.$t("message.account.accountPlaceholder2"),type:e.isShowPassword?"text":"password"},{prefix:s(()=>[a(d,{class:"el-input__icon"},{default:s(()=>[a(_)]),_:1})]),suffix:s(()=>[U("i",{class:J([e.isShowPassword?"icon-yincangmima":"icon-xianshimima","iconfont el-input__icon login-content-password"]),onClick:n[1]||(n[1]=o=>e.isShowPassword=!e.isShowPassword)},null,2)]),_:1},8,["modelValue","placeholder","type"])]),_:1}),e.isShowCaptcha?($(),q(i,{key:0,class:"login-animation3",prop:"captcha"},{default:s(()=>[a(u,{span:15},{default:s(()=>[a(l,{modelValue:e.ruleForm.captcha,"onUpdate:modelValue":n[3]||(n[3]=o=>e.ruleForm.captcha=o),placeholder:e.$t("message.account.accountPlaceholder3"),autocomplete:"off",clearable:"",maxlength:"4",type:"text"},{prefix:s(()=>[a(d,{class:"el-input__icon"},{default:s(()=>[a(y)]),_:1})]),_:1},8,["modelValue","placeholder"])]),_:1}),a(u,{span:1}),a(u,{span:8},{default:s(()=>[a(f,{class:"login-content-captcha"},{default:s(()=>[a(C,{src:e.ruleForm.captchaImgBase,onClick:e.refreshCaptcha},null,8,["src","onClick"])]),_:1})]),_:1})]),_:1})):Z("",!0),a(i,{class:"login-animation4"},{default:s(()=>[a(f,{loading:e.loginLoading,class:"login-content-submit",round:"",type:"primary",onClick:e.loginClick},{default:s(()=>[U("span",null,H(e.$t("message.account.accountBtnText")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1},8,["model","rules","onKeyup"])}const ge=te(ne,[["render",re],["__scopeId","data-v-b4979f21"]]);export{ge as default};
|