Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
dev
/
pingan-life-index-pro
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
37922210
authored
2020-04-09 19:59:09 +0800
by
joe
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
登录页增加校验
1 parent
bc5307fa
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
5 deletions
src/pages/login/login.js
src/pages/login/login.vue
src/utils/utils.js
src/pages/login/login.js
View file @
3792221
...
...
@@ -11,8 +11,6 @@ import {
}
from
'@/api/fetch-api.js'
import
{
contactMethodCheck
,
checkVerifyCode
}
from
'@utils/utils.js'
;
import
modalComp
from
'@/components/modal-comp/modal-comp.vue'
;
import
modalSimpleComp
from
'@/components/modal-simple-comp/modal-simple-comp.vue'
;
import
modalProtocolComp
from
'@/components/modal-protocol-comp/modal-protocol-comp.vue'
;
...
...
@@ -20,6 +18,9 @@ import modalUploadCardComp from '@/components/modal-upload-card-comp/modal-uploa
import
{
passwordEncrypt
}
from
'@/utils/encrypt.js'
;
import
{
contactMethodCheck
,
checkVerifyCode
}
from
'@utils/utils.js'
;
import
Vue
from
'vue'
;
import
{
Loading
}
from
'vant'
;
...
...
@@ -114,7 +115,17 @@ export default {
let
b1
=
!
this
.
loginCheck
.
agreeProtocol
;
let
b2
=
!
this
.
loginForm
.
userId
;
let
b3
=
!
this
.
loginForm
.
password
;
return
b1
||
b2
||
b3
;
let
b
=
b1
||
b2
||
b3
;
if
(
this
.
oneAccountCenterOff
&&
!
b
)
{
let
mobile
=
this
.
loginForm
.
userId
;
let
m1
=
!
contactMethodCheck
(
'hkmobile'
,
mobile
);
let
m2
=
!
contactMethodCheck
(
'mobile'
,
mobile
);
b
=
b
||
m1
||
m2
;
}
return
b
;
},
otpLoginDisabled
()
{
let
b1
=
!
this
.
loginCheck
.
agreeProtocol
;
...
...
@@ -237,6 +248,17 @@ export default {
}
}
},
userIdLegalCheck
()
{
let
mobile
=
this
.
loginForm
.
userId
;
let
m1
=
contactMethodCheck
(
'hkmobile'
,
mobile
);
let
m2
=
contactMethodCheck
(
'mobile'
,
mobile
);
// console.log("userIdLegalCheck:", m1, m2)
if
(
!
m1
&&
!
m2
)
{
this
.
_showMobileNoIllegalTip
()
return
false
;
}
return
true
;
},
selfLogin
()
{
if
(
this
.
pwdLoginDisabled
)
{
return
;
...
...
@@ -508,6 +530,8 @@ export default {
_showMobileNoIllegalTip
()
{
let
message
=
this
.
i18n
.
login
.
tips
.
oe0
;
this
.
errorTips
.
oe1
=
message
;
if
(
this
.
oneAccountCenterOff
)
this
.
errorTips
.
e1
=
message
;
// alert("手机号不正确");
},
_startStdSendOTP
()
{
...
...
src/pages/login/login.vue
View file @
3792221
...
...
@@ -36,7 +36,7 @@
<img
src=
"@/assets/images/login/icon-login-user.png"
>
{{$t('login.account')}}
</div>
<div
class=
"ipt-wrap"
>
<input
v-model=
"loginForm.userId"
:placeholder=
"$t('login.accountPlaceholder')"
class=
"ipt"
:class=
"{ err : errorTips.e1.length > 0 }"
type=
"text"
>
<input
v-model=
"loginForm.userId"
:placeholder=
"$t('login.accountPlaceholder')"
class=
"ipt"
:class=
"{ err : errorTips.e1.length > 0 }"
type=
"text"
@
blur=
"userIdLegalCheck"
>
</div>
<div
class=
"validator"
v-if=
"errorTips.e1.length > 0 "
>
<img
src=
"@/assets/images/common/icon-notice.png"
alt=
""
>
{{errorTips.e1}}
...
...
src/utils/utils.js
View file @
3792221
...
...
@@ -267,7 +267,7 @@ export function contactMethodCheck(type, value) {
if
(
type
==
'mobile'
)
{
// return /^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(166)|(17[0-9])|(18[0-9])|(19[0-9]))\d{8}$/.test(value);
return
/^1
\d{10}
$/
.
test
(
value
);
return
/^
(\+)?(
86
)?(\-)?
1
\d{10}
$/
.
test
(
value
);
}
if
(
type
==
'email'
)
{
...
...
Please
register
or
sign in
to post a comment