import{d as P,r as w,a as b,c as v,e as s,w as a,g as d,t as x,b as V,A as y,E as i,k as h,_ as k}from"./index-CUnFTKV2.js";const C={class:"page-container"},E=P({__name:"index",setup(q){const u=w(),n=w(!1),o=b({oldPassword:"",newPassword:"",confirmPassword:""}),p={oldPassword:[{required:!0,message:"请输入原密码",trigger:"blur"},{min:6,max:20,message:"密码长度在 6 到 20 个字符",trigger:"blur"}],newPassword:[{required:!0,message:"请输入新密码",trigger:"blur"},{min:6,max:20,message:"密码长度在 6 到 20 个字符",trigger:"blur"}],confirmPassword:[{required:!0,message:"请再次输入新密码",trigger:"blur"},{validator:(m,e,r)=>{e!==o.newPassword?r(new Error("两次输入密码不一致")):r()},trigger:"blur"}]},f=async()=>{var e;if(await((e=u.value)==null?void 0:e.validate())){n.value=!0;try{await y({oldPassword:o.oldPassword,newPassword:o.newPassword}),i.success("密码修改成功"),o.oldPassword="",o.newPassword="",o.confirmPassword=""}catch(r){i.error(r.message||"修改失败")}finally{n.value=!1}}};return(m,e)=>{const r=d("el-input"),t=d("el-form-item"),c=d("el-button"),_=d("el-form"),g=d("el-card");return h(),v("div",C,[s(g,null,{header:a(()=>[...e[3]||(e[3]=[V("span",null,"修改密码",-1)])]),default:a(()=>[s(_,{ref_key:"formRef",ref:u,model:o,rules:p,"label-width":"100px",style:{"max-width":"400px"}},{default:a(()=>[s(t,{label:"原密码",prop:"oldPassword"},{default:a(()=>[s(r,{modelValue:o.oldPassword,"onUpdate:modelValue":e[0]||(e[0]=l=>o.oldPassword=l),type:"password",placeholder:"请输入原密码","show-password":""},null,8,["modelValue"])]),_:1}),s(t,{label:"新密码",prop:"newPassword"},{default:a(()=>[s(r,{modelValue:o.newPassword,"onUpdate:modelValue":e[1]||(e[1]=l=>o.newPassword=l),type:"password",placeholder:"请输入新密码","show-password":""},null,8,["modelValue"])]),_:1}),s(t,{label:"确认密码",prop:"confirmPassword"},{default:a(()=>[s(r,{modelValue:o.confirmPassword,"onUpdate:modelValue":e[2]||(e[2]=l=>o.confirmPassword=l),type:"password",placeholder:"请再次输入新密码","show-password":""},null,8,["modelValue"])]),_:1}),s(t,null,{default:a(()=>[s(c,{type:"primary",onClick:f,loading:n.value},{default:a(()=>[...e[4]||(e[4]=[x(" 确认修改 ",-1)])]),_:1},8,["loading"])]),_:1})]),_:1},8,["model"])]),_:1})])}}}),N=k(E,[["__scopeId","data-v-928c0ade"]]);export{N as default};
