Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
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
王水玲
9 years ago
Commit
cf0a7d819590444ee0a7d0880145530843020739
1 parent
34c53ab3
领券中心修改
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
6 deletions
static/js/index/coupon.js
template/m.yohobuy.com/actions/index/coupon/index.phtml
static/js/index/coupon.js
View file @
cf0a7d8
...
...
@@ -2,25 +2,48 @@
* Created by Administrator on 2016/4/13.
*/
var
$
=
require
(
'jquery'
),
Swiper
=
require
(
'yoho.iswiper'
),
$receive
=
$
(
'.main-right-receive'
),
$mask
=
$
(
'.floor-mask'
),
$message
=
$
(
'.floor-message'
),
$tooltip
=
$
(
'.floor-tooltip'
);
var
bannerSwiper
;
// 获取url中的参数
function
getUrlParam
(
name
)
{
// 构造一个含有目标参数的正则表达式对象
var
reg
=
new
RegExp
(
'(^|&)'
+
name
+
'=([^&]*)(&|$)'
);
// 匹配目标参数
var
r
=
window
.
location
.
search
.
substr
(
1
).
match
(
reg
);
// 返回参数值
if
(
r
!=
null
)
{
return
r
[
2
];
}
return
null
;
}
$receive
.
on
(
'click'
,
function
()
{
var
$curDom
=
$
(
this
);
$
.
ajax
({
url
:
'/coupon/receiveCoupon'
,
data
:
{
couponID
:
$curDom
.
parents
(
'.coupon-floor'
).
attr
(
'coupon-id'
)
},
dataType
:
'json'
,
success
:
function
(
data
)
{
var
msg
=
data
.
msg
,
status
=
data
.
status
;
if
(
data
.
noLogin
===
true
)
{
location
.
href
=
data
.
url
;
location
.
href
=
data
.
url
+
'?code='
+
getUrlParam
(
'code'
)
;
}
else
{
if
(
!
status
)
{
if
(
status
)
{
$curDom
.
hide
();
$curDom
.
next
().
show
();
$tooltip
.
show
();
...
...
@@ -42,4 +65,17 @@ $('.coupon-floor a').on('click', function() {
if
(
$
(
this
).
attr
(
'href'
).
length
<=
0
)
{
return
false
;
}
});
\ No newline at end of file
});
if
(
$
(
'.banner-swiper'
).
find
(
'li'
).
size
()
>
1
)
{
bannerSwiper
=
new
Swiper
(
'.banner-swiper'
,
{
lazyLoading
:
true
,
lazyLoadingInPrevNext
:
true
,
loop
:
true
,
autoplay
:
3000
,
autoplayDisableOnInteraction
:
false
,
paginationClickable
:
true
,
slideElement
:
'li'
,
pagination
:
'.banner-top .pagination-inner'
});
}
\ No newline at end of file
...
...
template/m.yohobuy.com/actions/index/coupon/index.phtml
View file @
cf0a7d8
{
{>layout/header
}
}
{
{#
content
}
}
<div
class=
"coupon-area"
>
{
{#
content
}
}
{
{#if
isSingleImage
}
}
<a
href=
"{{url}}"
><img
src=
"{{src}}"
class=
"just-img"
/></a>
{
{/if
}
}
{
{#if
isCarouselBanner
}
}
{
{>
home/banner_top
}
}
{
{/if
}
}
{
{#if
isCoupon
}
}
<div
class=
"coupon-floor"
>
<div
class=
"coupon-floor"
coupon-id=
"{{couponID}}"
>
{
{#if
showFloorTitle
}
}
<div
class=
"floor-title"
>
{
{floorTitle
}
}
...
...
@@ -30,7 +37,8 @@
</div>
</div>
{
{/if
}
}
{
{/
content
}
}
{
{/
content
}
}
</div>
<div
class=
"floor-mask"
></div>
<div
class=
"floor-message"
>
<div
class=
"coupon-message-content"
></div>
...
...
Please
register
or
login
to post a comment