Authored by 王水玲

星潮教室首页

@@ -114,6 +114,7 @@ exports.index = (req, res) => { @@ -114,6 +114,7 @@ exports.index = (req, res) => {
114 articles: [ 114 articles: [
115 { 115 {
116 articleId: '48187', 116 articleId: '48187',
  117 + isSwiper: true,
117 starAvatar: [ 118 starAvatar: [
118 { 119 {
119 src: 'http://img11.static.yhbimg.com/yhb-img02/2016/04/28/02/01c3e9be0e46915b124962b97d752557cd.jpg?imageView/0/w/{width}/h/{height}', 120 src: 'http://img11.static.yhbimg.com/yhb-img02/2016/04/28/02/01c3e9be0e46915b124962b97d752557cd.jpg?imageView/0/w/{width}/h/{height}',
@@ -23,19 +23,28 @@ @@ -23,19 +23,28 @@
23 {{#each articles}} 23 {{#each articles}}
24 <li data-id="{{articleId}}"> 24 <li data-id="{{articleId}}">
25 <div class="star-avatar"> 25 <div class="star-avatar">
26 - <div class="article-avatar-swiper">  
27 - <ul class="clearfix swiper-wrapper">  
28 - {{#each starAvatar}}  
29 - <li class="swiper-slide">  
30 - <a href="{{avatarUrl}}">  
31 - <img class="swiper-lazy" data-src="{{image src 100 100}}" />  
32 - <p class="name">{{name}}</p>  
33 - <div class="swiper-lazy-preloader"></div>  
34 - </a>  
35 - </li>  
36 - {{/each}}  
37 - </ul>  
38 - </div> 26 + {{#if isSwiper}}
  27 + <div class="article-avatar-swiper">
  28 + <ul class="clearfix swiper-wrapper">
  29 + {{#each starAvatar}}
  30 + <li class="swiper-slide">
  31 + <a href="{{avatarUrl}}">
  32 + <img class="swiper-lazy" data-src="{{image src 100 100}}" />
  33 + <p class="name">{{name}}</p>
  34 + <div class="swiper-lazy-preloader"></div>
  35 + </a>
  36 + </li>
  37 + {{/each}}
  38 + </ul>
  39 + </div>
  40 + {{else}}
  41 + {{# starAvatar}}
  42 + <a href="{{avatarUrl}}">
  43 + <img class="lazy" data-original="{{image src 100 100}}" />
  44 + <p class="name">{{name}}</p>
  45 + </a>
  46 + {{/ starAvatar}}
  47 + {{/if}}
39 </div> 48 </div>
40 <div class="star-article"> 49 <div class="star-article">
41 <i class="article-arrow"></i> 50 <i class="article-arrow"></i>
@@ -97,7 +97,8 @@ if ($('.avatar-swiper .swiper-slide').length > 1) { @@ -97,7 +97,8 @@ if ($('.avatar-swiper .swiper-slide').length > 1) {
97 }); 97 });
98 } 98 }
99 99
100 -if ($('.star-avatar').length > 1) { 100 +// 明星动态头像左右滑动
  101 +if ($('.article-avatar-swiper').find('li').length > 1) {
101 new Swiper('.article-avatar-swiper', { 102 new Swiper('.article-avatar-swiper', {
102 initialSlide: 0, 103 initialSlide: 0,
103 lazyLoading: true, 104 lazyLoading: true,