import{_ as W,b as O,d as j,r as u,w as G,e as H,g as J,f as Q,h as X,E as Y,i as Z,j as ee,k as se,l as oe,m as ae,c as p,n as s,p as t,q as n,s as te,t as c,v as _,x as g,y as k,z as le,o as r,F as ne,A as re,B as ue,C as ie,a as pe,u as ce,D as de,G as ge,H as _e,I as me,J as E}from"./index.8d733f79.js";import fe from"./registerOpenPlatform.e1da23ef.js";import he from"./register.65c4c902.js";import{v as I}from"./v4.442de5a8.js";const ve={class:"login"},ye={key:0,style:{position:"absolute",top:"20px",right:"20px"}},we={key:1,class:"login-wrap"},Ce={class:"title"},Ve=["src"],ke={class:"actTxt"},be={key:0},Te={key:1},xe={class:"title version"},$e={__name:"login",setup(Se){const{t:m,locale:L}=O(),q=j(),B=pe(),b=ce(),{proxy:T}=de(),i=u("login"),l=u({username:"",password:"",captcha:""}),x=u(!1),f=u(!1),$=u(!1),h=u(localStorage.getItem("locale")||"zh_CN"),N=[{value:"zh_CN",label:"\u7B80\u4F53\u4E2D\u6587"},{value:"en_US",label:"English"},{value:"zh_TW",label:"\u7E41\u4F53\u4E2D\u6587"}],U={username:[{required:!0,trigger:"blur",message:m("userNameP")}],password:[{required:!0,trigger:"blur",message:m("passWordP")}],captcha:[{required:!0,trigger:"blur",message:m("verifiyCodeP")}]},F="./",v=u(I()),d=u(!1),S=u("");G(B,e=>{i.value=e.query.loginType||"login"},{immediate:!0});function P(){T.$refs.loginRef.validate(e=>{if(e){d.value=!0;const o={...l.value};o.uuid=v.value,o.needCaptcha=f.value,o.username=o.username.trim(),o.password=_e.encrypt(l.value.username,l.value.password).replaceAll("+","%2B"),q.login(o).then(()=>{d.value=!1,me().delAllVisitedViews(),E.session.set("password",o.password),E.session.set("pwText",l.value.password),b.push({path:"/"})}).catch(()=>{d.value=!1})}})}function y(e){i.value=e,b.push({path:"/login",query:{...T.$route.query,loginType:i.value}})}H(()=>{J().then(e=>{x.value=e.data==="cloud",f.value=e.data!=="cloud"}),Q().then(e=>{$.value=e.data,sessionStorage.setItem("showChangeLang",e.data)}),X().then(e=>{S.value=e.data})});const R=e=>{L.value=e,le().setLanguage(e)},z=()=>{v.value=I()};return(e,o)=>{const D=Y,A=Z,w=ge,C=ee,V=se,K=oe,M=ae;return r(),p("div",ve,[s($)?(r(),p("div",ye,[t(A,{modelValue:s(h),"onUpdate:modelValue":o[0]||(o[0]=a=>te(h)?h.value=a:null),style:{width:"100px"},onChange:R},{default:n(()=>[(r(),p(ne,null,re(N,a=>t(D,{key:a.value,label:a.label,value:a.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])])):c("",!0),s(i)==="login"?(r(),p("div",we,[_("div",Ce,g(e.$t("sysTitle"))+" ",1),t(M,{ref:"loginRef",model:s(l),rules:U,class:"loginForm"},{default:n(()=>[t(V,{prop:"username"},{default:n(()=>[t(C,{modelValue:s(l).username,"onUpdate:modelValue":o[1]||(o[1]=a=>s(l).username=a),"auto-complete":"off",placeholder:e.$t("userNameP"),class:"login-input"},{prefix:n(()=>[t(w,{"icon-class":"user",class:"el-input__icon"})]),_:1},8,["modelValue","placeholder"])]),_:1}),t(V,{prop:"password",style:{"margin-top":"40px"}},{default:n(()=>[t(C,{modelValue:s(l).password,"onUpdate:modelValue":o[2]||(o[2]=a=>s(l).password=a),type:"password","show-password":"","auto-complete":"off",placeholder:e.$t("passWordP"),class:"login-input"},{prefix:n(()=>[t(w,{"icon-class":"password",class:"el-input__icon"})]),_:1},8,["modelValue","placeholder"])]),_:1}),s(f)?(r(),k(V,{key:0,prop:"captcha",style:{"margin-top":"40px"}},{default:n(()=>[t(C,{modelValue:s(l).captcha,"onUpdate:modelValue":o[3]||(o[3]=a=>s(l).captcha=a),"auto-complete":"off",placeholder:e.$t("verifiyCodeP"),onKeyup:ue(P,["enter"]),class:"login-input"},{prefix:n(()=>[t(w,{"icon-class":"captcha",class:"el-input__icon"})]),append:n(()=>[_("img",{alt:"\u9A8C\u8BC1\u7801",src:`${s(F)}/equipment-web/user/login/graph_captcha?uuid=${s(v)}`,style:{width:"100px"},onClick:z},null,8,Ve)]),_:1},8,["modelValue","placeholder","onKeyup"])]),_:1})):c("",!0),_("div",ke,[s(x)?(r(),p("div",{key:0,onClick:o[4]||(o[4]=a=>y("register"))},g(e.$t("registerNow")),1)):c("",!0)]),t(K,{loading:s(d),type:"primary",size:"large",class:"loginBtn",onClick:ie(P,["prevent"])},{default:n(()=>[s(d)?(r(),p("span",Te,g(e.$t("loginIng")),1)):(r(),p("span",be,g(e.$t("login")),1))]),_:1},8,["loading","onClick"])]),_:1},8,["model"]),_("div",xe,g(s(S))+" ",1)])):c("",!0),s(i)==="resetPwd"?(r(),k(he,{key:2,onChangePageType:y,formType:s(i)},null,8,["formType"])):c("",!0),s(i)==="register"?(r(),k(fe,{key:3,onChangePageType:y,formType:s(i)},null,8,["formType"])):c("",!0)])}}},qe=W($e,[["__scopeId","data-v-7b492c25"]]);export{qe as default};
