Authored by ccbikai

Merge branch 'hotfix/star'

@@ -86,9 +86,9 @@ const _processIndexData = (dataList) => { @@ -86,9 +86,9 @@ const _processIndexData = (dataList) => {
86 }); 86 });
87 }); 87 });
88 88
89 - if (formatData.articles.length > 30) {  
90 - return;  
91 - } 89 + // if (formatData.articles.length > 5) {
  90 + // return;
  91 + // }
92 92
93 formatData.articles.push(_.merge({ 93 formatData.articles.push(_.merge({
94 noLazy: index < 2, 94 noLazy: index < 2,
@@ -95,9 +95,6 @@ const postcssPlugin = (et) => { @@ -95,9 +95,6 @@ const postcssPlugin = (et) => {
95 } 95 }
96 96
97 plugins = [ 97 plugins = [
98 - require('autoprefixer')({  
99 - browsers: ['> 1%']  
100 - }),  
101 require('precss'), 98 require('precss'),
102 require('postcss-sprites').default(sprites), 99 require('postcss-sprites').default(sprites),
103 require('postcss-assets')(assets), 100 require('postcss-assets')(assets),
@@ -109,6 +106,9 @@ const postcssPlugin = (et) => { @@ -109,6 +106,9 @@ const postcssPlugin = (et) => {
109 selectorBlackList: [], // 选择器黑名单,可以使用正则 106 selectorBlackList: [], // 选择器黑名单,可以使用正则
110 propWhiteList: [] // 属性名称为空,表示替换所有属性的值 107 propWhiteList: [] // 属性名称为空,表示替换所有属性的值
111 }), 108 }),
  109 + require('autoprefixer')({
  110 + browsers: ['> 1%']
  111 + }),
112 112
113 // 可选 113 // 可选
114 require('postcss-use')({ 114 require('postcss-use')({
@@ -173,7 +173,9 @@ gulp.task('font', () => { @@ -173,7 +173,9 @@ gulp.task('font', () => {
173 gulp.task('postcss', ['assets'], () => { 173 gulp.task('postcss', ['assets'], () => {
174 return gulp.src('scss/index.css') 174 return gulp.src('scss/index.css')
175 .pipe(postcss(postcssPlugin(env.pro))) 175 .pipe(postcss(postcssPlugin(env.pro)))
176 - .pipe(cssnano()) 176 + .pipe(cssnano({
  177 + safe: true
  178 + }))
177 .pipe(gulp.dest(dist.css)); 179 .pipe(gulp.dest(dist.css));
178 }); 180 });
179 181
@@ -6,6 +6,8 @@ @@ -6,6 +6,8 @@
6 6
7 var $ = require('yoho-jquery'), 7 var $ = require('yoho-jquery'),
8 Swiper = require('yoho-swiper'), 8 Swiper = require('yoho-swiper'),
  9 +
  10 + // inView = require('in-view'),
9 loading = require('../plugin/loading'), 11 loading = require('../plugin/loading'),
10 PullRefresh = require('../plugin/pull-refresh'); 12 PullRefresh = require('../plugin/pull-refresh');
11 13
@@ -31,6 +33,12 @@ var avatarKey, bannerLen, res, avatarSwiper, avatarSwiperClone, getIndexHtml, ba @@ -31,6 +33,12 @@ var avatarKey, bannerLen, res, avatarSwiper, avatarSwiperClone, getIndexHtml, ba
31 33
32 var swiperNum = $('.avatar-wrap .swiper-slide').width() / 2; 34 var swiperNum = $('.avatar-wrap .swiper-slide').width() / 2;
33 35
  36 +// var $gif = $('img[data-original*="gif"]');
  37 +
  38 +if ($('.star-main').css('height') === '0px') {
  39 + $('.star-main').css('height', $window.height() - $('.head-tab').height());
  40 +}
  41 +
34 if ($window.width() === 375 && isiOS) { 42 if ($window.width() === 375 && isiOS) {
35 swiperNum = 32; 43 swiperNum = 32;
36 } 44 }
@@ -38,11 +46,29 @@ if ($window.width() === 375 && isiOS) { @@ -38,11 +46,29 @@ if ($window.width() === 375 && isiOS) {
38 require('../common'); 46 require('../common');
39 require('yoho-jquery-lazyload'); 47 require('yoho-jquery-lazyload');
40 48
  49 +// require('yoho-jquery-inview');
  50 +
41 $window.on('mousewheel', false); 51 $window.on('mousewheel', false);
42 $('#yoho-header, .head-tab').on('touchmove', function() { 52 $('#yoho-header, .head-tab').on('touchmove', function() {
43 return false; 53 return false;
44 }); 54 });
45 55
  56 +// inView(document.querySelectorAll('img[data-original*="gif"]'))
  57 +// .on('enter', function() {
  58 +// console.log(1);
  59 +// })
  60 +// .on('exit', function() {
  61 +// console.log(2);
  62 +// });
  63 +
  64 +// $('img[data-original*="gif"]').on('inview', function(event, isInView) {
  65 +// if (isInView) {
  66 +// $(this).css('display', 'block');
  67 +// } else {
  68 +// $(this).css('display', 'none');
  69 +// }
  70 +// });
  71 +
46 // 限制标题字数 72 // 限制标题字数
47 // function txtLimit() { 73 // function txtLimit() {
48 // 74 //
@@ -95,7 +121,6 @@ function setIndexAction() { @@ -95,7 +121,6 @@ function setIndexAction() {
95 121
96 // 明星头像 swiper 初始化 122 // 明星头像 swiper 初始化
97 if (bannerLen > 1) { 123 if (bannerLen > 1) {
98 - console.log(Math.floor($avatarWrap.find('.swiper-slide').length / 2));  
99 avatarSwiper = new Swiper($avatarWrap.find('.avatar-swiper')[0], { 124 avatarSwiper = new Swiper($avatarWrap.find('.avatar-swiper')[0], {
100 lazyLoading: true, 125 lazyLoading: true,
101 lazyLoadingInPrevNextAmount: 3, 126 lazyLoadingInPrevNextAmount: 3,
@@ -183,6 +208,7 @@ getIndexHtml = function() { @@ -183,6 +208,7 @@ getIndexHtml = function() {
183 $.ajax({ 208 $.ajax({
184 url: '/guang/star/getIndexHtml', 209 url: '/guang/star/getIndexHtml',
185 dataType: 'html', 210 dataType: 'html',
  211 + timeout: 5000
186 }) 212 })
187 .done(function(data) { 213 .done(function(data) {
188 if (data) { 214 if (data) {
@@ -217,54 +243,57 @@ starIScroll.iScroll.on('scrollStart', function() { @@ -217,54 +243,57 @@ starIScroll.iScroll.on('scrollStart', function() {
217 // if (this.directionY === -1) { 243 // if (this.directionY === -1) {
218 // $loadingTip.slideDown(); 244 // $loadingTip.slideDown();
219 // } 245 // }
220 - 246 + // $gif.css('display', 'none');
221 bannerSwiper && bannerSwiper.startAutoplay(); 247 bannerSwiper && bannerSwiper.startAutoplay();
222 }); 248 });
223 249
224 -// starIScroll.iScroll.on('scroll', function() {  
225 -// var avatarOffsetT;  
226 -//  
227 -// if (this.directionY !== -1) {  
228 -// setTimeout(function() {  
229 -// starIScroll.iScroll.refresh();  
230 -// }, 0);  
231 -// }  
232 -//  
233 -// avatarOffsetT = $avatarWrap[0].offsetTop;  
234 -//  
235 -// if (-this.y >= avatarOffsetT) {  
236 -// $avatarClone.show();  
237 -//  
238 -// if (!avatarSwiperClone) {  
239 -// avatarSwiperClone = new Swiper($avatarClone[0], {  
240 -// loop: true,  
241 -// initialSlide: $avatarWrap.find('.swiper-slide-active').index() % bannerLen,  
242 -// centeredSlides: true,  
243 -// slidesPerView: 'auto',  
244 -// loopedSlides: bannerLen,  
245 -// spaceBetween: 10,  
246 -// slidesOffsetBefore: -swiperNum,  
247 -// watchSlidesProgress: true,  
248 -// watchSlidesVisibility: true,  
249 -// onInit: function() {  
250 -// $avatarClone.find('li').on('click', function() {  
251 -// res = bindAvatar($(this));  
252 -// return res;  
253 -// });  
254 -// }  
255 -// });  
256 -//  
257 -// avatarSwiperClone.params.control = avatarSwiper;  
258 -// avatarSwiper.params.control = avatarSwiperClone;  
259 -// }  
260 -// } else {  
261 -// $avatarClone.hide();  
262 -// }  
263 -// }); 250 +starIScroll.iScroll.on('scroll', function() {
  251 + // var avatarOffsetT;
  252 + //
  253 + // if (this.directionY !== -1) {
  254 + // setTimeout(function() {
  255 + // starIScroll.iScroll.refresh();
  256 + // }, 0);
  257 + // }
  258 + //
  259 + // avatarOffsetT = $avatarWrap[0].offsetTop;
  260 + //
  261 + // if (-this.y >= avatarOffsetT) {
  262 + // $avatarClone.show();
  263 + //
  264 + // if (!avatarSwiperClone) {
  265 + // avatarSwiperClone = new Swiper($avatarClone[0], {
  266 + // lazyLoading: true,
  267 + // lazyLoadingInPrevNext: true,
  268 + //
  269 + // // loop: true,
  270 + // initialSlide: $avatarWrap.find('.swiper-slide-active').index() % bannerLen,
  271 + // centeredSlides: true,
  272 + // slidesPerView: 'auto',
  273 + // loopedSlides: bannerLen,
  274 + // spaceBetween: 10,
  275 + // slidesOffsetBefore: -swiperNum,
  276 + // watchSlidesProgress: true,
  277 + // watchSlidesVisibility: true,
  278 + // onInit: function() {
  279 + // $avatarClone.find('li').on('click', function() {
  280 + // res = bindAvatar($(this));
  281 + // return res;
  282 + // });
  283 + // }
  284 + // });
  285 + //
  286 + // avatarSwiperClone.params.control = avatarSwiper;
  287 + // avatarSwiper.params.control = avatarSwiperClone;
  288 + // }
  289 + // } else {
  290 + // $avatarClone.hide();
  291 + // }
  292 +});
264 293
265 starIScroll.iScroll.on('scrollEnd', function() { 294 starIScroll.iScroll.on('scrollEnd', function() {
266 // $loadingTip.slideUp(); 295 // $loadingTip.slideUp();
267 - 296 + // $gif.css('display', 'block');
268 bannerSwiper && bannerSwiper.stopAutoplay(); 297 bannerSwiper && bannerSwiper.stopAutoplay();
269 }); 298 });
270 299
@@ -31,7 +31,7 @@ function PullRefresh(seclector, options) { @@ -31,7 +31,7 @@ function PullRefresh(seclector, options) {
31 31
32 this.iScroll = new IScroll($em.get(0), $.extend({ 32 this.iScroll = new IScroll($em.get(0), $.extend({
33 click: true, 33 click: true,
34 - probeType: 3 34 + probeType: 2
35 }, options)); 35 }, options));
36 36
37 this.iScroll.on('scrollStart', function() { 37 this.iScroll.on('scrollStart', function() {
@@ -135,8 +135,8 @@ @@ -135,8 +135,8 @@
135 position: absolute; 135 position: absolute;
136 left: 0; 136 left: 0;
137 top: 0; 137 top: 0;
138 - bottom: 0;  
139 - right: 0; 138 + width: 100%;
  139 + height: 100%;
140 height: calc(100vh - 88px); 140 height: calc(100vh - 88px);
141 } 141 }
142 142
@@ -446,6 +446,7 @@ @@ -446,6 +446,7 @@
446 446
447 .loading-tip { 447 .loading-tip {
448 position: absolute; 448 position: absolute;
  449 + width: 100%;
449 top: 88px; 450 top: 88px;
450 left: 50%; 451 left: 50%;
451 transform: translate(-50%, 0); 452 transform: translate(-50%, 0);