import{_ as e}from"./el-navbar.DVIyjZEN.js";import{C as a,a as l,r as s,b as t,d as o,e as r,f as u,w as m,g as i,v as f,z as d,l as n,ak as c,t as p,p as h,a1 as _,y,aj as v,an as w}from"./index-DVkgSHpn.js";import{_ as b}from"./el-code.niKIdtJO.js";import{_ as g,b as $,a as T}from"./el-layout._U-vZTft.js";const x=g({__name:"forget",setup(g){a(),l().getApp();const x=s(1),k=s(1),j=s(null),C=s(!0);let z=s("");const V=()=>{var e;if(!C.value)return!1;null==(e=j.value)||e.start(),A()},I=e=>{z.value=e.detail.value};let S=s(!1);const A=()=>{z.value.length<=0?uni.$layer.showToast("请输入手机号"):c(z.value)?uni.$http.post("sms/send",{scene:"password",mobile:z.value}).then((e=>{var a;e.code?S.value=!0:(uni.$layer.showToast(e.msg),null==(a=j.value)||a.stop())})):uni.$layer.showToast("您填写的手机号不正确")};let B=s(!1);const P=e=>{if(B.value)return!1;if(!1===S.value)return uni.$layer.showToast("请发送验证码"),!1;let a=e.detail.value;return a.username.length<=0?(uni.$layer.showToast("请输入手机号"),!1):a.password.length<=0?(uni.$layer.showToast("请输入密码"),!1):a.confirm_password.length<=0?(uni.$layer.showToast("请输入确认密码"),!1):a.password!=a.confirm_password?(uni.$layer.showToast("您输入的两次密码不相等"),!1):a.code.length<=0?(uni.$layer.showToast("请输入验证码"),!1):(B.value=!0,void uni.$http.post("user/forget",a).then((e=>{e.code?(uni.$layer.showToast(e.msg),p("pages/user/login",3)):(uni.$layer.showToast(e.msg),B.value=!1)})))};return(a,l)=>{const s=t(o("el-navbar"),e),c=h,p=_,g=y,z=t(o("el-code"),b),S=t(o("uni-icons"),$),A=v,R=w,U=t(o("el-layout"),T);return r(),u(U,null,{default:m((()=>[i(s,{placeholder:!0,fixed:!0,autoBack:!0,border:!0,title:"找回密码"}),i(c,{class:"the-form"},{default:m((()=>[i(R,{onSubmit:P},{default:m((()=>[i(c,{class:"form-item"},{default:m((()=>[i(c,{class:"form-item-body form-item-border"},{default:m((()=>[i(c,{class:"form-item-icon"},{default:m((()=>[f(" 手机号码 ")])),_:1}),i(c,{class:"form-item-input"},{default:m((()=>[i(p,{type:"text",name:"username",onInput:I,placeholder:"手机号","placeholder-class":"form-item-placeholder"})])),_:1})])),_:1})])),_:1}),i(c,{class:"form-item"},{default:m((()=>[i(c,{class:"form-item-body form-item-border"},{default:m((()=>[i(c,{class:"form-item-icon"},{default:m((()=>[i(g,{style:{"padding-right":"10rpx"}},{default:m((()=>[f("验 证 码")])),_:1})])),_:1}),i(c,{class:"form-item-input"},{default:m((()=>[i(p,{type:"text",name:"code",placeholder:"请输入验证码",maxlength:"6","placeholder-class":"form-item-placeholder"})])),_:1}),i(c,{class:"form-item-right"},{default:m((()=>[i(c,{onClick:V},{default:m((()=>[i(z,{modelValue:C.value,"onUpdate:modelValue":l[0]||(l[0]=e=>C.value=e),ref_key:"codeRef",ref:j,color:"#4173ff",activeColor:"#666",fontSize:"26rpx"},null,8,["modelValue"])])),_:1})])),_:1})])),_:1})])),_:1}),i(c,{class:"form-item"},{default:m((()=>[i(c,{class:"form-item-body form-item-border"},{default:m((()=>[i(c,{class:"form-item-icon"},{default:m((()=>[f(" 设置密码 ")])),_:1}),i(c,{class:"form-item-input"},{default:m((()=>[i(p,{type:1==x.value?"password":"text",name:"password",placeholder:"请输入密码","placeholder-class":"form-item-placeholder"},null,8,["type"])])),_:1}),i(c,{class:"form-item-right"},{default:m((()=>[i(S,{type:1==x.value?"eye":"eye-slash",size:"20",color:"#9fa3ab",onClick:l[1]||(l[1]=e=>x.value=1==x.value?0:1)},null,8,["type"])])),_:1})])),_:1})])),_:1}),i(c,{class:"form-item"},{default:m((()=>[i(c,{class:"form-item-body form-item-border"},{default:m((()=>[i(c,{class:"form-item-icon"},{default:m((()=>[f(" 确认密码 ")])),_:1}),i(c,{class:"form-item-input"},{default:m((()=>[i(p,{type:1==k.value?"password":"text",name:"confirm_password",placeholder:"请输入确认密码","placeholder-class":"form-item-placeholder"},null,8,["type"])])),_:1}),i(c,{class:"form-item-right"},{default:m((()=>[i(S,{type:1==k.value?"eye":"eye-slash",size:"20",color:"#9fa3ab",onClick:l[2]||(l[2]=e=>k.value=1==k.value?0:1)},null,8,["type"])])),_:1})])),_:1})])),_:1}),i(c,{class:"form-item"},{default:m((()=>[i(c,{class:"form-item-body"},{default:m((()=>[i(A,{class:d(["form-item-button",{active:1==n(B)}]),"form-type":"submit"},{default:m((()=>[f("确 定")])),_:1},8,["class"])])),_:1})])),_:1})])),_:1})])),_:1})])),_:1})}}},[["__scopeId","data-v-122703f0"]]);export{x as default};
//# sourceMappingURL=pages-user-forget.D4UIe0Z-.js.map
