Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
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
68f91df620f51e917b4ab70d8cd6ad51e4302f31
1 parent
24cc3afc
'礼品卡去掉验证码'
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
68 deletions
apps/home/models/general-tabs-service.js
apps/home/models/me-gift-service.js
apps/home/router.js
apps/home/views/action/home/gift/me-gift.hbs
public/js/home/me-gift.page.js
public/scss/home/_me-gift.css
apps/home/models/general-tabs-service.js
View file @
68f91df
...
...
@@ -71,7 +71,7 @@ module.exports = class extends global.yoho.BaseModel {
'/home/account/modifymobile'
]},
{
name
:
'地址管理'
,
href
:
'/home/address'
},
{
name
:
'兑换礼品卡'
,
href
:
'/home/gift'
}
// {name: '兑换礼品卡', href: '/home/gift'} // @韩施超-产品让注释的
]
}
];
...
...
apps/home/models/me-gift-service.js
View file @
68f91df
...
...
@@ -103,25 +103,12 @@ module.exports = class extends global.yoho.BaseModel {
}
// 验证手机是否绑定
verifyBinMobile
(
uid
)
{
verifyBinMobile
()
{
let
userInfo
=
{
isBinMobile
:
Number
(
!!
_
.
get
(
this
.
ctx
,
'req.user.mobile'
,
false
))
};
if
(
userInfo
.
isBinMobile
)
{
return
Promise
.
resolve
(
userInfo
);
}
return
this
.
meGiftAPi
.
getProfile
(
uid
).
then
(
lres
=>
{
lres
=
_
.
get
(
lres
,
'data'
,
{});
let
isBinMobile
=
Number
(
!!
lres
.
verify_mobile
);
return
Object
.
assign
({},
userInfo
,
{
isBinMobile
:
isBinMobile
,
email
:
lres
.
verify_email
});
});
return
Promise
.
resolve
(
userInfo
);
}
// 发送邮箱验证码
...
...
apps/home/router.js
View file @
68f91df
...
...
@@ -275,12 +275,12 @@ router.get('/newuser', newUserController.check);
// 我的礼品卡
router
.
get
(
'/megift'
,
tabsMiddleware
.
getCommonHeader
,
meGiftController
.
index
);
router
.
post
(
'/megift/sendEmailCode'
,
captcha
.
requiredAPI
,
meGiftController
.
sendEmailCode
);
// 发送邮箱验证码
router
.
post
(
'/megift/sendEmailCode'
,
meGiftController
.
sendEmailCode
);
// 发送邮箱验证码
router
.
post
(
'/megift/verifyEmail'
,
meGiftController
.
verifyEmail
);
// 验证邮箱验证码
// 图形验证码、检查是否绑定手机号、发验证码
router
.
post
(
'/megift/smsBind'
,
captcha
.
requiredAPI
,
meGiftController
.
smsBind
);
// 检查是否绑定手机号、发验证码
router
.
post
(
'/megift/smsBind'
,
meGiftController
.
smsBind
);
router
.
post
(
'/megift/changeMobile'
,
meGiftController
.
changeMobile
);
// 修改绑定手机
router
.
post
(
'/megift/activateGift'
,
captcha
.
requiredAPI
,
meGiftController
.
activateGift
);
// 激活礼品卡
router
.
post
(
'/megift/activateGift'
,
meGiftController
.
activateGift
);
// 激活礼品卡
router
.
get
(
'/megift/detail'
,
meGiftController
.
detail
);
// 消费明细
module
.
exports
=
router
;
...
...
apps/home/views/action/home/gift/me-gift.hbs
View file @
68f91df
...
...
@@ -51,9 +51,6 @@
<
input
type
=
"text"
placeholder
=
"短信验证码"
class
=
"left email-code"
/>
<
span
class
=
"left email-btn"
>
获取短信验证码
<
/span
>
<
/div
>
<
div
class
=
"gift-group"
>
<
div
id
=
"captcha"
style
=
"display: inline-block; position: relative;"
><
/div
>
<
/div
>
</script>
{{!-- 绑定手机模板 --}}
...
...
@@ -81,12 +78,9 @@
<
/span
>
<
input
type
=
"text"
placeholder
=
"请输入手机号"
class
=
"right mobile"
/>
<
/div
>
<
div
class
=
"gift-group"
>
<
div
class
=
"gift-group
bind-mobile-input
"
>
<
input
type
=
"text"
placeholder
=
"短信验证码"
class
=
"left mobile-code"
/>
<
span
class
=
"left mobile-btn"
>
获取短信验证码
<
/span
>
<
/div
>
<
div
class
=
"gift-group"
>
<
div
id
=
"captcha"
style
=
"display: inline-block; position: relative;"
><
/div
>
<
span
class
=
"right mobile-btn"
>
获取短信验证码
<
/span
>
<
/div
>
<
/div
>
</script>
...
...
@@ -94,12 +88,9 @@
{{!-- 激活礼品卡模板 --}}
<script
id=
"activate-gift-tpl"
type=
"text/html"
>
<
div
class
=
"title"
>
激活礼品卡
<
/div
>
<
div
class
=
"verify-input"
>
<
div
class
=
"verify-input
activate-center
"
>
<
div
class
=
"gift-group"
><
input
type
=
"text"
placeholder
=
"请输入礼品卡号"
class
=
"card-code"
/><
/div
>
<
div
class
=
"gift-group"
><
input
type
=
"text"
placeholder
=
"请输入礼品卡密"
class
=
"card-pwd"
/><
/div
>
<
div
class
=
"gift-group"
>
<
div
id
=
"captcha"
style
=
"display: inline-block; position: relative;"
><
/div
>
<
/div
>
<
div
class
=
"gift-group activate-input-last"
><
input
type
=
"text"
placeholder
=
"请输入礼品卡密"
class
=
"card-pwd"
/><
/div
>
<
/div
>
</script>
...
...
public/js/home/me-gift.page.js
View file @
68f91df
var
$
=
require
(
'yoho-jquery'
),
Hbs
=
require
(
'yoho-handlebars'
),
dialog
=
require
(
'../common/dialog'
),
Captcha
=
require
(
'../plugins/captcha'
);
dialog
=
require
(
'../common/dialog'
);
var
meGift
;
require
(
'yoho-jquery-placeholder'
);
...
...
@@ -38,7 +37,7 @@ meGift = {
if
(
that
.
isBinMobile
)
{
that
.
activateGift
();
}
else
{
that
.
verifyEmail
Code
();
that
.
getMobile
Code
();
}
});
...
...
@@ -89,13 +88,11 @@ meGift = {
});
},
postAjax
:
function
(
url
,
data
,
verifyData
,
captcha
)
{
postAjax
:
function
(
url
,
data
,
verifyData
)
{
var
deferred
=
$
.
Deferred
();
// eslint-disable-line
var
that
=
this
;
var
x
;
captcha
&&
captcha
.
hideTip
();
if
(
that
.
isFlag
)
{
return
deferred
.
resolve
({
code
:
401
,
...
...
@@ -122,9 +119,7 @@ meGift = {
type
:
'post'
,
data
:
data
}).
then
(
function
(
res
)
{
if
(
res
.
code
===
405
)
{
captcha
&&
captcha
.
showTip
(
res
.
message
);
}
else
if
(
res
.
code
!==
200
)
{
if
(
res
.
code
!==
200
)
{
that
.
meAlert
(
res
.
message
,
false
);
}
...
...
@@ -153,13 +148,12 @@ meGift = {
},
// 获取邮箱验证码
getEmailCode
:
function
(
captcha
)
{
getEmailCode
:
function
()
{
var
that
=
this
;
this
.
postAjax
(
'/home/megift/sendEmailCode'
,
{
email
:
this
.
userEmail
,
verifyCode
:
captcha
.
getResults
()
},
{},
captcha
).
then
(
function
(
res
)
{
email
:
this
.
userEmail
},
{}).
then
(
function
(
res
)
{
if
(
res
.
code
===
200
)
{
that
.
intTimer
(
$
(
'.email-btn'
));
}
...
...
@@ -169,7 +163,6 @@ meGift = {
// 效验邮箱验证码
verifyEmailCode
:
function
()
{
var
that
=
this
;
var
captcha
;
var
dg
=
new
dialog
.
Dialog
({
content
:
that
.
emailTpl
({}),
className
:
'me-gift-confirm'
,
...
...
@@ -197,12 +190,11 @@ meGift = {
setTimeout
(
function
()
{
$
(
'[placeholder]'
,
dg
.
$el
).
placeholder
();
// ie8 兼容 placeholder
},
10
);
captcha
=
new
Captcha
(
'#captcha'
).
init
();
// 发送邮箱验证码
$
(
'.me-gift-confirm'
).
find
(
'.email-btn'
).
unbind
(
'click'
).
bind
(
'click'
,
function
()
{
if
(
!
$
(
this
).
hasClass
(
'int-timer'
))
{
that
.
getEmailCode
(
captcha
);
that
.
getEmailCode
();
}
});
},
...
...
@@ -210,7 +202,6 @@ meGift = {
// 获取手机验证码
getMobileCode
:
function
()
{
var
that
=
this
;
var
captcha
;
var
dg
=
new
dialog
.
Dialog
({
content
:
that
.
mobileTpl
({}),
className
:
'me-gift-confirm'
,
...
...
@@ -236,7 +227,7 @@ meGift = {
area
:
(
$
(
'.mobile-area'
).
find
(
'em'
).
text
()
||
''
).
replace
(
/^
\+
/
,
''
),
mobile
:
$
(
'input.mobile'
).
val
(),
code
:
$
(
'input.mobile-code'
).
val
()
},
verifyData
,
captcha
).
then
(
function
(
res
)
{
},
verifyData
).
then
(
function
(
res
)
{
if
(
res
.
code
===
200
)
{
that
.
isBinMobile
=
1
;
dg
.
close
();
...
...
@@ -250,18 +241,17 @@ meGift = {
setTimeout
(
function
()
{
$
(
'[placeholder]'
,
dg
.
$el
).
placeholder
();
// ie8 兼容 placeholder
},
10
);
captcha
=
new
Captcha
(
'#captcha'
).
init
();
// 发送邮箱验证码
$
(
'.me-gift-confirm'
).
find
(
'.mobile-btn'
).
unbind
(
'click'
).
bind
(
'click'
,
function
()
{
if
(
!
$
(
this
).
hasClass
(
'int-timer'
))
{
that
.
smsBind
(
captcha
);
that
.
smsBind
();
}
});
},
// 发送手机验证码
smsBind
:
function
(
captcha
)
{
smsBind
:
function
()
{
var
that
=
this
;
var
area
=
(
$
(
'.mobile-area'
).
find
(
'em'
).
text
()
||
''
).
replace
(
/^
\+
/
,
''
);
var
mobile
=
$
(
'input.mobile'
).
val
();
...
...
@@ -272,9 +262,8 @@ meGift = {
this
.
postAjax
(
'/home/megift/smsBind'
,
{
area
:
area
,
mobile
:
mobile
,
verifyCode
:
captcha
.
getResults
()
},
verifyData
,
captcha
).
then
(
function
(
res
)
{
mobile
:
mobile
},
verifyData
).
then
(
function
(
res
)
{
if
(
res
.
code
===
200
)
{
that
.
intTimer
(
$
(
'.mobile-btn'
));
}
...
...
@@ -284,7 +273,6 @@ meGift = {
// 激活礼品卡
activateGift
:
function
()
{
var
that
=
this
;
var
captcha
;
var
dg
=
new
dialog
.
Dialog
({
content
:
that
.
giftTpl
({}),
className
:
'me-gift-confirm'
,
...
...
@@ -308,9 +296,8 @@ meGift = {
that
.
postAjax
(
'/home/meGift/activateGift'
,
{
cardCode
:
$confirm
.
find
(
'.card-code'
).
val
(),
cardPwd
:
$confirm
.
find
(
'.card-pwd'
).
val
(),
verifyCode
:
captcha
.
getResults
()
},
verifyData
,
captcha
).
then
(
function
(
res
)
{
cardPwd
:
$confirm
.
find
(
'.card-pwd'
).
val
()
},
verifyData
).
then
(
function
(
res
)
{
if
(
res
.
code
===
200
)
{
dg
.
close
();
that
.
meAlert
(
'<p>您的礼品卡激活成功</p>'
,
false
,
function
()
{
...
...
@@ -325,7 +312,6 @@ meGift = {
setTimeout
(
function
()
{
$
(
'[placeholder]'
,
dg
.
$el
).
placeholder
();
// ie8 兼容 placeholder
},
10
);
captcha
=
new
Captcha
(
'#captcha'
).
init
();
},
// 消费明细
...
...
public/scss/home/_me-gift.css
View file @
68f91df
...
...
@@ -150,7 +150,7 @@
input
{
height
:
30px
;
line-height
:
28
px
;
line-height
:
30
px
;
padding
:
0
5px
;
font-size
:
14px
;
color
:
#444
;
...
...
@@ -161,11 +161,11 @@
.email-btn
,
.mobile-btn
{
border
:
1px
solid
#e6e6e6
;
font-size
:
13px
;
background-color
:
#444
;
color
:
#fff
;
height
:
30px
;
border
:
none
;
cursor
:
pointer
;
width
:
110px
;
line-height
:
30px
;
...
...
@@ -191,7 +191,7 @@
.mobile-area
{
width
:
70px
;
line-height
:
30
px
;
line-height
:
26
px
;
height
:
30px
;
text-align
:
center
;
border
:
1px
solid
#e6e6e6
;
...
...
@@ -225,12 +225,12 @@
}
input
.mobile-code
{
width
:
2
17
px
;
width
:
2
00
px
;
}
.card-code
,
.card-pwd
{
width
:
3
1
0px
;
width
:
3
3
0px
;
}
.border-top-info
{
...
...
@@ -307,12 +307,24 @@
}
.confirm-sure
{
margin-left
:
4
5px
;
margin-left
:
6
5px
;
}
.alert-sure
{
width
:
160px
;
}
.activate-input-last
{
margin-top
:
30px
;
}
.activate-center
{
padding-bottom
:
30px
;
}
.bind-mobile-input
{
margin
:
30px
0
50px
;
}
}
.me-gift-confirm.me-page
{
...
...
Please
register
or
login
to post a comment