import{_ as x,o as y,c as v,a as o,b as s,w as n,d as N,r as u,u as h,e as j,t as V,f as k,E as c,g as b}from"./index-ChZz5eqd.js";import{l as I}from"./user-w7nGTEQA.js";import"./request-CnwMCDfl.js";const S={class:"min-h-screen flex items-center justify-center bg-gradient-to-br from-blue-50 to-indigo-100"},R={class:"max-w-md w-full mx-4"},z={class:"bg-white rounded-2xl shadow-xl p-8"},A={__name:"index",setup(B){const _=h(),t=k({jobNumber:"12458",password:"123456"}),w={jobNumber:[{required:!0,message:"请输入工号",trigger:"blur"}],password:[{required:!0,message:"请输入密码",trigger:"blur"},{min:6,message:"密码长度不能少于6位",trigger:"blur"}]},d=b(null),i=b(!1),p=async()=>{d.value&&await d.value.validate(async g=>{if(g){i.value=!0;try{const e=await I({jobNumber:t.jobNumber,password:t.password});if(e.success){const{user:r,loginToken:a,isAuthenticated:f,needAuthentication:m,isDefaultPassword:l}=e.data;localStorage.setItem("userInfo",JSON.stringify(r)),localStorage.setItem("jobNumber",r.jobNumber),localStorage.setItem("loginToken",a),localStorage.setItem("needAuthentication",m),localStorage.setItem("isDefaultPassword",l),c.success(e.message||"登录成功"),_.push("/dashboard")}else c.error(e.message||"登录失败")}catch(e){console.error("登录失败:",e),c.error("登录失败，请检查网络连接")}finally{i.value=!1}}})};return(g,e)=>{const r=u("el-input"),a=u("el-form-item"),f=u("el-button"),m=u("el-form");return y(),v("div",S,[o("div",R,[o("div",z,[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)),s(m,{ref_key:"loginFormRef",ref:d,model:t,rules:w,onKeyup:N(p,["enter"])},{default:n(()=>[s(a,{prop:"jobNumber"},{default:n(()=>[s(r,{modelValue:t.jobNumber,"onUpdate:modelValue":e[0]||(e[0]=l=>t.jobNumber=l),placeholder:"请输入工号",size:"large","prefix-icon":"User",clearable:""},null,8,["modelValue"])]),_:1}),s(a,{prop:"password"},{default:n(()=>[s(r,{modelValue:t.password,"onUpdate:modelValue":e[1]||(e[1]=l=>t.password=l),type:"password",placeholder:"请输入密码",size:"large","prefix-icon":"Lock","show-password":"",clearable:""},null,8,["modelValue"])]),_:1}),s(a,null,{default:n(()=>[s(f,{type:"primary",size:"large",loading:i.value,onClick:p,class:"w-full"},{default:n(()=>[j(V(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))])])])}}},F=x(A,[["__scopeId","data-v-5275f66f"]]);export{F as default};
