import{a2 as I,E as B,_ as F,a1 as z,ab as A,o as D,B as q}from"./el-button-46177dcd.js";import{E as M,a as O}from"./el-form-item-879dedb6.js";import{E as P}from"./el-input-2a068f59.js";import{k as R,ai as U,d as N,b as j,u as Q,q as f,e as C,o as a,c as _,w as n,D as X,M as i,n as r,a as t,X as Z,V as v,f as y,r as T,N as V,O as E,F as G,Q as l,E as H,T as J,h as K,Z as L,_ as W}from"./index-b8bd6c45.js";import{a as Y}from"./request-3180202a.js";import{_ as ee}from"./_plugin-vue_export-helper-c27b6911.js";import"./castArray-edcf4c72.js";import"./index-ec296065.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 p=c,{Close:g}=z,u=j(),s=Q("alert"),k=f(!0),h=C(()=>I[p.type]),d=C(()=>[s.e("icon"),{[s.is("big")]:!!p.description||!!u.default}]),o=C(()=>({[s.is("bold")]:p.description||u.default})),m=e=>{k.value=!1,S("close",e)};return(e,w)=>(a(),_(J,{name:t(s).b("fade"),persisted:""},{default:n(()=>[X(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(B),{key:0,class:r(t(d))},{default:n(()=>[(a(),_(Z(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)])},[T(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"))},[T(e.$slots,"default",{},()=>[V(E(e.description),1)])],2)):v("v-if",!0),e.closable?(a(),y(G,{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(B),{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","/home/runner/work/element-plus/element-plus/packages/components/alert/src/alert.vue"]]);const re=K(ne);const ie=async c=>Y("/auth/login","POST",c);const ce={class:"common-layout"},ue={class:"content"},pe={class:"top"},de={class:"header"},me={class:"title"},fe={class:"login"},_e={__name:"index",setup(c){const S=L(),p=W(),g=f(null),u=f(""),s=f({username:"admin",password:"admin",remember:!1}),k=f({username:[{required:!0,message:"請輸入帳號",trigger:"blur"}],password:[{required:!0,message:"請輸入密碼",trigger:"blur"}]}),h=async d=>{d&&await d.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(d,o)=>{const m=re,e=P,w=M,$=q,x=O;return a(),y("div",ce,[i("div",ue,[i("div",pe,[i("div",de,[i("span",me,E(t(p).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"])])])])}}},Se=ee(_e,[["__scopeId","data-v-92f1aee1"]]);export{Se as default};
