Authored by uedxwg

update

@@ -19,6 +19,8 @@ var introUrl = $('#introUrl').val(), @@ -19,6 +19,8 @@ var introUrl = $('#introUrl').val(),
19 var sizeSwiper, 19 var sizeSwiper,
20 refSwiper; 20 refSwiper;
21 21
  22 +require('../recommend-for-you.js');
  23 +
22 function search() { 24 function search() {
23 if (searching || end) { 25 if (searching || end) {
24 return; 26 return;
@@ -46,6 +48,15 @@ function search() { @@ -46,6 +48,15 @@ function search() {
46 slidesPerView: 'auto' 48 slidesPerView: 'auto'
47 }); 49 });
48 50
  51 + //优选
  52 + // recommendSwiper = new Swiper('#swiper-recommend', {
  53 + // slidesPerView: 'auto',
  54 + // grabCursor: true,
  55 + // slideElement: 'li',
  56 + // lazyLoading: true,
  57 + // watchSlidesVisibility: true
  58 + // });
  59 +
49 searching = false; 60 searching = false;
50 end = true; 61 end = true;
51 loading.hideLoadingMask(); 62 loading.hideLoadingMask();
@@ -11,6 +11,7 @@ var goodsSwiper; @@ -11,6 +11,7 @@ var goodsSwiper;
11 11
12 require('./desc'); 12 require('./desc');
13 require('./comments-consults'); 13 require('./comments-consults');
  14 +require('../recommend-for-you.js');
14 15
15 lazyLoad($('img.lazy')); 16 lazyLoad($('img.lazy'));
16 17
@@ -5,14 +5,23 @@ @@ -5,14 +5,23 @@
5 */ 5 */
6 6
7 7
8 -var Swiper = require('yoho.iswiper'); 8 +var Swiper = require('yoho.iswiper'),
  9 + $ = require('jquery');
9 10
10 -var recommendSwiper; 11 +var recommendSwiper,
  12 + $recommendForYou = $('.recommend-for-you');
11 13
12 -recommendSwiper = new Swiper('#swiper-recommend', {  
13 - slidesPerView: 'auto',  
14 - grabCursor: true,  
15 - slideElement: 'li',  
16 - lazyLoading: true,  
17 - watchSlidesVisibility: true 14 +$.get('/home/preference').then(function(html) {
  15 + $recommendForYou.html(html);
  16 + if ($('#swiper-recommend').length) {
  17 + recommendSwiper = new Swiper('#swiper-recommend', {
  18 + slidesPerView: 'auto',
  19 + grabCursor: true,
  20 + slideElement: 'li',
  21 + lazyLoading: true,
  22 + watchSlidesVisibility: true
  23 + });
  24 + }
  25 +}).fail(function() {
  26 + $recommendForYou.hide();
18 }); 27 });
1 .my-page { 1 .my-page {
  2 + color: #444;
2 background: #f0f0f0; 3 background: #f0f0f0;
3 4
  5 + a {
  6 + color: #444;
  7 + }
  8 +
4 .user-info { 9 .user-info {
5 display: block; 10 display: block;
6 position: relative; 11 position: relative;
@@ -136,7 +141,7 @@ @@ -136,7 +141,7 @@
136 } 141 }
137 142
138 .iconfont { 143 .iconfont {
139 - font-size: pxToRem(60px); 144 + font-size: pxToRem(40px);
140 } 145 }
141 } 146 }
142 } 147 }
@@ -58,6 +58,7 @@ @@ -58,6 +58,7 @@
58 float: right; 58 float: right;
59 margin-right: rem(30); 59 margin-right: rem(30);
60 color: #ccc; 60 color: #ccc;
  61 + font-size: rem(32);
61 } 62 }
62 63
63 &:last-child { 64 &:last-child {
@@ -87,6 +88,7 @@ @@ -87,6 +88,7 @@
87 .icon-yoho-enter { 88 .icon-yoho-enter {
88 color: #ccc; 89 color: #ccc;
89 float: right; 90 float: right;
  91 + font-size: rem(32);
90 } 92 }
91 93
92 .connect-item { 94 .connect-item {
@@ -342,6 +342,10 @@ $basicBtnC:#eb0313; @@ -342,6 +342,10 @@ $basicBtnC:#eb0313;
342 font-size: pxToRem(47px); 342 font-size: pxToRem(47px);
343 color: #444; 343 color: #444;
344 } 344 }
  345 + &.unfavorite{
  346 + font-size: pxToRem(34px);
  347 + color:#ccc;
  348 + }
345 &.favorite { 349 &.favorite {
346 font-size: pxToRem(34px); 350 font-size: pxToRem(34px);
347 color: $basicBtnC; 351 color: $basicBtnC;
@@ -374,6 +378,10 @@ $basicBtnC:#eb0313; @@ -374,6 +378,10 @@ $basicBtnC:#eb0313;
374 font-size: pxToRem(24px); 378 font-size: pxToRem(24px);
375 } 379 }
376 } 380 }
  381 +
  382 + .recommend-for-you{
  383 + margin-bottom: pxToRem(120px);
  384 + }
377 } 385 }
378 @import "comments-consults"; 386 @import "comments-consults";
379 @import "product-description"; 387 @import "product-description";
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 margin-top: pxToRem(22px); 6 margin-top: pxToRem(22px);
7 } 7 }
8 .detail{ 8 .detail{
  9 + background-color: $tableCellC;
9 &.table .inner-container{ 10 &.table .inner-container{
10 background-color: $tableCellC; 11 background-color: $tableCellC;
11 } 12 }
@@ -89,7 +90,7 @@ @@ -89,7 +90,7 @@
89 } 90 }
90 } 91 }
91 margin-top: pxToRem(30px); 92 margin-top: pxToRem(30px);
92 - margin-bottom: pxToRem(120px); 93 + margin-bottom: pxToRem(30px);
93 } 94 }
94 .detail-swiper { 95 .detail-swiper {
95 .swiper-wrapper { 96 .swiper-wrapper {
@@ -2,8 +2,6 @@ @@ -2,8 +2,6 @@
2 <div class="good-detail-page yoho-page"> 2 <div class="good-detail-page yoho-page">
3 <div class="banner-container"> 3 <div class="banner-container">
4 <div class="tag-container"> 4 <div class="tag-container">
5 - <p class="good-tag new-tag">NEW</p>  
6 - <p class="good-tag renew-tag">再到着</p>  
7 {{# tags}} 5 {{# tags}}
8 {{# is_new}} 6 {{# is_new}}
9 <p class="good-tag new-tag">NEW</p> 7 <p class="good-tag new-tag">NEW</p>
@@ -103,8 +101,7 @@ @@ -103,8 +101,7 @@
103 {{/ enterStore}} 101 {{/ enterStore}}
104 102
105 <div id="productDesc"></div> 103 <div id="productDesc"></div>
106 -  
107 - <!-- {{>product/product-description}} --> 104 + {{> product/recommend-for-you}}
108 105
109 {{#cartInfo}} 106 {{#cartInfo}}
110 <div class="cart-bar"> 107 <div class="cart-bar">
@@ -117,7 +114,11 @@ @@ -117,7 +114,11 @@
117 {{else}} 114 {{else}}
118 <a href="" class="sold-out">已售罄</a> 115 <a href="" class="sold-out">已售罄</a>
119 {{/if}} 116 {{/if}}
120 - <a href="" class="favorite iconfont">&#xe605;</a> 117 + {{#if favorite}}
  118 + <a href="" class="favorite iconfont ">&#xe605;</a>
  119 + {{else}}
  120 + <a href="" class="unfavorite iconfont ">&#xe605;</a>
  121 + {{/if}}
121 </div> 122 </div>
122 {{/cartInfo}} 123 {{/cartInfo}}
123 124
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
12 <p class="good-tag sale-tag">SALE</p> 12 <p class="good-tag sale-tag">SALE</p>
13 {{/ is_discount}} 13 {{/ is_discount}}
14 {{# is_yohoood}} 14 {{# is_yohoood}}
15 - <div class="good-tag yohood-tag"></div> 15 + <p class="good-tag new-festival-tag">新品节</p>
16 {{/ is_yohoood}} 16 {{/ is_yohoood}}
17 {{# is_limited}} 17 {{# is_limited}}
18 <p class="good-tag limit-tag">限量商品</p> 18 <p class="good-tag limit-tag">限量商品</p>
  1 +<div class="title">为您优选新品</div>
  2 +<div id="swiper-recommend" class="swiper-container">
  3 + <ul class="swiper-wrapper swiper-wrapper-recommend">
  4 + {{#recommendList}}
  5 + <li class="swiper-slide">
  6 + <img class="swiper-lazy img-box" data-src="{{thumb}}">
  7 + <div class="price">
  8 + <span class="sale-price {{^price}}no-price{{/price}}">¥{{salePrice}}</span>
  9 + {{#price}}<span class="old-price">¥{{.}}</span>{{/price}}
  10 + </div>
  11 + <div class="swiper-lazy-preloader"></div>
  12 + </li>
  13 + {{/recommendList}}
  14 + </ul>
  15 +</div>
1 -{{# recommendForYou}}  
2 - <div class="recommend-for-you">  
3 - <div class="title">为您优选新品</div>  
4 - <div id="swiper-recommend" class="swiper-container">  
5 - <ul class="swiper-wrapper swiper-wrapper-recommend">  
6 - {{#recommendList}}  
7 - <li class="swiper-slide">  
8 - <img class="swiper-lazy img-box" data-src="{{thumb}}">  
9 - <div class="price">  
10 - <span class="sale-price {{^price}}no-price{{/price}}"{{salePrice}}</span>  
11 - {{#price}}<span class="old-price"{{.}}</span>{{/price}}  
12 - </div>  
13 - <div class="swiper-lazy-preloader"></div>  
14 - </li>  
15 - {{/recommendList}}  
16 - </ul>  
17 - </div>  
18 - </div>  
19 -{{/ recommendForYou}}  
  1 +<div class="recommend-for-you">
  2 +</div>
@@ -51,18 +51,35 @@ class HomeController extends AbstractAction @@ -51,18 +51,35 @@ class HomeController extends AbstractAction
51 ); 51 );
52 $uid = $this->getUid(); 52 $uid = $this->getUid();
53 if ($uid) { 53 if ($uid) {
54 - // 优选新品数据  
55 - $channel = Helpers::getChannelByCookie();  
56 - 54 +
57 $data['isLogin'] = true; 55 $data['isLogin'] = true;
58 $data += UserModel::getUserProfileData($uid); 56 $data += UserModel::getUserProfileData($uid);
59 $data += UserModel::getInfoNumData($uid); 57 $data += UserModel::getInfoNumData($uid);
60 - $data['recommendForYou'] = UserModel::getPreferenceData($channel);  
61 } 58 }
62 59
63 $this->_view->display('index', $data); 60 $this->_view->display('index', $data);
64 } 61 }
65 62
  63 + /**
  64 + * 为您优选
  65 + */
  66 + public function preferenceAction()
  67 + {
  68 + $result = array();
  69 +
  70 + if ($this->isAjax()) {
  71 + // 优选新品数据
  72 + $channel = Helpers::getChannelByCookie();
  73 + $result = UserModel::getPreferenceData($channel);
  74 + }
  75 +
  76 + if (empty($result)) {
  77 + echo ' ';
  78 + } else {
  79 + $this->_view->display('recommend-content', $result);
  80 + }
  81 + }
  82 +
66 /** 83 /**
67 * 用户收藏的商品 84 * 用户收藏的商品
68 */ 85 */