import{d as v,u as y,c as x,a,b as l,e as o,w as t,f as k,r as n,g as R,h as S,o as j,i as q,l as B,j as C,k as N,m as T,n as U}from"./index-p1BAR2Hc.js";import{l as A}from"./logo-DX2NYOdf.js";import{u as E}from"./auth-BqcbSIN_.js";import{_ as I}from"./_plugin-vue_export-helper-DlAUqK2U.js";const L={class:"login-view web-page"},M={class:"login-card"},z={class:"login-card__brand"},W=["src"],D=v({__name:"LoginView",setup(F){const i=E(),d=y(),f=R(),g=S(),p=N(),s=T({account:"",password:""}),w={account:[{required:!0,message:"请输入账号",trigger:"blur"}],password:[{required:!0,message:"请输入密码",trigger:"blur"}]};async function b(){var u;if(!i.loading&&await((u=p.value)==null?void 0:u.validate().catch(()=>!1)))try{await i.login(s.account,s.password),d.success("登录成功");const e=String(f.query.redirect||"/drama-projects");await g.replace(e.startsWith("/")?e:"/drama-projects")}catch(e){const r=U(e);d.error(r.message,r.copyText,"登录失败")}}return(u,e)=>{const r=n("el-icon"),m=n("el-input"),_=n("el-form-item"),V=n("el-button"),h=n("el-form");return j(),x("main",L,[a("section",M,[a("header",z,[a("span",null,[a("img",{src:l(A),alt:""},null,8,W)]),e[2]||(e[2]=a("div",null,[a("strong",null,"剧游AI")],-1))]),o(h,{ref_key:"formRef",ref:p,model:s,rules:w,"label-position":"top",size:"large",onSubmit:k(b,["prevent"])},{default:t(()=>[o(_,{label:"账号",prop:"account"},{default:t(()=>[o(m,{modelValue:s.account,"onUpdate:modelValue":e[0]||(e[0]=c=>s.account=c),modelModifiers:{trim:!0},autocomplete:"username",placeholder:"请输入账号"},{prefix:t(()=>[o(r,null,{default:t(()=>[o(l(q))]),_:1})]),_:1},8,["modelValue"])]),_:1}),o(_,{label:"密码",prop:"password"},{default:t(()=>[o(m,{modelValue:s.password,"onUpdate:modelValue":e[1]||(e[1]=c=>s.password=c),type:"password",autocomplete:"current-password","show-password":"",placeholder:"请输入密码"},{prefix:t(()=>[o(r,null,{default:t(()=>[o(l(B))]),_:1})]),_:1},8,["modelValue"])]),_:1}),o(V,{class:"login-card__submit",type:"primary","native-type":"submit",loading:l(i).loading},{default:t(()=>[...e[3]||(e[3]=[C(" 登录 ",-1)])]),_:1},8,["loading"])]),_:1},8,["model"])])])}}}),O=I(D,[["__scopeId","data-v-baf7cb26"]]);export{O as default};
