import{b as e,p as a,a as l,r as s,f as r,h as o,j as d,i,k as t,a6 as n,a7 as u,I as p,J as m,o as c,n as g,a8 as f,a9 as _,aa as v,ab as x,ac as h,v as b,A as w,D as y,_ as V}from"./index-a5345aa4.js";import{_ as k}from"./index.vue_vue_type_script_setup_true_lang-1818e4e7.js";const z={class:"login-container"},j={class:"login-card"},q=(e=>(p("data-v-d4e76e4c"),e=e(),m(),e))((()=>i("div",{class:"title"},[i("img",{src:"/v3-admin-vite/static/logo-text-2-eef467fb.png"})],-1))),C={class:"content"},M=V(e({__name:"index",setup(e){const p=a(),m=l(null),V=l(!1),M=l(""),U=s({username:"admin",password:"12345678",code:""}),I={username:[{required:!0,message:"请输入用户名",trigger:"blur"}],password:[{required:!0,message:"请输入密码",trigger:"blur"},{min:8,max:16,message:"长度在 8 到 16 个字符",trigger:"blur"}],code:[{required:!0,message:"请输入验证码",trigger:"blur"}]},K=()=>{var e;null==(e=m.value)||e.validate(((e,a)=>{e?(V.value=!0,y().login(U).then((()=>{p.push({path:"/"})})).catch((()=>{A(),U.password=""})).finally((()=>{V.value=!1}))):console.error("表单校验不通过",a)}))},A=()=>{U.code="",M.value="",u().then((e=>{M.value=e.data}))};return A(),(e,a)=>{const l=r("el-input"),s=r("el-form-item"),u=r("el-icon"),p=r("el-image"),y=r("el-button"),D=r("el-form");return c(),o("div",z,[d(k,{class:"theme-switch"}),i("div",j,[q,i("div",C,[d(D,{ref_key:"loginFormRef",ref:m,model:U,rules:I,onKeyup:n(K,["enter"])},{default:t((()=>[d(s,{prop:"username"},{default:t((()=>[d(l,{modelValue:U.username,"onUpdate:modelValue":a[0]||(a[0]=e=>U.username=e),modelModifiers:{trim:!0},placeholder:"用户名",type:"text",tabindex:"1","prefix-icon":g(f),size:"large"},null,8,["modelValue","prefix-icon"])])),_:1}),d(s,{prop:"password"},{default:t((()=>[d(l,{modelValue:U.password,"onUpdate:modelValue":a[1]||(a[1]=e=>U.password=e),modelModifiers:{trim:!0},placeholder:"密码",type:"password",tabindex:"2","prefix-icon":g(_),size:"large","show-password":""},null,8,["modelValue","prefix-icon"])])),_:1}),d(s,{prop:"code"},{default:t((()=>[d(l,{modelValue:U.code,"onUpdate:modelValue":a[2]||(a[2]=e=>U.code=e),modelModifiers:{trim:!0},placeholder:"验证码",type:"text",tabindex:"3","prefix-icon":g(v),maxlength:"7",size:"large"},{append:t((()=>[d(p,{src:M.value,onClick:A,draggable:"false"},{placeholder:t((()=>[d(u,null,{default:t((()=>[d(g(x))])),_:1})])),error:t((()=>[d(u,null,{default:t((()=>[d(g(h))])),_:1})])),_:1},8,["src"])])),_:1},8,["modelValue","prefix-icon"])])),_:1}),d(y,{loading:V.value,type:"primary",size:"large",onClick:b(K,["prevent"])},{default:t((()=>[w("登 录")])),_:1},8,["loading","onClick"])])),_:1},8,["model","onKeyup"])])])])}}}),[["__scopeId","data-v-d4e76e4c"]]);export{M as default};
