account.DY2P1iyu.js 3.8 KB

1
  1. import{d as q,N as b,R as B,C as T,r as I,a as V,c as P,o as U,a1 as A,b as l,e as F,f as R,g as s,j as N,w as o,s as w,t as D,A as M,_ as E,F as K}from"./vue.BxlDVA1H.js";import{a6 as j,u as L,a7 as v,T as O,g as z,m as H,S as J,A as G,H as Q,I as W,D as X,e as Y,N as Z}from"./index.lP_uh0LI.js";import{l as x,a as ee}from"./api.6lAQLjQc.js";import{a as se}from"./formatTime.in1fXasu.js";import{M as oe}from"./md5.DLPczxzP.js";import{_ as ae}from"./_plugin-vue_export-helper.DlAUqK2U.js";const ne=q({name:"loginAccount",setup(){const{t:e}=j.useI18n(),a=L(),{themeConfig:_}=b(a),{userInfos:$}=b(v()),u=B(),f=T(),n=I({isShowPassword:!1,ruleForm:{username:"",password:"",captcha:"",captchaKey:"",captchaImgBase:""},loading:{signIn:!1}}),p=I({username:[{required:!0,message:"请填写账号",trigger:"blur"}],password:[{required:!0,message:"请填写密码",trigger:"blur"}],captcha:[{required:!0,message:"请填写验证码",trigger:"blur"}]}),i=V(),c=P(()=>se(new Date)),g=async()=>{window.open(z(`${H.system}apply_for_trial/`))},m=async()=>{n.ruleForm.captcha=""},y=async()=>{i.value&&await i.value.validate(h=>{h?x({...n.ruleForm,password:oe.hashStr(n.ruleForm.password)}).then(r=>{if(r.code===2e4){const{data:d}=r;ee.set("username",r.data.username),J.set("token",r.data.access),v().setPwdChangeCount(d.pwd_change_count),_.value.isRequestRoutes?(Q(),t()):(G(),t())}}).catch(r=>{m()}):W("请填写登录信息")})},t=()=>{var d,C,k,S;X().getSystemDictionarys();let h=c.value;(d=u.query)!=null&&d.redirect?f.push({path:(C=u.query)==null?void 0:C.redirect,query:Object.keys((k=u.query)==null?void 0:k.params).length>0?JSON.parse((S=u.query)==null?void 0:S.params):""}):f.push("/"),n.loading.signIn=!0;const r=e("message.signInText");Y.success(`${h},${r}`),Z.start()};return U(()=>{O().getSystemConfigs()}),{refreshCaptcha:m,loginClick:y,loginSuccess:t,state:n,formRef:i,rules:p,applyBtnClick:g,showApply:()=>window.location.href.indexOf("public")!=-1,...A(n)}}}),te={key:0,style:{"text-align":"center"}};function re(e,a,_,$,u,f){const n=l("ele-User"),p=l("el-icon"),i=l("el-input"),c=l("el-form-item"),g=l("ele-Unlock"),m=l("el-button"),y=l("el-form");return R(),F(K,null,[s(y,{ref:"formRef",size:"large",class:"login-content-form",model:e.state.ruleForm,rules:e.rules,onKeyup:E(e.loginClick,["enter"])},{default:o(()=>[s(c,{class:"login-animation1",prop:"username"},{default:o(()=>[s(i,{type:"text",placeholder:e.$t("message.account.accountPlaceholder1"),modelValue:e.ruleForm.username,"onUpdate:modelValue":a[0]||(a[0]=t=>e.ruleForm.username=t),clearable:"",autocomplete:"off"},{prefix:o(()=>[s(p,{class:"el-input__icon"},{default:o(()=>[s(n)]),_:1})]),_:1},8,["placeholder","modelValue"])]),_:1}),s(c,{class:"login-animation2",prop:"password"},{default:o(()=>[s(i,{type:e.isShowPassword?"text":"password",placeholder:e.$t("message.account.accountPlaceholder2"),modelValue:e.ruleForm.password,"onUpdate:modelValue":a[2]||(a[2]=t=>e.ruleForm.password=t)},{prefix:o(()=>[s(p,{class:"el-input__icon"},{default:o(()=>[s(g)]),_:1})]),suffix:o(()=>[w("i",{class:D(["iconfont el-input__icon login-content-password",e.isShowPassword?"icon-yincangmima":"icon-xianshimima"]),onClick:a[1]||(a[1]=t=>e.isShowPassword=!e.isShowPassword)},null,2)]),_:1},8,["type","placeholder","modelValue"])]),_:1}),s(c,{class:"login-animation4"},{default:o(()=>[s(m,{type:"primary",class:"login-content-submit",round:"",onClick:e.loginClick,loading:e.loading.signIn},{default:o(()=>[w("span",null,M(e.$t("message.account.accountBtnText")),1)]),_:1},8,["onClick","loading"])]),_:1})]),_:1},8,["model","rules","onKeyup"]),e.showApply()?(R(),F("div",te,[s(m,{class:"login-content-apply",link:"",type:"primary",plain:"",round:"",onClick:e.applyBtnClick},{default:o(()=>a[3]||(a[3]=[w("span",null,"申请试用",-1)])),_:1,__:[3]},8,["onClick"])])):N("",!0)],64)}const fe=ae(ne,[["render",re],["__scopeId","data-v-b7be5b5a"]]);export{fe as default};