import{E as c,a as b}from"./el-form-item-BvJauXBe.js";import{d as V,h as y,o as x,a0 as q,p as a,m as s,t as v,e as r,A as E,y as i,r as u}from"./index-XuO881sr.js";import{b as C}from"./index-74tJTFsC.js";const $=V({__name:"resetPwd",setup(k){const{proxy:m}=y(),p=u(),o=u({oldPassword:"",newPassword:"",confirmPassword:""}),f=u({oldPassword:[{required:!0,message:"旧密码不能为空",trigger:"blur"}],newPassword:[{required:!0,message:"新密码不能为空",trigger:"blur"},{min:6,max:20,message:"长度在 6 到 20 个字符",trigger:"blur"},{pattern:/^[^<>"'|\\]+$/,message:`不能包含非法字符：< > " ' \\ |`,trigger:"blur"}],confirmPassword:[{required:!0,message:"确认密码不能为空",trigger:"blur"},{required:!0,validator:(n,e,l)=>{o.value.newPassword!==e?l(new Error("两次输入的密码不一致")):l()},trigger:"blur"}]}),P=()=>{p.value?.validate(async n=>{n&&(await C(o.value.oldPassword,o.value.newPassword),m?.$modal.msgSuccess("修改成功"))})},g=()=>{m?.$tab.closePage()};return(n,e)=>{const l=v,d=c,w=E,_=b;return x(),q(_,{ref_key:"pwdRef",ref:p,model:r(o),rules:r(f),"label-width":"80px"},{default:a(()=>[s(d,{label:"旧密码",prop:"oldPassword"},{default:a(()=>[s(l,{modelValue:r(o).oldPassword,"onUpdate:modelValue":e[0]||(e[0]=t=>r(o).oldPassword=t),placeholder:"请输入旧密码",type:"password","show-password":""},null,8,["modelValue"])]),_:1}),s(d,{label:"新密码",prop:"newPassword"},{default:a(()=>[s(l,{modelValue:r(o).newPassword,"onUpdate:modelValue":e[1]||(e[1]=t=>r(o).newPassword=t),placeholder:"请输入新密码",type:"password","show-password":""},null,8,["modelValue"])]),_:1}),s(d,{label:"确认密码",prop:"confirmPassword"},{default:a(()=>[s(l,{modelValue:r(o).confirmPassword,"onUpdate:modelValue":e[2]||(e[2]=t=>r(o).confirmPassword=t),placeholder:"请确认新密码",type:"password","show-password":""},null,8,["modelValue"])]),_:1}),s(d,null,{default:a(()=>[s(w,{type:"primary",onClick:P},{default:a(()=>[...e[3]||(e[3]=[i("保存",-1)])]),_:1}),s(w,{type:"danger",onClick:g},{default:a(()=>[...e[4]||(e[4]=[i("关闭",-1)])]),_:1})]),_:1})]),_:1},8,["model","rules"])}}});export{$ as _};
