import{Z as e,X as a,u as s,d as r,q as t,c as o,w as d,i as l,o as i,t as m,a0 as u,v as n}from"./index-DL8B2Mxu.js";import{_ as p}from"./u-input.B4n5960Q.js";import{r as c}from"./uni-app.es.BSVEa1f2.js";import{_ as h,a as b}from"./u-form.UL3ywNK9.js";import{_ as w}from"./u-image.HgEtCXEr.js";import{_ as f}from"./u-button.D-oh2uo-.js";import{m as g}from"./md5.6s00qotZ.js";import{_ as F}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./u-icon.CLOPtL2B.js";import"./emitter.DrjJCwnj.js";const L=F({data(){return{imgUrl:"",timestamp:"",dataForm:{oldPassword:"",password:"",repeatPsd:"",code:"",timestamp:""},baseForm:{passwordStrengthLimit:0,passwordLengthMin:!1,passwordLengthMinNumber:0,containsNumbers:!1,includeLowercaseLetters:!1,includeUppercaseLetters:!1,containsCharacters:!1},rules:{oldPassword:[{required:!0,message:"旧密码不能为空",trigger:"blur"}],password:[{required:!0,validator:(e,a,s)=>{const r=/[0-9]+/,t=/[a-z]+/,o=/[A-Z]+/,d=/\W/;""===a?s(new Error("新密码不能为空")):1==this.baseForm.passwordStrengthLimit?(this.baseForm.passwordLengthMin&&a.length<this.baseForm.passwordLengthMinNumber&&s(new Error("新密码长度不能小于"+this.baseForm.passwordLengthMinNumber+"位")),this.baseForm.containsNumbers&&(r.test(a)||s(new Error("新密码必须包含数字"))),this.baseForm.includeLowercaseLetters&&(t.test(a)||s(new Error("新密码必须包含小写字母"))),this.baseForm.includeUppercaseLetters&&(o.test(a)||s(new Error("新密码必须包含大写字字母"))),this.baseForm.containsCharacters&&(d.test(a)||s(new Error("新密码必须包含字符"))),s()):s()},trigger:"blur"}],repeatPsd:[{required:!0,validator:(e,a,s)=>{""===a?s(new Error("重复密码不能为空")):a!==this.dataForm.password?s(new Error("两次密码输入不一致")):s()},trigger:"blur"}],code:[{required:!0,message:"验证码不能为空",trigger:"blur"}]}}},computed:{baseURL(){return this.define.baseURL}},onLoad(){this.changeCode(),this.initData()},mounted(){this.$refs.dataForm.setRules(this.rules)},methods:{initData(){this.$nextTick((()=>{e().then((e=>{this.baseForm=e.data,this.baseForm.passwordLengthMin=!!this.baseForm.passwordLengthMin,this.baseForm.containsNumbers=!!this.baseForm.containsNumbers,this.baseForm.includeLowercaseLetters=!!this.baseForm.includeLowercaseLetters,this.baseForm.includeUppercaseLetters=!!this.baseForm.includeUppercaseLetters,this.baseForm.containsCharacters=!!this.baseForm.containsCharacters})).catch((()=>{}))}))},changeCode(){let e=Math.random();this.timestamp=e,this.imgUrl=`/api/file/ImageCode/${e}`},dataFormSubmit(){this.$refs.dataForm.validate((e=>{if(e){let e={oldPassword:g.md5(this.dataForm.oldPassword),password:g.md5(this.dataForm.password),code:this.dataForm.code,timestamp:this.timestamp};a(e).then((e=>{this.$u.toast(e.msg);s().logout().then((()=>{r({url:"/pages/login/index"})}))})).catch((()=>{this.changeImg()}))}}))}}},[["render",function(e,a,s,r,g,F){const L=c(t("u-input"),p),_=c(t("u-form-item"),h),U=l,j=c(t("u-image"),w),C=c(t("u-form"),b),P=c(t("u-button"),f);return i(),o(U,{class:"jnpf-wrap jnpf-wrap-workflow"},{default:d((()=>[m(U,{class:"",style:{"background-color":"#fff"}},{default:d((()=>[m(C,{model:g.dataForm,rules:g.rules,ref:"dataForm",errorType:["toast"],"label-position":"left","label-width":"150","label-align":"left"},{default:d((()=>[m(U,{class:"u-p-l-20 u-p-r-20"},{default:d((()=>[m(_,{label:"旧密码",prop:"oldPassword",required:""},{default:d((()=>[m(L,{modelValue:g.dataForm.oldPassword,"onUpdate:modelValue":a[0]||(a[0]=e=>g.dataForm.oldPassword=e),placeholder:"请输入",type:"password"},null,8,["modelValue"])])),_:1})])),_:1}),m(U,{class:"u-p-l-20 u-p-r-20"},{default:d((()=>[m(_,{label:"新密码",prop:"password",required:""},{default:d((()=>[m(L,{modelValue:g.dataForm.password,"onUpdate:modelValue":a[1]||(a[1]=e=>g.dataForm.password=e),placeholder:"请输入",type:"password"},null,8,["modelValue"])])),_:1})])),_:1}),m(U,{class:"u-p-l-20 u-p-r-20"},{default:d((()=>[m(_,{label:"重复密码",prop:"repeatPsd",required:""},{default:d((()=>[m(L,{modelValue:g.dataForm.repeatPsd,"onUpdate:modelValue":a[2]||(a[2]=e=>g.dataForm.repeatPsd=e),placeholder:"请输入",type:"password"},null,8,["modelValue"])])),_:1})])),_:1}),m(U,{class:"u-p-l-20 u-p-r-20"},{default:d((()=>[m(_,{label:"验证码",prop:"code",required:""},{default:d((()=>[m(U,{class:"u-flex"},{default:d((()=>[m(L,{modelValue:g.dataForm.code,"onUpdate:modelValue":a[3]||(a[3]=e=>g.dataForm.code=e),placeholder:"请输入"},null,8,["modelValue"]),m(U,{style:{flex:"0.1"}},{default:d((()=>[m(j,{showLoading:!0,src:F.baseURL+g.imgUrl,width:"130px",height:"38px",onClick:F.changeCode},null,8,["src","onClick"])])),_:1})])),_:1})])),_:1})])),_:1})])),_:1},8,["model","rules"])])),_:1}),m(U,{class:"flowBefore-actions"},{default:d((()=>[m(P,{class:"buttom-btn",type:"primary",onClick:u(F.dataFormSubmit,["stop"])},{default:d((()=>[n("保存")])),_:1},8,["onClick"])])),_:1})])),_:1})}],["__scopeId","data-v-2ba9193d"]]);export{L as default};
