You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
3.3 KiB
JavaScript

import{_ as D,u as M,a as N,b as U,o as E,r as i,c as T,d as S,e as $,f as o,w as n,g as p,E as b,L as q,h as A,i as u,j as F,k as m,l as x,m as h,n as K,p as P,q as G,s as H}from"./index-fa074f0c.js";const J={class:"right_top"},O={__name:"AutoLogin",setup(Q){M(),N();const c=U(),j=()=>H(c);let g=p(!1),a=p(""),s=p(""),w=()=>{if(a.value==""||s.value=="")return b.error("用户名和密码不能为空");let l={username:k(a.value),password:k(s.value)};g.value=!0,q(l).then(e=>{if(g.value=!1,e.data.status=="ok"){sessionStorage.setItem("token",e.data.token),sessionStorage.setItem("refreshToken",e.data.refresh_token);var r=sessionStorage.getItem("token");r==e.data.token&&(window.location.href="./#/yewu/mainList")}else b.error(e.data.msg)})};const k=l=>{let e=l;var r={a:"z",b:"y",c:"x",d:"w",e:"v",f:"u",g:"t",h:"s",i:"r",j:"q",k:"p",l:"o",m:"n",n:"m",o:"l",p:"k",q:"j",r:"i",s:"h",t:"g",u:"f",v:"e",w:"d",x:"c",y:"b",z:"a",0:"@",1:"!",2:"#",3:"$",4:"%",5:"^",6:"&",7:"*",8:"(",9:")"},d=e.split("").map(v=>r[v]||v).join(""),f=d.split("").reverse().join(""),_="a5331_"+f+"_a454d",y=btoa(_);return y};let z=p(null),R=p(null);const C=()=>{R.value.focus()};E(()=>{a.value=V("u"),s.value=V("p"),console.log(a.value),console.log(s.value),w()});function V(l,e){e||(e=decodeURIComponent(window.location.href)),l=l.replace(/[\[\]]/g,"\\$&");var r=new RegExp("[?&]"+l+"(=([^&#]*)|&|#|$)"),d=r.exec(e);return d?d[2]?decodeURIComponent(d[2].replace(/\+/g," ")):"":null}return(l,e)=>{const r=i("el-col"),d=i("el-switch"),f=i("el-form-item"),_=i("el-input"),y=i("el-button"),v=i("el-form"),I=i("el-row"),L=i("el-container"),B=T("loading");return S(),$("div",null,[o(L,{class:"common-layout"},{default:n(()=>[o(I,{style:{width:"100%",display:"flex","justify-content":"center"}},{default:n(()=>[o(r,{span:9,class:"left"}),A((S(),F(r,{span:15,class:"right"},{default:n(()=>[m("div",J,[m("div",null,[o(d,{modelValue:u(c),"onUpdate:modelValue":e[0]||(e[0]=t=>x(c)?c.value=t:null),"inline-prompt":"","active-color":"var(--el-fill-color-dark)","inactive-color":"var(--el-color-primary)","active-action-icon":"Moon","inactive-action-icon":"Sunny",onChange:j},null,8,["modelValue"])])]),o(v,{style:{width:"400px"},ref:"ruleFormRef","status-icon":"",class:"demo-ruleForm"},{default:n(()=>[o(f,null,{default:n(()=>[...e[6]||(e[6]=[m("span",{style:{"font-size":"22px"}},"登录您的账户",-1)])]),_:1}),o(f,null,{default:n(()=>[o(_,{modelValue:u(a),"onUpdate:modelValue":e[1]||(e[1]=t=>x(a)?a.value=t:a=t),modelModifiers:{number:!0},ref_key:"usernameRef",ref:z,onKeyup:e[2]||(e[2]=h(t=>C(),["enter"])),"prefix-icon":u(K),placeholder:"用户名",size:"large"},null,8,["modelValue","prefix-icon"])]),_:1}),o(f,null,{default:n(()=>[o(_,{modelValue:u(s),"onUpdate:modelValue":e[3]||(e[3]=t=>x(s)?s.value=t:s=t),type:"password",ref_key:"passwordRef",ref:R,onKeyup:e[4]||(e[4]=h(t=>u(w)(),["enter"])),autocomplete:"off",placeholder:"密码",size:"large","prefix-icon":u(P)},null,8,["modelValue","prefix-icon"])]),_:1}),o(f,null,{default:n(()=>[o(y,{style:{width:"100%"},type:"primary",onClick:e[5]||(e[5]=t=>u(w)(l.ruleFormRef)),size:"large"},{default:n(()=>[...e[7]||(e[7]=[G("登录",-1)])]),_:1})]),_:1}),e[8]||(e[8]=m("div",{style:{height:"160px"}},null,-1))]),_:1},512),e[9]||(e[9]=m("div",{class:"right_bottom"},null,-1))]),_:1})),[[B,u(g)]])]),_:1})]),_:1})])}}},X=D(O,[["__scopeId","data-v-af1c144e"]]);export{X as default};