Authored by 陈轩

fix

1 'use strict'; 1 'use strict';
2 2
3 const fs = require('fs'); 3 const fs = require('fs');
4 -let devHost = '172.16.10.123'; 4 +let devHost = 'localhost';
5 5
6 fs.readFile('.devhost', (err, buf)=> { 6 fs.readFile('.devhost', (err, buf)=> {
7 if (!err) { 7 if (!err) {
@@ -191,7 +191,7 @@ getIndexHtml = function() { @@ -191,7 +191,7 @@ getIndexHtml = function() {
191 if (data) { 191 if (data) {
192 if (avatarSwiperClone) { 192 if (avatarSwiperClone) {
193 avatarSwiperClone.destroy(true, true); 193 avatarSwiperClone.destroy(true, true);
194 - avatarSwiperClone = ''; 194 + avatarSwiperClone = null;
195 } 195 }
196 196
197 $mainContent.html(data); 197 $mainContent.html(data);
@@ -227,46 +227,44 @@ starIScroll.iScroll.on('scrollStart', function() { @@ -227,46 +227,44 @@ starIScroll.iScroll.on('scrollStart', function() {
227 }); 227 });
228 228
229 starIScroll.iScroll.on('scroll', function() { 229 starIScroll.iScroll.on('scroll', function() {
  230 + var avatarOffsetT;
  231 +
230 if (this.directionY !== -1) { 232 if (this.directionY !== -1) {
231 setTimeout(function() { 233 setTimeout(function() {
232 starIScroll.iScroll.refresh(); 234 starIScroll.iScroll.refresh();
233 }, 0); 235 }, 0);
234 } 236 }
235 237
236 - console.log(this);  
237 -  
238 - $window.trigger('scroll'); 238 + avatarOffsetT = $avatarWrap[0].offsetTop;
  239 +
  240 + if (-this.y >= avatarOffsetT) {
  241 + $avatarClone.show();
  242 +
  243 + if (!avatarSwiperClone) {
  244 + avatarSwiperClone = new Swiper($avatarClone[0], {
  245 + loop: true,
  246 + initialSlide: $avatarWrap.find('.swiper-slide-active').index() % bannerLen,
  247 + centeredSlides: true,
  248 + slidesPerView: 'auto',
  249 + loopedSlides: bannerLen,
  250 + spaceBetween: 10,
  251 + slidesOffsetBefore: -swiperNum,
  252 + watchSlidesProgress: true,
  253 + watchSlidesVisibility: true,
  254 + onInit: function() {
  255 + $avatarClone.find('li').on('click', function() {
  256 + res = bindAvatar($(this));
  257 + return res;
  258 + });
  259 + }
  260 + });
239 261
240 - // if ($avatarWrap.offset().top <= headTabH) {  
241 - // $avatarClone.show();  
242 - //  
243 - // if (!avatarSwiperClone) {  
244 - // avatarSwiperClone = new Swiper('.avatar-0', {  
245 - // loop: true,  
246 - // initialSlide: $('.avatar-1').find('.swiper-slide-active').index() % bannerLen,  
247 - // centeredSlides: true,  
248 - // slidesPerView: 'auto',  
249 - // loopedSlides: bannerLen,  
250 - // spaceBetween: 10,  
251 - // slidesOffsetBefore: -swiperNum,  
252 - // watchSlidesProgress: true,  
253 - // watchSlidesVisibility: true,  
254 - // onInit: function() {  
255 - // $('.avatar-0 li').on('click', function() {  
256 - // res = bindAvatar($(this));  
257 - // return res;  
258 - // });  
259 - // }  
260 - // });  
261 - //  
262 - // avatarSwiperClone.params.control = avatarSwiper;  
263 - // avatarSwiper.params.control = avatarSwiperClone;  
264 - // }  
265 - // }  
266 - //  
267 - // if ($avatarWrap.offset().top > $('.avatar-1')[0].scrollHeight) {  
268 - // $avatarClone.hide();  
269 - // } 262 + avatarSwiperClone.params.control = avatarSwiper;
  263 + avatarSwiper.params.control = avatarSwiperClone;
  264 + }
  265 + } else {
  266 + $avatarClone.hide();
  267 + }
270 }); 268 });
271 269
272 starIScroll.iScroll.on('scrollEnd', function() { 270 starIScroll.iScroll.on('scrollEnd', function() {
@@ -35,7 +35,7 @@ function PullRefresh(seclector, options) { @@ -35,7 +35,7 @@ function PullRefresh(seclector, options) {
35 35
36 this.iScroll = new IScroll($em.get(0), { 36 this.iScroll = new IScroll($em.get(0), {
37 click: true, 37 click: true,
38 - probeType: 2 38 + probeType: 3
39 }); 39 });
40 40
41 this.iScroll.on('scrollStart', function() { 41 this.iScroll.on('scrollStart', function() {