
/**
 * 由 Fantastic-admin 提供技术支持
 * Powered by Fantastic-admin
 * https://fantastic-admin.github.io
 */

import{d as b,r as i,a as z,O as B,g as v,c as x,P as M,Q as R,i as n,l as T,N as $,f as L,L as N,p as l,b as e,w as t,h as g,K as A,G as F,k as h}from"./index-nGFMSQGw.js";import{_ as G}from"./index.vue_vue_type_script_setup_true_lang-DpYLhOHb.js";import{_ as I}from"./index.vue_vue_type_script_setup_true_lang-BTce45WY.js";import{u as K}from"./useMainPage-C9MASyfo.js";const O=b({name:"FixedActionBar",__name:"index",setup(y){const p=i(!1);z(()=>{d(),window.addEventListener("scroll",d)}),B(()=>{window.removeEventListener("scroll",d)});function d(){const u=document.documentElement.scrollTop||document.body.scrollTop,r=document.documentElement.clientHeight||document.body.clientHeight,o=document.documentElement.scrollHeight||document.body.scrollHeight;p.value=Math.ceil(u+r)>=o}return(u,r)=>(v(),x("div",{class:R(["fixed-action-bar bottom-0 z-4 bg-[var(--g-container-bg)] p-5 text-center transition",{shadow:!n(p)}]),"data-fixed-calc-width":""},[M(u.$slots,"default",{},void 0,!0)],2))}}),Q=T(O,[["__scopeId","data-v-9af45002"]]),j=b({__name:"edit.password",setup(y){const p=$(),d=L(),u=N(),r=i(),o=i({password:"",newpassword:"",checkpassword:""}),k=K(),V=i({password:[{required:!0,message:"请输入原密码",trigger:"blur"}],newpassword:[{required:!0,message:"请输入新密码",trigger:"blur"},{min:6,max:18,trigger:"blur",message:"密码长度为6到18位"}],checkpassword:[{required:!0,message:"请输入新密码",trigger:"blur"},{validator:(m,s,a)=>{s!==o.value.newpassword?a(new Error("两次密码不一致！")):a()}}]});function E(){r.value&&r.value.validate(m=>{if(m){const{password:s,newpassword:a}=o.value;A.passwordEdit({oldPassword:s,password:a}).then(()=>{F({type:"success",message:"修改密码成功，请重新登录"}),u.logout().then(()=>{d.push({name:"login",query:{redirect:p.fullPath}})})})}})}function C(){k.reload()}return(m,s)=>{const a=I,_=l("el-input"),w=l("el-form-item"),H=l("el-form"),U=l("el-col"),P=l("el-row"),S=G,f=l("el-button"),q=Q;return v(),x("div",null,[e(a,{title:"修改密码",content:"定期修改密码可以提高帐号安全性噢~"}),e(S,null,{default:t(()=>[e(P,null,{default:t(()=>[e(U,{md:24,lg:12},{default:t(()=>[e(H,{ref_key:"formRef",ref:r,model:n(o),rules:n(V),"label-width":"120px"},{default:t(()=>[e(w,{label:"原密码",prop:"password"},{default:t(()=>[e(_,{modelValue:n(o).password,"onUpdate:modelValue":s[0]||(s[0]=c=>n(o).password=c),type:"password",placeholder:"请输入原密码","show-password":""},null,8,["modelValue"])]),_:1}),e(w,{label:"新密码",prop:"newpassword"},{default:t(()=>[e(_,{modelValue:n(o).newpassword,"onUpdate:modelValue":s[1]||(s[1]=c=>n(o).newpassword=c),type:"password",placeholder:"请输入原密码","show-password":""},null,8,["modelValue"])]),_:1}),e(w,{label:"确认新密码",prop:"checkpassword"},{default:t(()=>[e(_,{modelValue:n(o).checkpassword,"onUpdate:modelValue":s[2]||(s[2]=c=>n(o).checkpassword=c),type:"password",placeholder:"请输入原密码","show-password":""},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1})]),_:1})]),_:1}),e(q,null,{default:t(()=>[e(f,{type:"primary",size:"large",onClick:E},{default:t(()=>[g(" 提交 ")]),_:1}),e(f,{type:"default",size:"large",onClick:C},{default:t(()=>[g(" 取消 ")]),_:1})]),_:1})])}}});typeof h=="function"&&h(j);export{j as default};
