You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
3.7 KiB
1 lines
3.7 KiB
import{o as a,c as t,w as e,n as s,i as l,a as o,f as i,t as m,l as c,I as d,g as n}from"./index-4ddb689d.js";import{b as u}from"./user.2171e17f.js";import{i as r,s as h}from"./captcha.e60b46e4.js";import{i as p,a as f}from"./verify.b5e41237.js";import{_ as C}from"./_plugin-vue_export-helper.1b428a4d.js";const b=C({data:()=>({isLoading:!1,captcha:{},smsState:!1,times:60,mobile:"",captchaCode:"",smsCode:""}),created(){this.getCaptcha()},methods:{getCaptcha(){const a=this;r().then((t=>a.captcha=t.data))},handelSmsCaptcha(){const a=this;a.isLoading||a.smsState||!a.formValidation(10)||(a.sendSmsCaptcha(),a.getCaptcha())},formValidation(a=10){const t=this;return!!(10!==a||t.validteMobile(t.mobile)&&t.validteCaptchaCode(t.captchaCode))&&!!(20!==a||t.validteMobile(t.mobile)&&t.validteSmsCode(t.smsCode))},validteMobile(a){return p(a)?(this.$toast("请先输入手机号"),!1):!!f(a)||(this.$toast("请输入正确格式的手机号"),!1)},validteCaptchaCode(a){return!p(a)||(this.$toast("请先输入图形验证码"),!1)},validteSmsCode(a){return!p(a)||(this.$toast("请先输入短信验证码"),!1)},sendSmsCaptcha(){const a=this;a.isLoading=!0,h({form:{captchaKey:a.captcha.key,captchaCode:a.captchaCode,mobile:a.mobile}}).then((t=>{a.$toast(t.message),a.timer()})).finally((()=>a.isLoading=!1))},timer(){const a=this;a.smsState=!0;const t=setInterval((()=>{a.times=a.times-1,a.times<=0&&(a.smsState=!1,a.times=60,clearInterval(t))}),1e3)},handleSubmit(){const a=this;!a.isLoading&&a.formValidation(20)&&a.onSubmitEvent()},onSubmitEvent(){const a=this;a.isLoading=!0,u({form:{smsCode:a.smsCode,mobile:a.mobile}}).then((t=>{a.$toast(t.message),setTimeout((()=>{a.onNavigateBack(1)}),2e3)})).finally((()=>a.isLoading=!1))},onNavigateBack(a){uni.navigateBack({delta:Number(a||1)})}}},[["render",function(u,r,h,p,f,C){const b=c,g=l,_=d,v=n;return a(),t(g,{class:"container",style:s(u.appThemeStyle)},{default:e((()=>[o(g,{class:"header"},{default:e((()=>[o(g,{class:"title"},{default:e((()=>[o(b,null,{default:e((()=>[i("绑定您的手机号")])),_:1})])),_:1}),o(g,{class:"sub-title"},{default:e((()=>[o(b,null,{default:e((()=>[i("为了更好的服务您,请绑定手机号")])),_:1})])),_:1})])),_:1}),o(g,{class:"submit-form"},{default:e((()=>[o(g,{class:"form-item"},{default:e((()=>[o(_,{class:"form-item--input",type:"number",modelValue:f.mobile,"onUpdate:modelValue":r[0]||(r[0]=a=>f.mobile=a),maxlength:"11",placeholder:"请输入手机号码"},null,8,["modelValue"])])),_:1}),o(g,{class:"form-item"},{default:e((()=>[o(_,{class:"form-item--input",type:"text",modelValue:f.captchaCode,"onUpdate:modelValue":r[1]||(r[1]=a=>f.captchaCode=a),maxlength:"5",placeholder:"请输入图形验证码"},null,8,["modelValue"]),o(g,{class:"form-item--parts"},{default:e((()=>[o(g,{class:"captcha",onClick:r[2]||(r[2]=a=>C.getCaptcha())},{default:e((()=>[o(v,{class:"image",src:f.captcha.base64},null,8,["src"])])),_:1})])),_:1})])),_:1}),o(g,{class:"form-item"},{default:e((()=>[o(_,{class:"form-item--input",type:"number",modelValue:f.smsCode,"onUpdate:modelValue":r[3]||(r[3]=a=>f.smsCode=a),maxlength:"6",placeholder:"请输入短信验证码"},null,8,["modelValue"]),o(g,{class:"form-item--parts"},{default:e((()=>[o(g,{class:"captcha-sms",onClick:r[4]||(r[4]=a=>C.handelSmsCaptcha())},{default:e((()=>[f.smsState?(a(),t(b,{key:1,class:"un-activate"},{default:e((()=>[i("重新发送("+m(f.times)+")秒",1)])),_:1})):(a(),t(b,{key:0,class:"activate"},{default:e((()=>[i("获取验证码")])),_:1}))])),_:1})])),_:1})])),_:1}),o(g,{class:"submit-button",onClick:r[5]||(r[5]=a=>C.handleSubmit())},{default:e((()=>[o(b,null,{default:e((()=>[i("确认绑定")])),_:1})])),_:1})])),_:1})])),_:1},8,["style"])}],["__scopeId","data-v-b84160a8"]]);export{b as default};
|
|
|