import{ad as I,E as T,_ as F,ac as z,ak as A,w as D,G as q}from"./el-button-7b435908.js";import{E as M,a as O}from"./el-form-item-563dc716.js";import{E as P}from"./el-input-5a355fec.js";import{k as R,ai as U,d as N,b as j,u as G,q as f,e as C,o as a,c as _,w as n,D as Q,M as i,n as r,a as t,X,V as v,f as y,r as B,N as V,O as E,F as Z,Q as l,E as H,T as J,h as K,Z as L,_ as W}from"./index-11843334.js";import{a as Y}from"./request-79887494.js";import{_ as ee}from"./_plugin-vue_export-helper-c27b6911.js";import"./castArray-80791487.js";import"./index-58150f7d.js";import"./_baseClone-07904f92.js";const se=["light","dark"],te=R({title:{type:String,default:""},description:{type:String,default:""},type:{type:String,values:U(I),default:"info"},closable:{type:Boolean,default:!0},closeText:{type:String,default:""},showIcon:Boolean,center:Boolean,effect:{type:String,values:se,default:"light"}}),oe={close:c=>c instanceof MouseEvent},ae=N({name:"ElAlert"}),le=N({...ae,props:te,emits:oe,setup(c,{emit:S}){const d=c,{Close:g}=z,u=j(),s=G("alert"),k=f(!0),h=C(()=>I[d.type]),p=C(()=>[s.e("icon"),{[s.is("big")]:!!d.description||!!u.default}]),o=C(()=>({[s.is("bold")]:d.description||u.default})),m=e=>{k.value=!1,S("close",e)};return(e,w)=>(a(),_(J,{name:t(s).b("fade"),persisted:""},{default:n(()=>[Q(i("div",{class:r([t(s).b(),t(s).m(e.type),t(s).is("center",e.center),t(s).is(e.effect)]),role:"alert"},[e.showIcon&&t(h)?(a(),_(t(T),{key:0,class:r(t(p))},{default:n(()=>[(a(),_(X(t(h))))]),_:1},8,["class"])):v("v-if",!0),i("div",{class:r(t(s).e("content"))},[e.title||e.$slots.title?(a(),y("span",{key:0,class:r([t(s).e("title"),t(o)])},[B(e.$slots,"title",{},()=>[V(E(e.title),1)])],2)):v("v-if",!0),e.$slots.default||e.description?(a(),y("p",{key:1,class:r(t(s).e("description"))},[B(e.$slots,"default",{},()=>[V(E(e.description),1)])],2)):v("v-if",!0),e.closable?(a(),y(Z,{key:2},[e.closeText?(a(),y("div",{key:0,class:r([t(s).e("close-btn"),t(s).is("customed")]),onClick:m},E(e.closeText),3)):(a(),_(t(T),{key:1,class:r(t(s).e("close-btn")),onClick:m},{default:n(()=>[l(t(g))]),_:1},8,["class"]))],64)):v("v-if",!0)],2)],2),[[H,k.value]])]),_:3},8,["name"]))}});var ne=F(le,[["__file","alert.vue"]]);const re=K(ne);const ie=async c=>Y("/auth/login","POST",c);const ce={class:"common-layout"},ue={class:"content"},de={class:"top"},pe={class:"header"},me={class:"title"},fe={class:"login"},_e={__name:"index",setup(c){const S=L(),d=W(),g=f(null),u=f(""),s=f({username:"",password:"",remember:!1}),k=f({username:[{required:!0,message:"請輸入帳號",trigger:"blur"}],password:[{required:!0,message:"請輸入密碼",trigger:"blur"}]}),h=async p=>{p&&await p.validate(async(o,m)=>{if(o){let e=await ie(s.value);if(e.code!==200){u.value=e.data;return}sessionStorage.setItem("token",e.data.token),S.push("/home")}})};return(p,o)=>{const m=re,e=P,w=M,$=q,x=O;return a(),y("div",ce,[i("div",ue,[i("div",de,[i("div",pe,[i("span",me,E(t(d).systemName),1)])]),i("div",fe,[l(x,{ref_key:"formRef",ref:g,model:s.value,rules:k.value,class:"ruleForm","status-icon":""},{default:n(()=>[u.value?(a(),_(m,{key:0,type:"error",closable:!0,title:u.value,showIcon:"",style:{"margin-bottom":"24px"}},null,8,["title"])):v("",!0),l(w,{prop:"username"},{default:n(()=>[l(e,{autocomplete:"autocomplete",size:"large",modelValue:s.value.username,"onUpdate:modelValue":o[0]||(o[0]=b=>s.value.username=b),placeholder:"請輸入登入帳號","prefix-icon":t(A)},null,8,["modelValue","prefix-icon"])]),_:1}),l(w,{prop:"password"},{default:n(()=>[l(e,{type:"password",size:"large",modelValue:s.value.password,"onUpdate:modelValue":o[1]||(o[1]=b=>s.value.password=b),placeholder:"請輸入登入密碼","prefix-icon":t(D),"show-password":""},null,8,["modelValue","prefix-icon"])]),_:1}),l(w,null,{default:n(()=>[l($,{style:{width:"100%","margin-top":"24px"},size:"large",type:"primary",onClick:o[2]||(o[2]=b=>h(g.value))},{default:n(()=>[V(" 登入 ")]),_:1})]),_:1})]),_:1},8,["model","rules"])])])])}}},Ce=ee(_e,[["__scopeId","data-v-991082d0"]]);export{Ce as default};
