Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
2 changed files
with
47 additions
and
24 deletions
@@ -10,28 +10,51 @@ var Swiper = require('yoho.iswiper'), | @@ -10,28 +10,51 @@ var Swiper = require('yoho.iswiper'), | ||
10 | 10 | ||
11 | var recommendSwiper, | 11 | var recommendSwiper, |
12 | $recommendForYou = $('.recommend-for-you'), | 12 | $recommendForYou = $('.recommend-for-you'), |
13 | - preferenceUrl = $('#preferenceUrl').val(); | ||
14 | - | ||
15 | -if (preferenceUrl) { | ||
16 | - $.get(preferenceUrl).then(function(html) { | ||
17 | - if (html.length < 5) { | ||
18 | - $recommendForYou.css('display', 'none'); | ||
19 | - } else { | ||
20 | - $recommendForYou.html(html).show(); | ||
21 | - if ($('#swiper-recommend').length) { | ||
22 | - recommendSwiper = new Swiper('#swiper-recommend', { | ||
23 | - slidesPerView: 'auto', | ||
24 | - grabCursor: true, | ||
25 | - slideElement: 'a', | ||
26 | - lazyLoading: true, | ||
27 | - watchSlidesVisibility: true | ||
28 | - }); | 13 | + preferenceUrl = $('#preferenceUrl').val(), |
14 | + winH = $(window).height(), | ||
15 | + end = false, | ||
16 | + requesting = false; | ||
17 | + | ||
18 | + | ||
19 | +function request() { | ||
20 | + if (requesting || end) { | ||
21 | + return; | ||
22 | + } | ||
23 | + | ||
24 | + requesting = true; | ||
25 | + | ||
26 | + if (preferenceUrl) { | ||
27 | + $.get(preferenceUrl).then(function(html) { | ||
28 | + if (html.length < 5) { | ||
29 | + $recommendForYou.css('display', 'none'); | ||
30 | + } else { | ||
31 | + $recommendForYou.html(html).show(); | ||
32 | + if ($('#swiper-recommend').length) { | ||
33 | + recommendSwiper = new Swiper('#swiper-recommend', { | ||
34 | + slidesPerView: 'auto', | ||
35 | + grabCursor: true, | ||
36 | + slideElement: 'a', | ||
37 | + lazyLoading: true, | ||
38 | + watchSlidesVisibility: true | ||
39 | + }); | ||
40 | + } | ||
29 | } | 41 | } |
30 | - } | ||
31 | 42 | ||
32 | - window.rePosFooter(); | 43 | + requesting = false; |
44 | + end = true; | ||
33 | 45 | ||
34 | - }).fail(function() { | ||
35 | - $recommendForYou.hide(); | ||
36 | - }); | 46 | + }).fail(function() { |
47 | + $recommendForYou.hide(); | ||
48 | + }); | ||
49 | + } | ||
37 | } | 50 | } |
51 | + | ||
52 | +function scrollHandler() { | ||
53 | + if (!end || $(window).scrollTop() + winH >= $(document).height() - 50) { | ||
54 | + request(); | ||
55 | + } | ||
56 | +} | ||
57 | + | ||
58 | +$(window).scroll(function() { | ||
59 | + window.requestAnimationFrame(scrollHandler); | ||
60 | +}); |
@@ -59,7 +59,7 @@ class BindController extends AbstractAction | @@ -59,7 +59,7 @@ class BindController extends AbstractAction | ||
59 | $phoneNum=$this->get('phoneNum'); | 59 | $phoneNum=$this->get('phoneNum'); |
60 | 60 | ||
61 | $data = array( | 61 | $data = array( |
62 | - 'bindIndex'=>true,//js标识 | 62 | + 'bindCode'=>true,//js标识 |
63 | 'backUrl' => '/', // 返回的URL链接 | 63 | 'backUrl' => '/', // 返回的URL链接 |
64 | 'showHeaderImg' => true, // 控制显示头部图片 | 64 | 'showHeaderImg' => true, // 控制显示头部图片 |
65 | 'isPassportPage' => true, // 模板中模块标识 | 65 | 'isPassportPage' => true, // 模板中模块标识 |
@@ -87,7 +87,7 @@ class BindController extends AbstractAction | @@ -87,7 +87,7 @@ class BindController extends AbstractAction | ||
87 | $nickname = $this->get('nickname'); | 87 | $nickname = $this->get('nickname'); |
88 | $areaCode = $this->get('areaCode', '86'); | 88 | $areaCode = $this->get('areaCode', '86'); |
89 | $data = array( | 89 | $data = array( |
90 | - 'bindIndex'=>true,//js标识 | 90 | + 'bindPwd'=>true,//js标识 |
91 | 'backUrl' => '/', // 返回的URL链接 | 91 | 'backUrl' => '/', // 返回的URL链接 |
92 | 'showHeaderImg' => true, // 控制显示头部图片 | 92 | 'showHeaderImg' => true, // 控制显示头部图片 |
93 | 'isPassportPage' => true, // 模板中模块标识 | 93 | 'isPassportPage' => true, // 模板中模块标识 |
@@ -138,7 +138,7 @@ class BindController extends AbstractAction | @@ -138,7 +138,7 @@ class BindController extends AbstractAction | ||
138 | } | 138 | } |
139 | else | 139 | else |
140 | { | 140 | { |
141 | - $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => $res['data']); | 141 | + $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => isset($res['data'])?$res['data']:''); |
142 | } | 142 | } |
143 | } | 143 | } |
144 | while (false); | 144 | while (false); |
-
Please register or login to post a comment