Authored by Rock Zhang

Merge branch 'develop' into test

@@ -18,13 +18,14 @@ var introUrl = $('#introUrl').val(), @@ -18,13 +18,14 @@ var introUrl = $('#introUrl').val(),
18 var sizeSwiper, 18 var sizeSwiper,
19 refSwiper; 19 refSwiper;
20 20
21 -require('../recommend-for-you.js');  
22 -  
23 //判断是否要显示向左滑动提示 21 //判断是否要显示向左滑动提示
24 function hiddenTips($ele) { 22 function hiddenTips($ele) {
  23 + var offsetContainer,
  24 + offsetLastColumn;
  25 +
25 if ($ele.length > 0) { 26 if ($ele.length > 0) {
26 - var offsetContainer = $ele[0].getBoundingClientRect().right;  
27 - var offsetLastColumn = $ele.find('.swiper-slide:last-child')[0].getBoundingClientRect().right; 27 + offsetContainer = $ele[0].getBoundingClientRect().right;
  28 + offsetLastColumn = $ele.find('.swiper-slide:last-child')[0].getBoundingClientRect().right;
28 29
29 30
30 if (offsetLastColumn - offsetContainer < 0) { 31 if (offsetLastColumn - offsetContainer < 0) {
@@ -17,6 +17,7 @@ var goodsDiscountEl = document.getElementById('goodsDiscount'), @@ -17,6 +17,7 @@ var goodsDiscountEl = document.getElementById('goodsDiscount'),
17 17
18 require('./desc'); 18 require('./desc');
19 require('./comments-consults'); 19 require('./comments-consults');
  20 +require('../recommend-for-you-product-desc');
20 21
21 //add extra marign-bottom for footer to show the yoho copyright 22 //add extra marign-bottom for footer to show the yoho copyright
22 function showFooter() { 23 function showFooter() {
1 -/**  
2 - * 商品详情 --滚动页面加载  
3 - * @author: Lynnic  
4 - * @date: 2015/11/25  
5 - */  
6 -  
7 -// var $ = require('jquery'),  
8 -// loading = require('../../plugin/loading'),  
9 -// tip = require('../../plugin/tip');  
10 -  
11 -// var loadMoreUrl = $('#loadMoreUrl').val(),  
12 -// $commentsDiv = $('#goods-comments'),  
13 -// $consultsDiv = $('#goods-consults'),  
14 -// winH = $(window).height(),  
15 -// searching = false,  
16 -// end = false;  
17 -  
18 -// var jsonObj;  
19 -  
20 -// //插入评论列表底部  
21 -// function insertCommentsDiv(json) {  
22 -// var html = '';  
23 -// var i;  
24 -  
25 -  
26 -// for (i = 0; i < json.length; i++) {  
27 -// html += '<div class="comment-item">';  
28 -// html += '<span class="user-name">' + json[i].userName + '</span>';  
29 -// html += '<span class="goods-spec">' + json[i].desc + '</span>';  
30 -// html += '<span class="goods-spec">' + json[i].content + '</span>';  
31 -// html += '<span class="goods-spec">' + json[i].time + '</span>';  
32 -// }  
33 -// $commentsDiv.append(html);  
34 -// }  
35 -  
36 -// //插入咨询列表底部  
37 -// function insertConsultsDiv(json) {  
38 -// var html = '';  
39 -// var i;  
40 -  
41 -  
42 -// for (i = 0; i < json.length; i++) {  
43 -// html += '<div class="consult-item"> ';  
44 -// html += '<div class="question"> ';  
45 -// html += '<span class="iconfont">&#xe639;</span> ';  
46 -// html += '<p> ';  
47 -// html += json[i].question + '<br> ';  
48 -// html += '<span class="time">' + json[i].time + '</span> ';  
49 -// html += '</p> ';  
50 -// html += '</div> ';  
51 -  
52 -// html += '<div class="answer"> ';  
53 -// html += '<span class="iconfont">&#xe63c;</span> ';  
54 -// html += '<p>' + json[i].answer + '</p> ';  
55 -// html += '</div> ';  
56 -// html += '</div> ';  
57 -// }  
58 -// $consultsDiv.append(html);  
59 -// }  
60 -  
61 -// function search() {  
62 -// if (searching || end) {  
63 -// return;  
64 -// }  
65 -// searching = true;  
66 -  
67 -// loading.showLoadingMask();  
68 -  
69 -// $.ajax({  
70 -// type: 'GET',  
71 -// url: loadMoreUrl,  
72 -// success: function(data) {  
73 -// if (data.length > 0) {  
74 -// jsonObj = JSON.parse(data);  
75 -// if ($commentsDiv.length > 0) {  
76 -// insertCommentsDiv(jsonObj);  
77 -// } else if ($consultsDiv.length > 0) {  
78 -// insertConsultsDiv(jsonObj);  
79 -// }  
80 -// }  
81 -// searching = false;  
82 -// end = true;  
83 -// loading.hideLoadingMask();  
84 -// },  
85 -// error: function() {  
86 -// tip.show('网络断开连接了~');  
87 -// searching = false;  
88 -// loading.hideLoadingMask();  
89 -// }  
90 -// });  
91 -// }  
92 -  
93 -  
94 -// function scrollHandler() {  
95 -// if (!end || $(window).scrollTop() + winH >= $(document).height() - 50) {  
96 -// search();  
97 -// }  
98 -// }  
99 -  
100 -// //srcoll to load more  
101 -// $(window).scroll(function() {  
102 -// window.requestAnimationFrame(scrollHandler);  
103 -// });  
@@ -8,6 +8,6 @@ require('./newsale/newarrival'); @@ -8,6 +8,6 @@ require('./newsale/newarrival');
8 require('./newsale/discount'); 8 require('./newsale/discount');
9 require('./list'); 9 require('./list');
10 require('./detail/detail'); 10 require('./detail/detail');
11 -require('./detail/loadmore');  
12 require('./detail/consultform'); 11 require('./detail/consultform');
13 -require('./newsale/hot-rank');  
  12 +require('./newsale/hot-rank');
  13 +
  1 +/**
  2 + * 为您优选
  3 + * @author: liangzhifeng<zhifeng.liang@yoho.cn>
  4 + * @date: 2015/11/16
  5 + */
  6 +
  7 +
  8 +var Swiper = require('yoho.iswiper'),
  9 + $ = require('jquery');
  10 +
  11 +var recommendSwiper,
  12 + $recommendForYou = $('.recommend-for-you'),
  13 + preferenceUrl = $('#preferenceUrl').val();
  14 +
  15 +if (preferenceUrl) {
  16 + $.get(preferenceUrl).then(function(html) {
  17 + $recommendForYou.html(html).show();
  18 + if ($('#swiper-recommend').length) {
  19 + recommendSwiper = new Swiper('#swiper-recommend', {
  20 + slidesPerView: 'auto',
  21 + grabCursor: true,
  22 + slideElement: 'a',
  23 + lazyLoading: true,
  24 + watchSlidesVisibility: true
  25 + });
  26 + }
  27 + }).fail(function() {
  28 + $recommendForYou.hide();
  29 + });
  30 +}
@@ -136,6 +136,9 @@ @@ -136,6 +136,9 @@
136 {{#if id}} 136 {{#if id}}
137 <input id="productId" type="hidden" value="{{id}}"> 137 <input id="productId" type="hidden" value="{{id}}">
138 {{/if}} 138 {{/if}}
139 - 139 + {{#if preferenceUrl}}
  140 + <input id="preferenceUrl" type="hidden" value="{{preferenceUrl}}">
  141 + {{/if}}
  142 +
140 </div> 143 </div>
141 {{> layout/footer}} 144 {{> layout/footer}}
@@ -46,7 +46,8 @@ class HomeController extends AbstractAction @@ -46,7 +46,8 @@ class HomeController extends AbstractAction
46 $data = array( 46 $data = array(
47 'myIndexPage' => true, 47 'myIndexPage' => true,
48 'showDownloadApp' => true, 48 'showDownloadApp' => true,
49 - 'pageFooter' => true 49 + 'pageFooter' => true,
  50 + 'cartUrl' => Helpers::url('/cart/index/index', null),
50 ); 51 );
51 $uid = $this->getUid(true); 52 $uid = $this->getUid(true);
52 if ($uid) { 53 if ($uid) {