account.DXVdnhBI.js 5.2 KB

1
  1. import{w as E,aT as b,aS as K,aY as M,af as S,D as N,F as V,O as z,az as A,aF as r,x as I,y,a8 as a,a3 as P,a1 as o,a0 as D,z as d,Y as q,a5 as v,a6 as L,ao as O,a7 as Y}from"./vue.Bi2Y_N79.js";import{v as j,u as G,c as B,d as R,y as H,f as J,S as $,R as Q,T as W,z as X,M as Z,E as x,N as ee}from"./index.igw5cVmP.js";import{a as ae}from"./formatTime.in1fXasu.js";import{g as T,l as oe}from"./api.CtzBhmv_.js";import{M as se}from"./md5.DLPczxzP.js";import{_ as te}from"./_plugin-vue_export-helper.DlAUqK2U.js";const ne=E({name:"loginAccount",setup(){const{t:e}=j.useI18n(),t=G(),{themeConfig:w}=b(t),{userInfos:C}=b(B());K();const k=M(),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=V(()=>ae(new Date)),c=V(()=>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(H("/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;J.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?(W(),u()):(Q(),u())}}).catch(s=>{p()}):X("请填写登录信息")})},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 z(()=>{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"),F=r("el-checkbox"),l=r("el-form");return y(),I(Y,null,[a(l,{ref:"formRef",size:"large",class:"login-content-form",model:e.state.ruleForm,rules:e.rules,onKeyup:O(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:q(["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(),D(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(F,{modelValue:e.state.agreePolicy,"onUpdate:modelValue":t[4]||(t[4]=s=>e.state.agreePolicy=s)},{default:o(()=>t[5]||(t[5]=[v(" 已阅读并同意 "),d("a",{href:"/user-agreement",target:"_blank",class:"login-link"},"《用户服务协议》",-1),v(" 与 "),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,L(e.$t("message.account.accountBtnText")),1)]),_:1},8,["onClick","loading","disabled"])]),_:1})]),_:1},8,["model","rules","onKeyup"]),e.showApply()?(y(),I("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};