Showing
4 changed files
with
29 additions
and
11 deletions
@@ -57,7 +57,7 @@ const _processIndexData = (dataList) => { | @@ -57,7 +57,7 @@ const _processIndexData = (dataList) => { | ||
57 | if (list.ads) { | 57 | if (list.ads) { |
58 | _.forEach(list.ads.data, (data) => { | 58 | _.forEach(list.ads.data, (data) => { |
59 | formatData.ads.push({ | 59 | formatData.ads.push({ |
60 | - src: data.src + '/q/80', | 60 | + src: data.src.replace('imageView', 'imageView2'), |
61 | url: data.url | 61 | url: data.url |
62 | }); | 62 | }); |
63 | }); | 63 | }); |
@@ -65,7 +65,7 @@ const _processIndexData = (dataList) => { | @@ -65,7 +65,7 @@ const _processIndexData = (dataList) => { | ||
65 | 65 | ||
66 | // 首页明星文章数据处理 | 66 | // 首页明星文章数据处理 |
67 | if (list.list) { | 67 | if (list.list) { |
68 | - _.forEach(list.list, (data) => { | 68 | + _.forEach(list.list, (data, index) => { |
69 | const avatar = { | 69 | const avatar = { |
70 | tags: [] | 70 | tags: [] |
71 | }; | 71 | }; |
@@ -82,7 +82,12 @@ const _processIndexData = (dataList) => { | @@ -82,7 +82,12 @@ const _processIndexData = (dataList) => { | ||
82 | }); | 82 | }); |
83 | }); | 83 | }); |
84 | 84 | ||
85 | + if (formatData.articles.length > 10) { | ||
86 | + return; | ||
87 | + } | ||
88 | + | ||
85 | formatData.articles.push(_.merge({ | 89 | formatData.articles.push(_.merge({ |
90 | + noLazy: index < 2, | ||
86 | id: data.id, | 91 | id: data.id, |
87 | url: data.url, | 92 | url: data.url, |
88 | title: data.title, | 93 | title: data.title, |
@@ -97,10 +102,11 @@ const _processIndexData = (dataList) => { | @@ -97,10 +102,11 @@ const _processIndexData = (dataList) => { | ||
97 | 102 | ||
98 | // 首页明星头像数据处理 | 103 | // 首页明星头像数据处理 |
99 | if (list.tags) { | 104 | if (list.tags) { |
100 | - _.forEach(list.tags, (data) => { | 105 | + _.forEach(list.tags, (data, index) => { |
101 | let url = `/guang/star/detail?tag=${data.tagName}&openby:yohobuy={"action":"go.h5","params":{"id":"","share":"","shareparam":{},"islogin":"N","type":0,"updateflag":"N","url":"http://m.yohobuy.com/guang/star/detail","param":{"tag":"${data.tagName}"}}}`; // eslint-disable-line | 106 | let url = `/guang/star/detail?tag=${data.tagName}&openby:yohobuy={"action":"go.h5","params":{"id":"","share":"","shareparam":{},"islogin":"N","type":0,"updateflag":"N","url":"http://m.yohobuy.com/guang/star/detail","param":{"tag":"${data.tagName}"}}}`; // eslint-disable-line |
102 | 107 | ||
103 | formatData.starAvatar.push({ | 108 | formatData.starAvatar.push({ |
109 | + noLazy: index < 5, | ||
104 | url: url, | 110 | url: url, |
105 | cover: data.cover ? (data.cover + '?imageView2/2/w/180/h/180/q/80') : data.cover | 111 | cover: data.cover ? (data.cover + '?imageView2/2/w/180/h/180/q/80') : data.cover |
106 | }); | 112 | }); |
@@ -11,8 +11,13 @@ | @@ -11,8 +11,13 @@ | ||
11 | <ul class="clearfix swiper-wrapper"> | 11 | <ul class="clearfix swiper-wrapper"> |
12 | {{# starAvatar}} | 12 | {{# starAvatar}} |
13 | <li class="swiper-slide"> | 13 | <li class="swiper-slide"> |
14 | + {{#if noLazy}} | ||
15 | + <a href='{{url}}' class="star" style="background: url('{{image cover 180 180}}')"> | ||
16 | + </a> | ||
17 | + {{else}} | ||
14 | <a href='{{url}}' class="star swiper-lazy" data-background="{{image cover 180 180}}"> | 18 | <a href='{{url}}' class="star swiper-lazy" data-background="{{image cover 180 180}}"> |
15 | </a> | 19 | </a> |
20 | + {{/if}} | ||
16 | </li> | 21 | </li> |
17 | {{/ starAvatar}} | 22 | {{/ starAvatar}} |
18 | </ul> | 23 | </ul> |
@@ -26,7 +31,11 @@ | @@ -26,7 +31,11 @@ | ||
26 | <div class="avatar-wrap avatar-num-{{tags.length}}"> | 31 | <div class="avatar-wrap avatar-num-{{tags.length}}"> |
27 | {{# tags}} | 32 | {{# tags}} |
28 | <a href="{{avatarUrl}}"> | 33 | <a href="{{avatarUrl}}"> |
34 | + {{#if ../noLazy}} | ||
35 | + <img src="{{image cover 100 100}}" class="rank-avatar" ></img> | ||
36 | + {{else}} | ||
29 | <img data-original="{{image cover 100 100}}" class="rank-avatar lazy" ></img> | 37 | <img data-original="{{image cover 100 100}}" class="rank-avatar lazy" ></img> |
38 | + {{/if}} | ||
30 | <p class="name">{{tagName}}</p> | 39 | <p class="name">{{tagName}}</p> |
31 | </a> | 40 | </a> |
32 | {{/ tags}} | 41 | {{/ tags}} |
@@ -67,7 +76,11 @@ | @@ -67,7 +76,11 @@ | ||
67 | <div class="artice-cont"> | 76 | <div class="artice-cont"> |
68 | <p>{{articeTxt}}</p> | 77 | <p>{{articeTxt}}</p> |
69 | <div class="artice-imgs-area"> | 78 | <div class="artice-imgs-area"> |
79 | + {{#if noLazy}} | ||
80 | + <img src="{{image src 266 266}}" /> | ||
81 | + {{else}} | ||
70 | <img data-original="{{image src 266 266}}" class="lazy" /> | 82 | <img data-original="{{image src 266 266}}" class="lazy" /> |
83 | + {{/if}} | ||
71 | 84 | ||
72 | {{!-- <ul class="artice-imgs"> | 85 | {{!-- <ul class="artice-imgs"> |
73 | {{#each articeImg}} | 86 | {{#each articeImg}} |
@@ -40,6 +40,9 @@ require('../common'); | @@ -40,6 +40,9 @@ require('../common'); | ||
40 | require('yoho-jquery-lazyload'); | 40 | require('yoho-jquery-lazyload'); |
41 | 41 | ||
42 | $window.on('mousewheel', false); | 42 | $window.on('mousewheel', false); |
43 | +$('#yoho-header, .head-tab').on('touchmove', function() { | ||
44 | + return false; | ||
45 | +}); | ||
43 | 46 | ||
44 | // 限制标题字数 | 47 | // 限制标题字数 |
45 | // function txtLimit() { | 48 | // function txtLimit() { |
@@ -150,10 +153,6 @@ function setIndexAction() { | @@ -150,10 +153,6 @@ function setIndexAction() { | ||
150 | // $('.rank-avatar').each(function(key, item) { | 153 | // $('.rank-avatar').each(function(key, item) { |
151 | // setAvatar($(item)); | 154 | // setAvatar($(item)); |
152 | // }); | 155 | // }); |
153 | - | ||
154 | - $('#yoho-header, .head-tab').on('touchmove', function() { | ||
155 | - return false; | ||
156 | - }); | ||
157 | } | 156 | } |
158 | 157 | ||
159 | function initAction() { | 158 | function initAction() { |
@@ -177,7 +176,6 @@ function initAction() { | @@ -177,7 +176,6 @@ function initAction() { | ||
177 | 176 | ||
178 | initAction(); | 177 | initAction(); |
179 | 178 | ||
180 | - | ||
181 | // 首页数据请求 | 179 | // 首页数据请求 |
182 | getIndexHtml = function() { | 180 | getIndexHtml = function() { |
183 | loading.showLoadingMask(); | 181 | loading.showLoadingMask(); |
@@ -218,9 +216,9 @@ starIScroll = new PullRefresh('.star-main', { | @@ -218,9 +216,9 @@ starIScroll = new PullRefresh('.star-main', { | ||
218 | 216 | ||
219 | starIScroll.iScroll.on('scrollStart', function() { | 217 | starIScroll.iScroll.on('scrollStart', function() { |
220 | // 下拉 | 218 | // 下拉 |
221 | - if (this.directionY === -1) { | ||
222 | - // $loadingTip.slideDown(); | ||
223 | - } | 219 | + // if (this.directionY === -1) { |
220 | + // $loadingTip.slideDown(); | ||
221 | + // } | ||
224 | 222 | ||
225 | bannerSwiper && bannerSwiper.startAutoplay(); | 223 | bannerSwiper && bannerSwiper.startAutoplay(); |
226 | }); | 224 | }); |
-
Please register or login to post a comment