import{_ as x,o as y,a as v,c as h,b as o,d as t,w as n,e as N,r as u,u as j,f as V,t as k,g as I,E as p,h as _}from"./index-iUtVMwIO.js";import{l as S}from"./user-W7s1uzfv.js";import"./request-Cj91lFqZ.js";const R={class:"min-h-screen flex items-center justify-center bg-gradient-to-br from-blue-50 to-indigo-100"},z={class:"max-w-md w-full mx-4"},A={class:"bg-white rounded-2xl shadow-xl p-8"},B=Object.assign({name:"Login"},{__name:"index",setup(C){const g=j(),s=I({jobNumber:"",password:""}),w={jobNumber:[{required:!0,message:"请输入工号",trigger:"blur"}],password:[{required:!0,message:"请输入密码",trigger:"blur"},{min:6,message:"密码长度不能少于6位",trigger:"blur"}]},d=_(null),i=_(!1);y(()=>{});const f=async()=>{d.value&&await d.value.validate(async b=>{if(b){i.value=!0;try{const e=await S({jobNumber:s.jobNumber,password:s.password});if(e.success){const{user:r,loginToken:a,isAuthenticated:m,needAuthentication:c,isDefaultPassword:l}=e.data;localStorage.setItem("userInfo",JSON.stringify(r)),localStorage.setItem("jobNumber",r.jobNumber),localStorage.setItem("loginToken",a),localStorage.setItem("needAuthentication",c),localStorage.setItem("isDefaultPassword",l),p.success(e.message||"登录成功"),m?g.push("/dashboard"):g.push("/profile")}else p.error(e.message||"登录失败")}catch(e){console.error("登录失败:",e),p.error("登录失败，请检查网络连接")}finally{i.value=!1}}})};return(b,e)=>{const r=u("el-input"),a=u("el-form-item"),m=u("el-button"),c=u("el-form");return v(),h("div",R,[o("div",z,[o("div",A,[e[2]||(e[2]=o("div",{class:"text-center mb-8"},[o("h1",{class:"text-3xl font-bold text-gray-800 mb-2"},"腾讯广告自动化系统"),o("p",{class:"text-gray-500"},"请使用工号和密码登录")],-1)),t(c,{ref_key:"loginFormRef",ref:d,model:s,rules:w,onKeyup:N(f,["enter"])},{default:n(()=>[t(a,{prop:"jobNumber"},{default:n(()=>[t(r,{modelValue:s.jobNumber,"onUpdate:modelValue":e[0]||(e[0]=l=>s.jobNumber=l),placeholder:"请输入工号",size:"large","prefix-icon":"User",clearable:""},null,8,["modelValue"])]),_:1}),t(a,{prop:"password"},{default:n(()=>[t(r,{modelValue:s.password,"onUpdate:modelValue":e[1]||(e[1]=l=>s.password=l),type:"password",placeholder:"请输入密码",size:"large","prefix-icon":"Lock","show-password":"",clearable:""},null,8,["modelValue"])]),_:1}),t(a,null,{default:n(()=>[t(m,{type:"primary",size:"large",loading:i.value,onClick:f,class:"w-full"},{default:n(()=>[V(k(i.value?"登录中...":"登录"),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["model"]),e[3]||(e[3]=o("div",{class:"mt-4 text-center text-sm text-gray-500"},[o("p",null,"默认密码：123456"),o("p",{class:"mt-1"},"首次登录后请及时修改密码")],-1))])])])}}}),L=x(B,[["__scopeId","data-v-8419c783"]]);export{L as default};
