import{_ as e}from"./index_173035598739.js";import{d as a,u as o,s,r as l,ak as d,c as r,e as n,o as t,f as i,P as c,g as m,N as u,Q as f,R as b,h as p,t as w,aE as v,z as g,aD as _,ai as P,U as h,V as x,aj as V,A as I,ad as k,Y as C,X as E,B as $,C as y,_ as U}from"./index_1730355987.js";import{_ as N}from"./index_173035598736.js";import{_ as j}from"./index_173035598733.js";const z={class:"page"},R={class:"page-body"},S={class:"bg-box"},O=(e=>($("data-v-777f9f8d"),e=e(),y(),e))((()=>m("h2",null,"Esqueci a senha",-1))),D={class:"goback"},F=U(a({__name:"index",setup(a){const $=o(),y=s(),U=l(60);d("$cookies");const F=d("socket"),q=r({newPassword:"",code:"",mobile:$.userInfo.mobile?$.userInfo.mobile.slice(2,$.userInfo.mobile.length):""}),A=async()=>{if(!q.mobile)return w("Por favor, introduza seu número de telefone");const e=await g.mobileCode({mobile:`${_}${q.mobile}`});if(0!=e.code)return w(e.txt);const a=setInterval((()=>{U.value--,0==U.value&&(U.value=60,clearInterval(a))}),1e3)},B=()=>{y.push("/login")},J=async()=>{let e=RegExp(/^.{6,18}$/);if(!q.mobile||!q.newPassword||!q.code)return w("Por favor, completa a informação");if(!v(q.mobile))return w("Por favor, introduza o número de telefone correto");if(!e.test(q.newPassword))return w("Por favor, introduz uma senha de 6 a 18 dígitos");const a=await g.restPassword({mobile:`${_}${q.mobile}`,pwd:q.newPassword,vCode:q.code});if(0!=a.code)return w(a.txt);P();const o=await g.login({mobile:`${_}${q.mobile}`,pwd:q.newPassword});0===o.code?(q.mobile,q.newPassword,h.setStorage(x.USER_INFO,JSON.stringify(o.data)),h.setStorage(x.USER_TOEKN,o.data.token),$.setUserInfo(o.data),F.connect().then((()=>{y.replace("/"),V()}))):w(o.txt)},K=n((()=>!(q.newPassword&&q.mobile&&q.mobile)));return(a,o)=>{const s=j,l=I,d=N,r=k,n=e;return t(),i("div",z,[c(s),m("div",R,[c(l,{src:"base/2logo.png",width:"6rem",type:"local"}),m("div",S,[O,c(d,{modelValue:q.mobile,"onUpdate:modelValue":o[0]||(o[0]=e=>q.mobile=e),maxlength:11,type:"mobile",placeholder:"Número de Celuar"},null,8,["modelValue"]),c(d,{modelValue:q.code,"onUpdate:modelValue":o[1]||(o[1]=e=>q.code=e),placeholder:"Reenviar código"},{right:u((()=>[f(m("div",{class:"send-code",onClick:A}," Enviar CODE ",512),[[b,60===U.value]]),f(m("div",{class:"count-down"},C(U.value)+"s ",513),[[b,60!==U.value]])])),_:1},8,["modelValue"]),c(d,{type:"password",placeholder:"Nova senha",modelValue:q.newPassword,"onUpdate:modelValue":o[2]||(o[2]=e=>q.newPassword=e)},null,8,["modelValue"]),c(r,{size:"large",color:"#2F6368",class:"btn",disabled:K.value,onClick:J},{default:u((()=>[E(" Modificar ")])),_:1},8,["disabled"]),m("div",D,[f(m("span",{onClick:B}," Voltar ao início de sessão ",512),[[b,!p($).userInfo.mobile]])])])]),c(n)])}}}),[["__scopeId","data-v-777f9f8d"]]);export{F as default};
