regist.1b3582a3.js 3.7 KB

1
  1. import{b as B,u as D,p as x,a3 as N,k as p,o as T,h as z,A as o,j as l,f as e,D as f,ba as m,a as A,l as c,t as g}from"./index.4d3e3847.js";import{M as u,u as F}from"./user.db558d4c.js";import{u as I}from"./rule.18072557.js";import{E as C}from"./index.0b460150.js";import{u as b}from"./verifyCode.64f29492.js";import{u as _}from"./hooks.428ba1c3.js";const $={class:"w-full flex justify-between"},L=B({__name:"regist",setup(j){const{t:n}=D(),V=x(!1),i=x(!1),s=N({username:"",phone:"",verifyCode:"",password:"",repeatPassword:""}),v=x(),{isDisabled:h,text:k}=b(),R=[{validator:(w,a,t)=>{a===""?t(new Error(f(m("login.passwordSureReg")))):s.password!==a?t(new Error(f(m("login.passwordDifferentReg")))):t()},trigger:"blur"}],U=async w=>{i.value=!0,w&&await w.validate((a,t)=>{if(a)V.value?setTimeout(()=>{C.success(f(m("login.registerSuccess"))),i.value=!1},2e3):(i.value=!1,C.warning(f(m("login.tickPrivacy"))));else return i.value=!1,t})};function P(){b().end(),F().SET_CURRENTPAGE(0)}return(w,a)=>{const t=p("el-input"),d=p("el-form-item"),y=p("el-button"),E=p("el-checkbox"),S=p("el-form");return T(),z(S,{ref_key:"ruleFormRef",ref:v,model:s,rules:e(I),size:"large"},{default:o(()=>[l(e(u),null,{default:o(()=>[l(d,{rules:[{required:!0,message:e(f)(e(m)("login.usernameReg")),trigger:"blur"}],prop:"username"},{default:o(()=>[l(t,{clearable:"",modelValue:s.username,"onUpdate:modelValue":a[0]||(a[0]=r=>s.username=r),placeholder:e(n)("login.username"),"prefix-icon":e(_)("user")},null,8,["modelValue","placeholder","prefix-icon"])]),_:1},8,["rules"])]),_:1}),l(e(u),{delay:100},{default:o(()=>[l(d,{prop:"phone"},{default:o(()=>[l(t,{clearable:"",modelValue:s.phone,"onUpdate:modelValue":a[1]||(a[1]=r=>s.phone=r),placeholder:e(n)("login.phone"),"prefix-icon":e(_)("iphone")},null,8,["modelValue","placeholder","prefix-icon"])]),_:1})]),_:1}),l(e(u),{delay:150},{default:o(()=>[l(d,{prop:"verifyCode"},{default:o(()=>[A("div",$,[l(t,{clearable:"",modelValue:s.verifyCode,"onUpdate:modelValue":a[2]||(a[2]=r=>s.verifyCode=r),placeholder:e(n)("login.smsVerifyCode"),"prefix-icon":e(_)("ri:shield-keyhole-line",{online:!0})},null,8,["modelValue","placeholder","prefix-icon"]),l(y,{disabled:e(h),class:"ml-2",onClick:a[3]||(a[3]=r=>e(b)().start(v.value,"phone"))},{default:o(()=>[c(g(e(k).length>0?e(k)+e(n)("login.info"):e(n)("login.getVerifyCode")),1)]),_:1},8,["disabled"])])]),_:1})]),_:1}),l(e(u),{delay:200},{default:o(()=>[l(d,{prop:"password"},{default:o(()=>[l(t,{clearable:"","show-password":"",modelValue:s.password,"onUpdate:modelValue":a[4]||(a[4]=r=>s.password=r),placeholder:e(n)("login.password"),"prefix-icon":e(_)("lock")},null,8,["modelValue","placeholder","prefix-icon"])]),_:1})]),_:1}),l(e(u),{delay:250},{default:o(()=>[l(d,{rules:R,prop:"repeatPassword"},{default:o(()=>[l(t,{clearable:"","show-password":"",modelValue:s.repeatPassword,"onUpdate:modelValue":a[5]||(a[5]=r=>s.repeatPassword=r),placeholder:e(n)("login.sure"),"prefix-icon":e(_)("lock")},null,8,["modelValue","placeholder","prefix-icon"])]),_:1})]),_:1}),l(e(u),{delay:300},{default:o(()=>[l(d,null,{default:o(()=>[l(E,{modelValue:V.value,"onUpdate:modelValue":a[6]||(a[6]=r=>V.value=r)},{default:o(()=>[c(g(e(n)("login.readAccept")),1)]),_:1},8,["modelValue"]),l(y,{link:"",type:"primary"},{default:o(()=>[c(g(e(n)("login.privacyPolicy")),1)]),_:1})]),_:1})]),_:1}),l(e(u),{delay:350},{default:o(()=>[l(d,null,{default:o(()=>[l(y,{class:"w-full",size:"default",type:"primary",loading:i.value,onClick:a[7]||(a[7]=r=>U(v.value))},{default:o(()=>[c(g(e(n)("login.definite")),1)]),_:1},8,["loading"])]),_:1})]),_:1}),l(e(u),{delay:400},{default:o(()=>[l(d,null,{default:o(()=>[l(y,{class:"w-full",size:"default",onClick:P},{default:o(()=>[c(g(e(n)("login.back")),1)]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules"])}}});export{L as default};