Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
biao
9 years ago
Commit
f2bde703737c1a8e2a12747a24e8822c33bf7d23
1 parent
5fd57f9d
update for bind mobile. code review by LZF
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
105 additions
and
42 deletions
static/js/passport/bind/bind.js
static/js/passport/bind/password.js
static/js/passport/code.js
template/m.yohobuy.com/actions/passport/bind/code.phtml
template/m.yohobuy.com/actions/passport/bind/index.phtml
template/m.yohobuy.com/actions/passport/bind/password.phtml
static/js/passport/bind/bind.js
View file @
f2bde70
...
...
@@ -9,6 +9,7 @@ var $phoneNum = $('#phone-num'),
$countrySelect
=
$
(
'#country-select'
),
$areaCode
=
$
(
'#area-code'
),
$openId
=
$
(
'#openId'
),
$nickname
=
$
(
'#nickname'
),
$sourceType
=
$
(
'#sourceType'
),
$btnNext
=
$
(
'#btn-next'
);
...
...
@@ -25,10 +26,16 @@ function nextStep(url, mobileNo, areaCode) {
url
:
'/passport/bind/sendBindMsg'
,
data
:
{
phoneNum
:
mobileNo
,
areaCode
:
areaCode
areaCode
:
areaCode
.
replace
(
'+'
,
''
)
},
success
:
function
(
res
)
{
console
.
log
(
res
.
data
);
location
.
href
=
url
;
},
error
:
function
()
{
tip
.
show
(
'出错了,请重试!'
);
}
});
location
.
href
=
url
;
}
api
.
selectCssHack
(
$
(
'#country-select'
));
...
...
@@ -50,6 +57,7 @@ $countrySelect.change(function() {
$btnNext
.
on
(
'touchstart'
,
function
()
{
var
pn
=
trim
(
$phoneNum
.
val
()),
openId
=
trim
(
$openId
.
val
()),
nickname
=
trim
(
$nickname
.
val
()),
sourceType
=
trim
(
$sourceType
.
val
()),
areaCode
=
$countrySelect
.
val
();
...
...
@@ -63,9 +71,10 @@ $btnNext.on('touchstart', function() {
type
:
'POST'
,
data
:
{
areaCode
:
areaCode
.
replace
(
'+'
,
''
),
mobile
:
pn
,
phoneNum
:
pn
,
openId
:
openId
,
sourceType
:
sourceType
sourceType
:
sourceType
,
nickname
:
nickname
},
success
:
function
(
res
)
{
console
.
log
(
res
);
...
...
static/js/passport/bind/password.js
View file @
f2bde70
...
...
@@ -14,6 +14,40 @@ var tip = require('../../plugin/tip');
var
trim
=
$
.
trim
;
var
showErrTip
=
tip
.
show
;
var
nickname
=
$
(
'#nickname'
).
val
(),
sourceType
=
$
(
'#sourceType'
).
val
(),
openId
=
$
(
'#openId'
).
val
(),
phoneNum
=
$
(
'#phone-num'
).
val
(),
areaCode
=
$
(
'#area-code'
).
val
().
replace
(
'+'
,
''
);
function
startBind
(
password
)
{
$
.
ajax
({
url
:
'/passport/bind/bindMobile'
,
type
:
'post'
,
data
:
{
areaCode
:
areaCode
.
replace
(
'+'
,
''
),
phoneNum
:
phoneNum
,
openId
:
openId
,
sourceType
:
sourceType
,
nickname
:
nickname
,
password
:
password
},
success
:
function
(
res
)
{
if
(
res
.
code
===
200
)
{
tip
.
show
(
'登录成功'
);
setTimeout
(
function
()
{
location
.
href
=
res
.
data
.
refer
;
},
2000
);
}
else
{
tip
.
show
(
res
.
message
);
}
},
error
:
function
(
err
)
{
tip
.
show
(
'登录失败,请重试!'
);
}
});
}
api
.
bindEyesEvt
({
status
:
'open'
//默认眼睛打开
});
...
...
@@ -36,35 +70,6 @@ $btnSure.on('touchstart', function() {
if
(
api
.
pwdValidate
(
pwd
)
===
false
)
{
showErrTip
(
'密码6-20位,请重新输入'
);
}
else
{
$
.
ajax
({
type
:
'POST'
,
url
:
'/passport/reg/setpassword'
,
data
:
{
password
:
pwd
,
phoneNum
:
$
(
'#phone-num'
).
val
(),
areaCode
:
$
(
'#area-code'
).
val
(),
token
:
$
(
'#token'
).
val
()
},
success
:
function
(
data
)
{
var
res
;
if
(
data
.
code
===
200
)
{
res
=
data
.
data
;
showErrTip
(
'注册成功'
);
$
.
ajax
({
url
:
res
.
session
,
dataType
:
'jsonp'
});
//1000ms后跳转页面
setTimeout
(
function
()
{
location
.
href
=
res
.
href
;
},
1000
);
}
else
{
showErrTip
(
data
.
message
);
}
}
});
startBind
(
pwd
);
}
});
\ No newline at end of file
});
...
...
static/js/passport/code.js
View file @
f2bde70
...
...
@@ -9,6 +9,10 @@ module.exports = function(useInRegister, useForBind) {
var
$captcha
=
$
(
'#captcha'
),
$btnNext
=
$
(
'#btn-next'
),
$captchaTip
=
$
(
'#captcha-tip'
),
isReg
=
parseInt
(
$
(
'#isReg'
).
val
()),
nickname
=
$
(
'#nickname'
).
val
(),
sourceType
=
$
(
'#sourceType'
).
val
(),
openId
=
$
(
'#openId'
).
val
(),
phoneNum
=
$
(
'#phone-num'
).
val
(),
areaCode
=
$
(
'#area-code'
).
val
().
replace
(
'+'
,
''
);
...
...
@@ -20,6 +24,34 @@ module.exports = function(useInRegister, useForBind) {
var
urlMid
=
useInRegister
?
'reg'
:
'back'
;
function
startBind
()
{
$
.
ajax
({
url
:
'/passport/bind/bindMobile'
,
type
:
'post'
,
data
:
{
areaCode
:
areaCode
.
replace
(
'+'
,
''
),
phoneNum
:
phoneNum
,
openId
:
openId
,
sourceType
:
sourceType
,
nickname
:
nickname
,
password
:
''
},
success
:
function
(
res
)
{
if
(
res
.
code
===
200
)
{
tip
.
show
(
'登录成功'
);
setTimeout
(
function
()
{
location
.
href
=
res
.
data
.
refer
;
},
2000
);
}
else
{
tip
.
show
(
res
.
message
);
}
},
error
:
function
(
err
)
{
tip
.
show
(
'登录失败,请重试!'
);
}
});
}
function
countDown
()
{
var
count
=
59
,
itime
;
...
...
@@ -77,7 +109,7 @@ module.exports = function(useInRegister, useForBind) {
$
.
ajax
({
type
:
'POST'
,
url
:
useForBind
?
'/passport/bind/
send
BindMsg'
:
'/passport/'
+
urlMid
+
'/verifycode'
,
url
:
useForBind
?
'/passport/bind/
check
BindMsg'
:
'/passport/'
+
urlMid
+
'/verifycode'
,
data
:
{
phoneNum
:
phoneNum
,
areaCode
:
areaCode
,
...
...
@@ -85,13 +117,22 @@ module.exports = function(useInRegister, useForBind) {
token
:
$
(
'#token'
).
val
()
},
success
:
function
(
data
)
{
if
(
data
.
code
===
200
)
{
location
.
href
=
data
.
data
;
}
else
{
if
(
data
.
code
===
200
)
{
if
(
useForBind
)
{
if
(
isReg
)
{
startBind
();
}
else
{
location
.
href
=
'/passport/bind/password?phoneNum='
+
phoneNum
+
'&areaCode='
+
areaCode
+
'&openId='
+
openId
+
'&sourceType='
+
sourceType
+
'&nickname='
+
nickname
;
}
}
else
{
location
.
href
=
data
.
data
;
}
}
else
{
//验证码不正确,显示提示
showErrTip
(
data
.
message
);
}
//验证码不正确,显示提示
showErrTip
(
data
.
message
);
}
}
});
});
...
...
template/m.yohobuy.com/actions/passport/bind/code.phtml
View file @
f2bde70
{
{>
layout/header
}
}
<div
class=
"reg-code-page passport-page yoho-page"
>
<input
type=
"hidden"
id=
"isReg"
value=
"{{isReg}}"
>
<input
type=
"hidden"
id=
"openId"
value=
"{{openId}}"
>
<input
type=
"hidden"
id=
"sourceType"
value=
"{{sourceType}}"
>
<input
type=
"hidden"
id=
"nickname"
value=
"{{nickname}}"
>
{
{>
passport/code
}
}
</div>
{
{>
layout/footer
}
}
...
...
template/m.yohobuy.com/actions/passport/bind/index.phtml
View file @
f2bde70
...
...
@@ -2,6 +2,7 @@
<div
class=
"bind-page passport-page yoho-page"
>
<input
type=
"hidden"
id=
"openId"
value=
"{{openId}}"
>
<input
type=
"hidden"
id=
"sourceType"
value=
"{{sourceType}}"
>
<input
type=
"hidden"
id=
"nickname"
value=
"{{nickname}}"
>
{
{>
passport/header
}
}
<div
class=
"content"
>
{
{>
passport/country_list
}
}
...
...
template/m.yohobuy.com/actions/passport/bind/password.phtml
View file @
f2bde70
{
{>
layout/header
}
}
<div
class=
"bind-password-page passport-page yoho-page"
>
<input
type=
"hidden"
id=
"openId"
value=
"{{openId}}"
>
<input
type=
"hidden"
id=
"sourceType"
value=
"{{sourceType}}"
>
<input
type=
"hidden"
id=
"nickname"
value=
"{{nickname}}"
>
{
{>
passport/header
}
}
<div
class=
"content"
>
<div
class=
"input-container row has-eye"
>
...
...
Please
register
or
login
to post a comment