Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
17e8a86b
Commit
17e8a86b
authored
May 12, 2018
by
Junling Bu
Browse files
update[litemall-wx]: 手机号支持验证
parent
16f2f758
Changes
3
Hide whitespace changes
Inline
Side-by-side
litemall-wx/pages/auth/register/register.js
View file @
17e8a86b
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
});
}
}
});
...
...
litemall-wx/pages/auth/reset/reset.js
View file @
17e8a86b
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
:
'
错误信息
'
,
...
...
litemall-wx/utils/check.js
0 → 100644
View file @
17e8a86b
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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment