Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuywap-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
郭成尧
8 years ago
Commit
e2b0ff06d1107c2f5910a145d8cf7be490b4945b
1 parent
0759f80c
international-login-ok
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
92 additions
and
1 deletions
public/js/passport/login/international-new.js
public/js/passport/login/international-new.js
View file @
e2b0ff0
import
$
from
'yoho-jquery'
;
import
tip
from
'plugin/tip'
;
import
Page
from
'yoho-page'
;
import
api
from
'../api'
;
import
Validate
from
'plugin/validata'
;
const
showErrTip
=
tip
.
show
;
const
trim
=
$
.
trim
;
const
$captcha
=
$
(
'#js-img-check'
);
const
useVerify
=
$captcha
.
data
(
'userverify'
);
// 170406 是否使用验证
let
validate
=
{};
if
(
useVerify
)
{
validate
=
new
Validate
(
$captcha
,
{
useREM
:
{
rootFontSize
:
40
,
picWidth
:
150
}
});
validate
.
init
();
}
class
InternationalNew
extends
Page
{
constructor
()
{
super
();
this
.
selector
=
{
countryCodeSelector
:
$
(
'#countryCodeSelector'
),
clearMobile
:
$
(
'#clearMobile'
),
mobileInput
:
$
(
'input[name=mobile]'
),
passwordInput
:
$
(
'input[name=password]'
),
...
...
@@ -42,10 +64,79 @@ class InternationalNew extends Page {
}
/**
*
国际账号登录
*
登录操作处理
*/
internationalLogin
()
{
let
pn
=
trim
(
this
.
selector
.
mobileInput
.
val
()),
areaCode
=
this
.
selector
.
countryCodeSelector
.
val
(),
pwd
=
trim
(
this
.
selector
.
passwordInput
.
val
());
if
(
!
this
.
selector
.
internationalLoginBtn
.
hasClass
(
'active'
))
{
return
;
}
if
((
api
.
phoneRegx
[
areaCode
].
test
(
pn
)
||
areaCode
!==
'+86'
)
&&
api
.
pwdValidate
(
pwd
))
{
let
params
=
{
areaCode
:
areaCode
.
replace
(
'+'
,
''
),
account
:
pn
,
password
:
pwd
};
if
(
useVerify
)
{
validate
.
getResults
().
then
((
result
)
=>
{
this
.
selector
.
internationalLoginBtn
.
text
(
'正在登录...'
).
addClass
(
'disable'
);
$
.
extend
(
params
,
result
);
this
.
postInternationalLogin
(
params
);
});
}
else
{
this
.
postInternationalLogin
(
params
);
}
}
else
{
showErrTip
(
'账号或密码有错误,请重新输入'
);
this
.
selector
.
internationalLoginBtn
.
text
(
'登录'
).
addClass
(
'disable'
);
}
}
/**
* 发送国际账号登录请求
*/
postInternationalLogin
(
params
)
{
this
.
ajax
({
type
:
'POST'
,
url
:
'/passport/login/auth'
,
data
:
params
}).
then
(
data
=>
{
let
res
;
validate
&&
validate
.
type
===
2
&&
validate
.
refresh
();
if
(
data
.
code
===
200
)
{
res
=
data
.
data
;
showErrTip
(
'登录成功'
);
// 3秒后强制跳转
setTimeout
(()
=>
{
location
.
href
=
res
.
href
;
},
1500
);
this
.
selector
.
internationalLoginBtn
.
text
(
'登录成功'
);
showErrTip
(
'登录成功'
);
}
else
{
if
(
useVerify
&&
data
.
captchaShow
)
{
((
data
.
changeCaptcha
&&
validate
.
type
!==
2
)
&&
validate
.
refresh
());
}
showErrTip
(
data
.
message
);
this
.
resetForm
();
}
});
}
/**
* 重置表单
*/
resetForm
()
{
this
.
selector
.
passwordInput
.
val
(
''
).
focus
();
this
.
selector
.
internationalLoginBtn
.
text
(
'登录'
).
removeClass
(
'active'
);
}
/**
...
...
Please
register
or
login
to post a comment