import{f as v}from"./account-oOUVNXum.js";import{_ as b,r as i,c as s,o as x,d as V,e as l,f as t,k as w,q as k}from"./index-D1lsfP80.js";const F={class:"container"},P={__name:"editPassword",setup(y){const{proxy:d}=k(),o=i({oldpwd:"",newpwd:"",okpwd:""}),f=i({oldpwd:[{required:!0,message:"请输入原密码",trigger:"blur"}],newpwd:[{required:!0,message:"请输入新密码",trigger:"blur"}],okpwd:[{required:!0,message:"请再次输入新密码",trigger:"blur"},{validator:_,trigger:"blur"}]});function _(n,e,r){e!=o.value.newpwd?r(new Error("两次密码请输入一致")):r()}function m(){d.$refs.ruleFormRef.resetFields()}const c=()=>{d.$refs.ruleFormRef.validate(n=>{n&&v({oldPassword:o.value.oldpwd,password:o.value.newpwd}).then(e=>{if(e.code=="normal_002")d.$modal.msgSuccess("密码修改成功，下次请使用新密码登录。"),m();else{d.$modal.msgError(e.code);return}})})};return(n,e)=>{const r=s("el-input"),u=s("el-form-item"),p=s("el-button"),g=s("el-form");return x(),V("div",F,[l(g,{"label-position":"right","label-width":"auto",model:o.value,style:{"max-width":"600px"},ref:"ruleFormRef",rules:f.value},{default:t(()=>[l(u,{label:"原密码",prop:"oldpwd"},{default:t(()=>[l(r,{modelValue:o.value.oldpwd,"onUpdate:modelValue":e[0]||(e[0]=a=>o.value.oldpwd=a),maxlength:"25"},null,8,["modelValue"])]),_:1}),l(u,{label:"新密码",prop:"newpwd"},{default:t(()=>[l(r,{modelValue:o.value.newpwd,"onUpdate:modelValue":e[1]||(e[1]=a=>o.value.newpwd=a),maxlength:"25"},null,8,["modelValue"])]),_:1}),l(u,{label:"确认新密码",prop:"okpwd"},{default:t(()=>[l(r,{modelValue:o.value.okpwd,"onUpdate:modelValue":e[2]||(e[2]=a=>o.value.okpwd=a),maxlength:"25"},null,8,["modelValue"])]),_:1}),l(p,{type:"primary",onClick:c},{default:t(()=>[w("提交")]),_:1}),l(p,{onClick:m},{default:t(()=>[w("重置")]),_:1})]),_:1},8,["model","rules"])])}}},q=b(P,[["__scopeId","data-v-7b79a48e"]]);export{q as default};
