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
db98d45f
authored
2020-05-11 16:20:36 +0800
by
joe
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
接入短信验证码
1 parent
9747be9d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
153 additions
and
66 deletions
src/api/api.js
src/pages/login/login.js
src/pages/login/login.vue
src/api/api.js
View file @
db98d45
...
...
@@ -92,5 +92,7 @@ module.exports = {
// 为了香港上线而增加的身份自行管理接口
doLoginV2
:
"/pingan_hklife_webapi/user/loginv2"
,
doRegisterV2
:
"/pingan_hklife_webapi/user/registerv2"
doRegisterV2
:
"/pingan_hklife_webapi/user/registerv2"
,
// 刷新短信验证码
refreshSmgOtp
:
"/pingan_hklife_webapi/user/refreshSmgOtp"
}
...
...
src/pages/login/login.js
View file @
db98d45
...
...
@@ -123,12 +123,20 @@ export default {
let
b3
=
!
this
.
loginForm
.
password
;
let
b
=
b1
||
b2
||
b3
;
return
b
;
},
pwdLoginDisabledOneAccountCenterOff
()
{
let
b1
=
!
this
.
loginCheck
.
agreeProtocol
;
let
b2
=
!
this
.
loginForm
.
userId
;
let
b3
=
!
this
.
loginForm
.
password
;
let
b4
=
!
this
.
loginForm
.
otp
;
let
b
=
b1
||
b2
||
b3
||
b4
;
if
(
this
.
oneAccountCenterOff
&&
!
b
)
{
if
(
!
b
)
{
let
mobile
=
this
.
loginForm
.
userId
;
let
m1
=
contactMethodCheck
(
'hkmobile'
,
mobile
);
let
m2
=
contactMethodCheck
(
'mobile'
,
mobile
);
console
.
log
(
b
,
m1
,
m2
)
b
=
b
||
!
(
m1
||
m2
);
}
...
...
@@ -167,11 +175,11 @@ export default {
this
.
modalSimpleVisiable
=
false
;
this
.
modalProtocolVisiable
=
false
;
},
onCheckHandler
()
{},
onCheckHandler
()
{
},
onProtocolHandler
()
{
this
.
modalProtocolVisiable
=
true
;
},
onSubmitHandler
()
{},
onSubmitHandler
()
{
},
toRegisterPage
()
{
this
.
$router
.
push
({
path
:
"/register"
...
...
@@ -231,22 +239,18 @@ export default {
// 刷新图形二维码
},
handlerLogin
()
{
if
(
this
.
oneAccountCenterOff
)
{
this
.
selfLogin
();
if
((
this
.
type
==
1
&&
this
.
pwdLoginDisabled
)
||
(
this
.
type
==
2
&&
this
.
otpLoginDisabled
))
{
return
;
}
this
.
refreshDeviceId
();
if
(
!
this
.
loginCheck
.
agreeProtocol
)
{
this
.
_showAgreeProtocalTips
();
return
;
}
if
(
this
.
type
==
1
)
{
this
.
_passwordLogin
();
}
else
{
if
((
this
.
type
==
1
&&
this
.
pwdLoginDisabled
)
||
(
this
.
type
==
2
&&
this
.
otpLoginDisabled
))
{
return
;
}
this
.
refreshDeviceId
();
if
(
!
this
.
loginCheck
.
agreeProtocol
)
{
this
.
_showAgreeProtocalTips
();
return
;
}
if
(
this
.
type
==
1
)
{
this
.
_passwordLogin
();
}
else
{
this
.
_otpLogin
();
}
this
.
_otpLogin
();
}
},
userIdLegalCheck
()
{
...
...
@@ -260,8 +264,8 @@ export default {
}
return
true
;
},
// 登陆
selfLogin
()
{
//
不接入一账通
登陆
pwdLoginWhenOneAccountCenterOff
()
{
if
(
this
.
pwdLoginDisabled
)
{
return
;
}
...
...
@@ -271,7 +275,8 @@ export default {
this
.
loading
=
true
;
let
data
=
{
account
:
this
.
loginForm
.
userId
,
password
:
this
.
loginForm
.
password
password
:
this
.
loginForm
.
password
,
otp
:
this
.
loginForm
.
otp
};
httpPost
({
url
:
api
.
doLoginV2
,
...
...
@@ -286,6 +291,9 @@ export default {
case
404
:
this
.
errorTips
.
e2
=
this
.
i18n
.
login
.
tips
.
e5
;
break
;
case
1104
:
this
.
errorTips
.
oe2
=
this
.
i18n
.
login
.
tips
.
oe4
;
break
;
case
1102
:
this
.
errorTips
.
e2
=
this
.
i18n
.
login
.
tips
.
e6
;
break
;
...
...
@@ -294,7 +302,32 @@ export default {
break
;
}
})
},
sendOTPWhenOneAccountCenterOff
()
{
// 发送短信验证码
let
m1
=
contactMethodCheck
(
'hkmobile'
,
this
.
loginForm
.
userId
);
let
m2
=
contactMethodCheck
(
'mobile'
,
this
.
loginForm
.
userId
);
if
(
!
m1
&&
!
m2
)
{
this
.
_showMobileNoIllegalTip
();
return
;
}
if
(
this
.
times
.
remain
>
0
)
{
return
;
}
let
data
=
{
mobile
:
this
.
loginForm
.
userId
,
lan
:
this
.
locale
}
this
.
_startTimeClick
();
httpPost
({
url
:
api
.
refreshSmgOtp
,
data
:
data
}).
then
(
res
=>
{
}).
catch
(
e
=>
{
console
.
error
(
e
);
})
},
// 刷新图形二维码
_passwordLogin
()
{
...
...
src/pages/login/login.vue
View file @
db98d45
...
...
@@ -24,60 +24,112 @@
<div
class=
"login-nav-v-line"
></div>
<div
@
click=
"onLoginTypeHandler(2)"
class=
"login-nav-tit pointer"
>
{{
$t
(
'login.loginType2'
)
}}
</div>
</div>
<div
class=
"gird-g form"
>
<div
class=
"pure-u-1 form-item"
>
<div
class=
"label"
>
<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" @blur="userIdLegalCheck">
</div>
<div
class=
"validator"
v-if=
"errorTips.e1.length > 0 "
>
<img
src=
"@/assets/images/common/icon-notice.png"
alt=
""
>
{{
errorTips
.
e1
}}
</div>
</div>
<div
class=
"pure-u-1 form-item"
>
<div
class=
"label"
>
<img
src=
"@/assets/images/login/icon-login-password.png"
>
{{
$t
(
'login.password'
)
}}
</div>
<div
class=
"ipt-wrap"
>
<input
v-model=
"loginForm.password"
:placeholder=
"$t('login.passwordPlaceholder')"
class=
"ipt"
:class=
"
{ err : errorTips.e2.length > 0 }" type="password">
</div>
<div
class=
"validator"
v-if=
"errorTips.e2.length > 0 "
>
<img
src=
"@/assets/images/common/icon-notice.png"
alt=
""
>
{{
errorTips
.
e2
}}
</div>
</div>
<div
class=
"pure-u-1 form-item"
v-if=
"type == 1 && loginCheck.showImageCode"
>
<div
class=
"ipt-wrap"
>
<input
:placeholder=
"$t('login.verifyPlaceholder')"
class=
"ipt ipt-verify"
:class=
"
{ err : errorTips.e3.length > 0 }" type="text" v-model="loginForm.imageValue">
<div
class=
"ipt verify-btn pointer vcode"
@
click=
"handlerRefreshImageValue"
>
<img
:src=
"values.imageBase64"
>
</div>
</div>
<div
class=
"validator"
v-if=
"errorTips.e3.length > 0 "
>
<img
src=
"@/assets/images/common/icon-notice.png"
alt=
""
>
{{
errorTips
.
e3
}}
</div>
</div>
</div>
<div
class=
"login-protocol pointer"
:class=
"
{loginLeft:locale!='en'}" @click="loginCheck.agreeProtocol = !loginCheck.agreeProtocol">
<img
v-if=
"!loginCheck.agreeProtocol"
class=
"check"
src=
"@/assets/images/login/uncheck.png"
>
<img
v-if=
"loginCheck.agreeProtocol"
class=
"check"
src=
"@/assets/images/login/check.png"
>
{{
$t
(
'login.agree'
)
}}
<span
@
click=
"onProtocolHandler()"
class=
"protocol pointer"
>
{{
$t
(
'login.protocol'
)
}}
</span>
</div>
<div
@
click=
"handlerLogin()"
class=
"login-submit pointer flex-center"
:class=
"
{disabled: pwdLoginDisabled}">
<van-loading
v-if=
"loading"
/>
<span>
{{
$t
(
'login.login'
)
}}
</span>
</div>
<div
class=
"login-func"
>
<div
@
click=
"toRegisterPage()"
class=
"login-func-btn pointer"
>
{{
$t
(
'login.register'
)
}}
</div>
<div
@
click=
"onForgetHandler()"
class=
"login-func-btn pointer"
>
{{
$t
(
'login.forget'
)
}}
</div>
</div>
</
template
>
<
template
v-else
>
<!-- 不接入一账通 -->
<div
class=
"login-nav"
>
<div
class=
"login-nav-tit text-c pointer active"
>
{{
$t
(
'login.loginType1'
)
}}
</div>
</div>
</
template
>
<div
class=
"gird-g form"
>
<div
class=
"pure-u-1 form-item"
>
<div
class=
"label"
>
<img
src=
"@/assets/images/login/icon-login-user.png"
>
{{$t('login.account')}}
<div
class=
"gird-g form"
>
<div
class=
"pure-u-1 form-item"
>
<div
class=
"label"
>
<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" @blur="userIdLegalCheck">
</div>
<div
class=
"validator"
v-if=
"errorTips.e1.length > 0 "
>
<img
src=
"@/assets/images/common/icon-notice.png"
alt=
""
>
{{
errorTips
.
e1
}}
</div>
</div>
<div
class=
"ipt-wrap"
>
<input
v-model=
"loginForm.userId"
:placeholder=
"$t('login.accountPlaceholder')"
class=
"ipt"
:class=
"{ err : errorTips.e1.length > 0 }"
type=
"text"
@
blur=
"userIdLegalCheck"
>
<div
class=
"pure-u-1 form-item"
>
<div
class=
"label"
>
<img
src=
"@/assets/images/login/icon-login-password.png"
>
{{
$t
(
'login.password'
)
}}
</div>
<div
class=
"ipt-wrap"
>
<input
v-model=
"loginForm.password"
:placeholder=
"$t('login.passwordPlaceholder')"
class=
"ipt"
:class=
"
{ err : errorTips.e2.length > 0 }" type="password">
</div>
<div
class=
"validator"
v-if=
"errorTips.e2.length > 0 "
>
<img
src=
"@/assets/images/common/icon-notice.png"
alt=
""
>
{{
errorTips
.
e2
}}
</div>
</div>
<div
class=
"validator"
v-if=
"errorTips.e1.length > 0 "
>
<img
src=
"@/assets/images/common/icon-notice.png"
alt=
""
>
{{errorTips.e1}}
<div
class=
"pure-u-1 form-item"
>
<div
class=
"label"
>
<img
src=
"@/assets/images/login/icon-login-message.png"
>
{{
$t
(
'login.verifyCode'
)
}}
</div>
<div
class=
"ipt-wrap"
>
<div
class=
"ipt ipt2"
:class=
"
{ err : errorTips.oe2.length > 0 }">
<input
:placeholder=
"$t('login.verifyCodePlaceholder')"
class=
"ipt-code"
type=
"text"
v-model=
"loginForm.otp"
>
<div
v-if=
"times.remain == 0"
class=
"veri-btn pointer"
@
click=
"sendOTPWhenOneAccountCenterOff"
>
{{
$t
(
'register.verifyCodeGet'
)
}}
</div>
<div
v-else
class=
"veri-btn-default"
>
{{
times
.
tip
}}
</div>
</div>
</div>
<div
class=
"validator"
v-if=
"errorTips.oe2.length > 0 "
>
<img
src=
"@/assets/images/common/icon-notice.png"
alt=
""
>
{{
errorTips
.
oe2
}}
</div>
</div>
</div>
<div
class=
"pure-u-1 form-item"
>
<div
class=
"label"
>
<img
src=
"@/assets/images/login/icon-login-password.png"
>
{{$t('login.password')}}
</div>
<div
class=
"ipt-wrap"
>
<input
v-model=
"loginForm.password"
:placeholder=
"$t('login.passwordPlaceholder')"
class=
"ipt"
:class=
"{ err : errorTips.e2.length > 0 }"
type=
"password"
>
</div>
<div
class=
"validator"
v-if=
"errorTips.e2.length > 0 "
>
<img
src=
"@/assets/images/common/icon-notice.png"
alt=
""
>
{{errorTips.e2}}
</div>
<div
class=
"login-protocol pointer"
:class=
"
{loginLeft:locale!='en'}" @click="loginCheck.agreeProtocol = !loginCheck.agreeProtocol">
<img
v-if=
"!loginCheck.agreeProtocol"
class=
"check"
src=
"@/assets/images/login/uncheck.png"
>
<img
v-if=
"loginCheck.agreeProtocol"
class=
"check"
src=
"@/assets/images/login/check.png"
>
{{
$t
(
'login.agree'
)
}}
<span
@
click=
"onProtocolHandler()"
class=
"protocol pointer"
>
{{
$t
(
'login.protocol'
)
}}
</span>
</div>
<div
class=
"pure-u-1 form-item"
v-if=
"type == 1 && loginCheck.showImageCode"
>
<div
class=
"ipt-wrap"
>
<input
:placeholder=
"$t('login.verifyPlaceholder')"
class=
"ipt ipt-verify"
:class=
"{ err : errorTips.e3.length > 0 }"
type=
"text"
v-model=
"loginForm.imageValue"
>
<div
class=
"ipt verify-btn pointer vcode"
@
click=
"handlerRefreshImageValue"
>
<img
:src=
"values.imageBase64"
>
</div>
</div>
<div
class=
"validator"
v-if=
"errorTips.e3.length > 0 "
>
<img
src=
"@/assets/images/common/icon-notice.png"
alt=
""
>
{{errorTips.e3}}
</div>
<div
@
click=
"pwdLoginWhenOneAccountCenterOff()"
class=
"login-submit pointer flex-center"
:class=
"
{disabled: pwdLoginDisabledOneAccountCenterOff}">
<van-loading
v-if=
"loading"
/>
<span>
{{
$t
(
'login.login'
)
}}
</span>
</div>
</div>
<div
class=
"login-protocol pointer"
:class=
"{loginLeft:locale!='en'}"
@
click=
"loginCheck.agreeProtocol = !loginCheck.agreeProtocol"
>
<img
v-if=
"!loginCheck.agreeProtocol"
class=
"check"
src=
"@/assets/images/login/uncheck.png"
>
<img
v-if=
"loginCheck.agreeProtocol"
class=
"check"
src=
"@/assets/images/login/check.png"
>
{{$t('login.agree')}}
<span
@
click=
"onProtocolHandler()"
class=
"protocol pointer"
>
{{$t('login.protocol')}}
</span>
</div>
<div
@
click=
"handlerLogin()"
class=
"login-submit pointer flex-center"
:class=
"{disabled: pwdLoginDisabled}"
>
<van-loading
v-if=
"loading"
/>
<span>
{{$t('login.login')}}
</span>
</div>
<div
class=
"login-func"
>
<div
@
click=
"toRegisterPage()"
class=
"login-func-btn pointer"
>
{{$t('login.register')}}
</div>
<div
v-if=
"!oneAccountCenterOff"
@
click=
"onForgetHandler()"
class=
"login-func-btn pointer"
>
{{$t('login.forget')}}
</div>
</div>
<div
class=
"login-func"
>
<div
@
click=
"toRegisterPage()"
class=
"login-func-btn pointer"
>
{{
$t
(
'login.register'
)
}}
</div>
</div>
</
template
>
</div>
<!-- OTP登陆 -->
...
...
Please
register
or
sign in
to post a comment