import{s as c,o as f}from"./baseUrl-CEnR8jFP.js";import{d as g,a as _,c as h,b as e,u as a,N as w,w as o,Q as V,A as b,m as k,R as x,n as d,o as y,C,E as u,j as i,B as v,h as B}from"./index-oRjfHbF4.js";import{u as T}from"./index-BRiF7qcI.js";const N=n=>c.post({url:f+"/admin/login",data:n}),A={class:"w-full h-full"},L=g({__name:"index",setup(n){const m=b(),t=_({username:"",password:""});async function p(){try{k({message:"登录中...",forbidClick:!0});const{code:l,data:s}=await N(t);l==0&&(x(s.token),m.push("/home")),d()}catch(l){console.log(l),d()}}return T("登录"),(l,s)=>(y(),h("div",A,[e(a(w),{title:"登录"}),e(a(V),{onSubmit:p},{default:o(()=>[e(a(C),null,{default:o(()=>[e(a(u),null,{default:o(()=>[e(a(i),{modelValue:t.username,"onUpdate:modelValue":s[0]||(s[0]=r=>t.username=r),label:"用户名",placeholder:"请输入用户名",rules:[{required:!0,message:"请填写用户名",trigger:"change"}]},null,8,["modelValue"])]),_:1}),e(a(u),null,{default:o(()=>[e(a(i),{modelValue:t.password,"onUpdate:modelValue":s[1]||(s[1]=r=>t.password=r),label:"密码",placeholder:"请输入密码",type:"password",rules:[{required:!0,message:"请填写用户名",trigger:"change"}]},null,8,["modelValue"])]),_:1}),e(a(u),{class:"mt-[16px]"},{default:o(()=>[e(a(v),{block:"",type:"primary","native-type":"submit"},{default:o(()=>[B("登录")]),_:1})]),_:1})]),_:1})]),_:1})]))}});export{L as default};
