Commit 17e8a86b authored by Junling Bu's avatar Junling Bu
Browse files

update[litemall-wx]: 手机号支持验证

parent 16f2f758
var api = require('../../../config/api.js');
var check = require('../../../utils/check.js');
var app = getApp();
Page({
data: {
......@@ -65,6 +67,15 @@ Page({
return false;
}
if (!check.isValidPhone(this.data.mobile)) {
wx.showModal({
title: '错误信息',
content: '手机号输入不正确',
showCancel: false
});
return false;
}
wx.request({
url: api.AuthRegister,
data: {
......@@ -90,7 +101,13 @@ Page({
});
}
});
}
else{
wx.showModal({
title: '错误信息',
content: res.data.errmsg,
showCancel: false
});
}
}
});
......
var api = require('../../../config/api.js');
var check = require('../../../utils/check.js');
var app = getApp();
Page({
data: {
......@@ -46,6 +48,15 @@ Page({
return false;
}
if (!check.isValidPhone(this.data.mobile)) {
wx.showModal({
title: '错误信息',
content: '手机号输入不正确',
showCancel: false
});
return false;
}
if (this.data.password.length < 3) {
wx.showModal({
title: '错误信息',
......
function isValidPhone(str) {
var myreg = /^[1][3,4,5,7,8][0-9]{9}$/;
if (!myreg.test(str)) {
return false;
} else {
return true;
}
}
module.exports = {
isValidPhone
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment