uni_modules-uni-id-pages-pages-register-register.D5XKHlB6.js 4.7 KB

12
  1. import{_ as a,W as e,p as s,G as o,n as t,r,a as l,o as i,c as u,w as n,i as m,g as d,j as c,q as p,u as f,m as h}from"./index-BAMs4g2N.js";import{_ as g}from"./uni-match-media.DdBreTiv.js";import{_ as w}from"./uni-easyinput.BtmRbBVL.js";import{_}from"./uni-forms-item.2I4PBt0Q.js";import{_ as k}from"./uni-captcha.uBG0dSY-.js";import{_ as b}from"./uni-id-pages-agreements.DtOmCYnd.js";import{_ as V}from"./uni-forms.oA3JcH9o.js";import{r as D}from"./validator.PNYSyc5T.js";import{m as j}from"./login-page.mixin.Co1wd1R5.js";import"./uni-popup-dialog.BbzARIyH.js";import"./password.BaJrz6A0.js";const y=e.importObject("uni-id-co");const x=a({mixins:[j],data:()=>({formData:{username:"",nickname:"",password:"",password2:"",captcha:""},rules:D,focusUsername:!1,focusNickname:!1,focusPassword:!1,focusPassword2:!1,logo:"/static/logo.png"}),onReady(){this.$refs.form.setRules(this.rules)},onShow(){document.onkeydown=a=>{let e=a||window.event;e&&13==e.keyCode&&this.submit()}},methods:{submit(){this.$refs.form.validate().then((a=>4!=this.formData.captcha.length?(this.$refs.captcha.focusCaptchaInput=!0,s({title:"请输入验证码",icon:"none",duration:3e3})):this.needAgreements&&!this.agree?this.$refs.agreements.popup((()=>{this.submitForm(a)})):void this.submitForm(a))).catch((a=>{let e=a[0].key;e=e.replace(e[0],e[0].toUpperCase()),this["focus"+e]=!0}))},submitForm(a){y.registerUser(this.formData).then((a=>{this.loginSuccess(a)})).catch((a=>{console.log(a.message),this.$refs.captcha.getImageCaptcha()}))},navigateBack(){o()},toLogin(){t({url:"/uni_modules/uni-id-pages/pages/login/login-withpwd"})},registerByEmail(){t({url:"/uni_modules/uni-id-pages/pages/register/register-by-email"})}}},[["render",function(a,e,s,o,t,D){const j=p,y=m,x=f,B=r(l("uni-match-media"),g),C=r(l("uni-easyinput"),w),U=r(l("uni-forms-item"),_),v=r(l("uni-captcha"),k),P=r(l("uni-id-pages-agreements"),b),$=h,q=r(l("uni-forms"),V);return i(),u(y,{class:"uni-content"},{default:n((()=>[d(B,{"min-width":690},{default:n((()=>[d(y,{class:"login-logo"},{default:n((()=>[d(j,{src:t.logo},null,8,["src"])])),_:1}),d(x,{class:"title title-box"},{default:n((()=>[c("用户名密码注册")])),_:1})])),_:1}),d(q,{ref:"form",value:t.formData,rules:t.rules,"validate-trigger":"submit","err-show-type":"toast"},{default:n((()=>[d(U,{name:"username",required:""},{default:n((()=>[d(C,{inputBorder:!1,focus:t.focusUsername,onBlur:e[0]||(e[0]=a=>t.focusUsername=!1),class:"input-box",placeholder:"请输入用户名",modelValue:t.formData.username,"onUpdate:modelValue":e[1]||(e[1]=a=>t.formData.username=a),trim:"both"},null,8,["focus","modelValue"])])),_:1}),d(U,{name:"nickname"},{default:n((()=>[d(C,{inputBorder:!1,focus:t.focusNickname,onBlur:e[2]||(e[2]=a=>t.focusNickname=!1),class:"input-box",placeholder:"请输入用户昵称",modelValue:t.formData.nickname,"onUpdate:modelValue":e[3]||(e[3]=a=>t.formData.nickname=a),trim:"both"},null,8,["focus","modelValue"])])),_:1}),d(U,{name:"password",modelValue:t.formData.password,"onUpdate:modelValue":e[6]||(e[6]=a=>t.formData.password=a),required:""},{default:n((()=>[d(C,{inputBorder:!1,focus:t.focusPassword,onBlur:e[4]||(e[4]=a=>t.focusPassword=!1),class:"input-box",maxlength:"20",placeholder:"请输入"+("weak"==a.config.passwordStrength?"6":"8")+"-16位密码",type:"password",modelValue:t.formData.password,"onUpdate:modelValue":e[5]||(e[5]=a=>t.formData.password=a),trim:"both"},null,8,["focus","placeholder","modelValue"])])),_:1},8,["modelValue"]),d(U,{name:"password2",modelValue:t.formData.password2,"onUpdate:modelValue":e[9]||(e[9]=a=>t.formData.password2=a),required:""},{default:n((()=>[d(C,{inputBorder:!1,focus:t.focusPassword2,onBlur:e[7]||(e[7]=a=>t.focusPassword2=!1),class:"input-box",placeholder:"再次输入密码",maxlength:"20",type:"password",modelValue:t.formData.password2,"onUpdate:modelValue":e[8]||(e[8]=a=>t.formData.password2=a),trim:"both"},null,8,["focus","modelValue"])])),_:1},8,["modelValue"]),d(U,null,{default:n((()=>[d(v,{ref:"captcha",scene:"register",modelValue:t.formData.captcha,"onUpdate:modelValue":e[10]||(e[10]=a=>t.formData.captcha=a)},null,8,["modelValue"])])),_:1}),d(P,{scope:"register",ref:"agreements"},null,512),d($,{class:"uni-btn",type:"primary",onClick:D.submit},{default:n((()=>[c("注册")])),_:1},8,["onClick"]),d($,{onClick:D.navigateBack,class:"register-back"},{default:n((()=>[c("返回")])),_:1},8,["onClick"]),d(B,{"min-width":690},{default:n((()=>[d(y,{class:"link-box"},{default:n((()=>[d(x,{class:"link",onClick:D.registerByEmail},{default:n((()=>[c("邮箱验证码注册")])),_:1},8,["onClick"]),d(x,{class:"link",onClick:D.toLogin},{default:n((()=>[c("已有账号?点此登录")])),_:1},8,["onClick"])])),_:1})])),_:1})])),_:1},8,["value","rules"])])),_:1})}],["__scopeId","data-v-9ef534b4"]]);export{x as default};