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
zzzzzzz
9 years ago
Commit
65295d64d43832c7af2630634739717713788e0c
1 parent
d9f2055b
图片轮播
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
80 additions
and
10 deletions
apps/channel/models/channel.js
config/common.js
doraemon/views/partial/resources/banner.hbs
public/js/channel/home.page.js
public/scss/channel/_banner-center.css
apps/channel/models/channel.js
View file @
65295d6
...
...
@@ -134,6 +134,11 @@ const _getChannelResource = (params) => {
cache
:
true
}).
then
(
result
=>
{
if
(
result
&&
result
.
code
===
200
)
{
for
(
let
item
of
result
.
data
.
list
)
{
item
.
template_name
===
'single_image'
&&
item
.
data
.
length
===
1
&&
(
item
.
singleOne
=
true
);
}
return
resourcesProcess
(
result
.
data
.
list
);
}
else
{
logger
.
error
(
'index resouce is not 200'
);
...
...
config/common.js
View file @
65295d6
...
...
@@ -16,9 +16,11 @@ module.exports = {
domains
:
{
// api: 'http://devapi.yoho.cn:58078/',
// service: 'http://devservice.yoho.cn:58077/'
api
:
'http://api.yoho.cn/'
,
service
:
'http://service.yoho.cn/'
,
liveApi
:
'http://testapi.live.yohops.com:9999/'
// api: 'http://api.yoho.cn/',
// service: 'http://service.yoho.cn/',
// liveApi: 'http://testapi.live.yohops.com:9999/'
api
:
'http://api-test1.yohops.com:9999/'
,
service
:
'http://service-test1.yohops.com:9999/'
,
},
subDomains
:
{
host
:
'.m.yohobuy.com'
,
...
...
doraemon/views/partial/resources/banner.hbs
View file @
65295d6
{{#
data
}}
<div
class=
"banner-center"
>
<a
href=
"
{{
url
}}
"
>
<img
class=
"lazy"
data-original=
"
{{
image
src
640
200
}}
"
alt=
""
>
</a>
</div>
{{/
data
}}
\ No newline at end of file
<div
class=
"banner-center banner-center-swiper"
>
{{#if
singleOne
}}
{{#
data
}}
<div
class=
"banner-list"
>
<a
href=
"
{{
url
}}
"
>
<img
class=
"swiper-lazy swiper-lazy-loaded"
src=
"
{{
image
src
640
200
}}
"
alt=
""
>
</a>
</div>
{{/
data
}}
{{else}}
<ul
class=
"banner-list swiper-wrapper clearfix"
>
{{#
data
}}
<li
class=
"swiper-slide"
>
<a
href=
"
{{
url
}}
"
>
<img
class=
"swiper-lazy swiper-lazy-loaded"
src=
"
{{
image
src
640
200
}}
"
alt=
""
>
</a>
</li>
{{/
data
}}
</ul>
{{/if}}
</div>
\ No newline at end of file
...
...
public/js/channel/home.page.js
View file @
65295d6
...
...
@@ -108,6 +108,19 @@ if ($('.banner-swiper').find('li').size() > 1) {
});
}
// single_image的轮播
if
(
$
(
'.banner-center-swiper'
).
find
(
'li'
).
size
()
>
1
)
{
new
Swiper
(
'.banner-center-swiper'
,
{
lazyLoading
:
true
,
lazyLoadingInPrevNext
:
true
,
loop
:
true
,
autoplay
:
3000
,
autoplayDisableOnInteraction
:
false
,
paginationClickable
:
true
,
slideElement
:
'li'
,
});
}
// 热门品牌滑动
new
Swiper
(
'.brands-swiper'
,
{
grabCursor
:
true
,
...
...
public/scss/channel/_banner-center.css
View file @
65295d6
...
...
@@ -2,9 +2,45 @@
margin
:
30px
0
0
;
height
:
200px
;
overflow
:
hidden
;
img
{
display
:
block
;
width
:
100%
;
height
:
100%
;
}
}
.banner-center-swiper
{
background
:
#fff
;
width
:
100%
;
height
:
200px
;
border-top
:
1px
solid
#e0e0e0
;
overflow
:
hidden
;
.banner-list
{
position
:
relative
;
height
:
200px
;
li
{
float
:
left
;
width
:
100%
;
height
:
200px
;
a
{
position
:
relative
;
display
:
block
;
width
:
100%
;
height
:
100%
;
line-height
:
200px
;
font-size
:
0
;
}
img
{
display
:
inline-block
;
max-width
:
100%
;
max-height
:
100%
;
vertical-align
:
middle
;
}
}
}
}
...
...
Please
register
or
login
to post a comment