import{d as e,o as a,r as l,j as s,b as t,e as o,k as n,w as r,l as u,m as d,p,a as m,s as i}from"./index-z4UiUMlV.js";import{p as v}from"./index.Wwo-uIrA.js";import{_ as c}from"./_plugin-vue_export-helper.BCo6x5W8.js";const f=c(e({__name:"login",setup(e){a((()=>{}));const c=l(""),f=l(""),g=()=>{let e={username:c.value,password:f.value};v("/v1/auth/login",e,{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}).then((e=>{if(200===e.code){const a=e.data;localStorage.setItem("token",a),p("登录成功！"),setTimeout((()=>{m({url:"/pages/index/index"})}),500)}else i(e.msg)}))};return(e,a)=>{const l=s("van-field"),p=s("van-cell-group"),m=s("van-button"),i=s("van-form");return t(),o("div",{style:{"margin-top":"30vh"}},[n(i,{onSubmit:g},{default:r((()=>[n(p,{inset:""},{default:r((()=>[n(l,{style:{"font-size":"16px"},modelValue:c.value,"onUpdate:modelValue":a[0]||(a[0]=e=>c.value=e),name:"用户名",label:"用户名",placeholder:"用户名",rules:[{required:!0,message:"请填写用户名"}]},null,8,["modelValue"]),n(l,{style:{"font-size":"16px"},modelValue:f.value,"onUpdate:modelValue":a[1]||(a[1]=e=>f.value=e),type:"password",name:"密码",label:"密码",placeholder:"密码",rules:[{required:!0,message:"请填写密码"}]},null,8,["modelValue"])])),_:1}),u("div",{style:{margin:"16px"}},[n(m,{round:"",block:"",type:"primary","native-type":"submit"},{default:r((()=>[d(" 登录 ")])),_:1})])])),_:1})])}}}),[["__scopeId","data-v-7381730b"]]);export{f as default};
