account.CCllN6Km.js 5.2 KB

1
  1. import{a as K,aE as F,aD as D,aJ as E,_ as S,r as N,f as I,q,ai as A,ao as r,c as V,o as y,T as a,O as P,L as o,K as M,b as d,G as L,Q as v,R as z,a7 as J,S as O}from"./vue.fY72QXCX.js";import{v as j,u as G,d as B,f as R,I as Q,h as H,S as $,a0 as W,a1 as X,J as Y,D as Z,E as x,N as ee}from"./index.BcNtsjQa.js";import{a as ae}from"./formatTime.in1fXasu.js";import{g as T,l as oe}from"./api.BOYZw55E.js";import{M as se}from"./md5.DLPczxzP.js";import{_ as te}from"./_plugin-vue_export-helper.DlAUqK2U.js";const ne=K({name:"loginAccount",setup(){const{t:e}=j.useI18n(),t=G(),{themeConfig:w}=F(t),{userInfos:C}=F(B());D();const k=E(),n=S({isShowPassword:!1,ruleForm:{username:"",password:"",captcha:"",captchaKey:"",captchaImgBase:"",tenant_id:1},loading:{signIn:!1},agreePolicy:!0}),g=S({username:[{required:!0,message:"请填写账号",trigger:"blur"}],password:[{required:!0,message:"请填写密码",trigger:"blur"}],captcha:[{required:!0,message:"请填写验证码",trigger:"blur"}]}),i=N(),m=I(()=>ae(new Date)),c=I(()=>R().systemConfig["base.captcha_state"]),f=async()=>{T().then(l=>{n.ruleForm.captchaImgBase=l.data.image_base,n.ruleForm.captchaKey=l.data.key})},h=async()=>{window.open(Q("/api/system/apply_for_trial/"))},p=async()=>{n.ruleForm.captcha="",T().then(l=>{n.ruleForm.captchaImgBase=l.data.image_base,n.ruleForm.captchaKey=l.data.key})},_=async()=>{i.value&&await i.value.validate(l=>{l?oe({...n.ruleForm,password:se.hashStr(n.ruleForm.password)}).then(s=>{if(s.code===2e3){const{data:U}=s;H.set("username",s.data.username),$.set("token",s.data.access),$.set("merchant_info",s.data.merchant_info),B().setPwdChangeCount(U.pwd_change_count),w.value.isRequestRoutes?(X(),u()):(W(),u())}}).catch(s=>{p()}):Y("请填写登录信息")})},u=()=>{Z().getSystemDictionarys();let l=m.value;C.value.pwd_change_count,k.push("/"),n.loading.signIn=!0;const s=e("message.signInText");x.success(`${l},${s}`),ee.start()};return q(()=>{f(),R().getSystemConfigs()}),{refreshCaptcha:p,loginClick:_,loginSuccess:u,isShowCaptcha:c,state:n,formRef:i,rules:g,applyBtnClick:h,showApply:()=>window.location.href.indexOf("public")!=-1,...A(n)}}}),le={key:0,style:{"text-align":"center"}};function re(e,t,w,C,k,n){const g=r("ele-User"),i=r("el-icon"),m=r("el-input"),c=r("el-form-item"),f=r("ele-Unlock"),h=r("ele-Position"),p=r("el-col"),_=r("el-image"),u=r("el-button"),b=r("el-checkbox"),l=r("el-form");return y(),V(O,null,[a(l,{ref:"formRef",size:"large",class:"login-content-form",model:e.state.ruleForm,rules:e.rules,onKeyup:J(e.loginClick,["enter"])},{default:o(()=>[a(c,{class:"login-animation1",prop:"username"},{default:o(()=>[a(m,{type:"text",placeholder:e.$t("message.account.accountPlaceholder1"),modelValue:e.ruleForm.username,"onUpdate:modelValue":t[0]||(t[0]=s=>e.ruleForm.username=s),clearable:"",autocomplete:"off"},{prefix:o(()=>[a(i,{class:"el-input__icon"},{default:o(()=>[a(g)]),_:1})]),_:1},8,["placeholder","modelValue"])]),_:1}),a(c,{class:"login-animation2",prop:"password"},{default:o(()=>[a(m,{type:e.isShowPassword?"text":"password",placeholder:e.$t("message.account.accountPlaceholder2"),modelValue:e.ruleForm.password,"onUpdate:modelValue":t[2]||(t[2]=s=>e.ruleForm.password=s)},{prefix:o(()=>[a(i,{class:"el-input__icon"},{default:o(()=>[a(f)]),_:1})]),suffix:o(()=>[d("i",{class:L(["iconfont el-input__icon login-content-password",e.isShowPassword?"icon-yincangmima":"icon-xianshimima"]),onClick:t[1]||(t[1]=s=>e.isShowPassword=!e.isShowPassword)},null,2)]),_:1},8,["type","placeholder","modelValue"])]),_:1}),e.isShowCaptcha?(y(),M(c,{key:0,class:"login-animation3",prop:"captcha"},{default:o(()=>[a(p,{span:15},{default:o(()=>[a(m,{type:"text",maxlength:"4",placeholder:e.$t("message.account.accountPlaceholder3"),modelValue:e.ruleForm.captcha,"onUpdate:modelValue":t[3]||(t[3]=s=>e.ruleForm.captcha=s),clearable:"",autocomplete:"off"},{prefix:o(()=>[a(i,{class:"el-input__icon"},{default:o(()=>[a(h)]),_:1})]),_:1},8,["placeholder","modelValue"])]),_:1}),a(p,{span:1}),a(p,{span:8},{default:o(()=>[a(u,{class:"login-content-captcha"},{default:o(()=>[a(_,{src:e.ruleForm.captchaImgBase,onClick:e.refreshCaptcha},null,8,["src","onClick"])]),_:1})]),_:1})]),_:1})):P("",!0),a(c,null,{default:o(()=>[a(b,{modelValue:e.state.agreePolicy,"onUpdate:modelValue":t[4]||(t[4]=s=>e.state.agreePolicy=s)},{default:o(()=>t[5]||(t[5]=[v(" 已阅读并同意 ",-1),d("a",{href:"/user-agreement",target:"_blank",class:"login-link"},"《用户服务协议》",-1),v(" 与 ",-1),d("a",{href:"/privacy-policy",target:"_blank",class:"login-link"},"《隐私协议》",-1)])),_:1,__:[5]},8,["modelValue"])]),_:1}),a(c,{class:"login-animation4"},{default:o(()=>[a(u,{type:"primary",class:"login-content-submit",round:"",onClick:e.loginClick,loading:e.loading.signIn,disabled:!e.state.agreePolicy},{default:o(()=>[d("span",null,z(e.$t("message.account.accountBtnText")),1)]),_:1},8,["onClick","loading","disabled"])]),_:1})]),_:1},8,["model","rules","onKeyup"]),e.showApply()?(y(),V("div",le,[a(u,{class:"login-content-apply",link:"",type:"primary",plain:"",round:"",onClick:e.applyBtnClick},{default:o(()=>t[6]||(t[6]=[d("span",null,"申请试用",-1)])),_:1,__:[6]},8,["onClick"])])):P("",!0)],64)}const ge=te(ne,[["render",re],["__scopeId","data-v-b4d89470"]]);export{ge as default};