提交 4f1be858 编写于 作者: tao.wu's avatar tao.wu

增加手机号校验逻辑

上级 faef1c52
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
data(){ data(){
return { return {
notSend: true, notSend: true,
regMobile: /^1[3456789]\d{9}$/,
mobilePhone: '', mobilePhone: '',
authCode: '', // 短信验证码 authCode: '', // 短信验证码
flag: 0, flag: 0,
...@@ -127,7 +128,10 @@ ...@@ -127,7 +128,10 @@
this.$toast('您的登录操作过于频繁,请稍后再试'); this.$toast('您的登录操作过于频繁,请稍后再试');
return; return;
} }
if(this.mobilePhone=='' || this.mobilePhone.length!=11){ const { regMobile, mobilePhone, authCode, id, taskId, activityId } = this;
const mobileTrue = regMobile.test(mobilePhone);
if(this.mobilePhone=='' || this.mobilePhone.length!=11 || !mobileTrue){
this.$toast('请输入正确的手机号'); this.$toast('请输入正确的手机号');
return; return;
} }
...@@ -140,7 +144,7 @@ ...@@ -140,7 +144,7 @@
this.$toast('请输入短信验证码'); this.$toast('请输入短信验证码');
return; return;
} }
const { mobilePhone, authCode, id, taskId, activityId } = this;
this.isReq = true; this.isReq = true;
// 调用领取课程接口 // 调用领取课程接口
getCourseById({ getCourseById({
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册