Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop
Showing
7 changed files
with
57 additions
and
51 deletions
@@ -20,6 +20,7 @@ class DetailData | @@ -20,6 +20,7 @@ class DetailData | ||
20 | const PRODUCT_BASE_INFO = 'product/queryProductDetailByProductId'; | 20 | const PRODUCT_BASE_INFO = 'product/queryProductDetailByProductId'; |
21 | const PRODUCT_SIZE_INFO = 'product/queryProductIntroBySkn'; | 21 | const PRODUCT_SIZE_INFO = 'product/queryProductIntroBySkn'; |
22 | const PRODUCT_CONSULT_LIST = 'consult/queryConsults'; | 22 | const PRODUCT_CONSULT_LIST = 'consult/queryConsults'; |
23 | + const PRODUCT_COMMENT_LIST = 'sns/comments/commentList'; | ||
23 | 24 | ||
24 | /** | 25 | /** |
25 | * 商品基本信息 | 26 | * 商品基本信息 |
@@ -63,6 +64,23 @@ class DetailData | @@ -63,6 +64,23 @@ class DetailData | ||
63 | ) ); | 64 | ) ); |
64 | } | 65 | } |
65 | 66 | ||
67 | + /** | ||
68 | + * 评论内容列表 | ||
69 | + * | ||
70 | + * @param int $productId 产品ID | ||
71 | + * @param int $pageNum 页码数 | ||
72 | + * @param int $pageSize 每页显示个数 | ||
73 | + * @return array | ||
74 | + */ | ||
75 | + public static function commentList($productId, $pageNum, $pageSize) | ||
76 | + { | ||
77 | + return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_COMMENT_LIST, array( | ||
78 | + 'productId' => intval($productId), | ||
79 | + 'pageNum' => intval($pageNum), | ||
80 | + 'pageSize' => intval($pageSize), | ||
81 | + ) ); | ||
82 | + } | ||
83 | + | ||
66 | /** | 84 | /** |
67 | * 为你优选的商品列表 | 85 | * 为你优选的商品列表 |
68 | * | 86 | * |
@@ -68,7 +68,7 @@ $channelLink.on('touchstart', function() { | @@ -68,7 +68,7 @@ $channelLink.on('touchstart', function() { | ||
68 | borderColor: '#fff' | 68 | borderColor: '#fff' |
69 | }); | 69 | }); |
70 | }); | 70 | }); |
71 | -var removeAppFloatLayerFixed = (function() { | 71 | +var updateLayerPosition = (function() { |
72 | var init = false; | 72 | var init = false; |
73 | return function() { | 73 | return function() { |
74 | var winHeight = window.innerHeight; | 74 | var winHeight = window.innerHeight; |
@@ -92,11 +92,7 @@ var removeAppFloatLayerFixed = (function() { | @@ -92,11 +92,7 @@ var removeAppFloatLayerFixed = (function() { | ||
92 | })(); | 92 | })(); |
93 | 93 | ||
94 | $win.scroll(function() { | 94 | $win.scroll(function() { |
95 | - | ||
96 | - clearTimeout($.data(this, 'scrollTimer')); | ||
97 | - $.data(this, 'scrollTimer', setTimeout(function() { | ||
98 | - removeAppFloatLayerFixed(); | ||
99 | - }, 2)); | 95 | + updateLayerPosition(); |
100 | }); | 96 | }); |
101 | 97 | ||
102 | $win.on('resize', function(){ | 98 | $win.on('resize', function(){ |
@@ -107,4 +103,4 @@ $win.on('scrollstop', function(){ | @@ -107,4 +103,4 @@ $win.on('scrollstop', function(){ | ||
107 | console.log('stop'); | 103 | console.log('stop'); |
108 | }); | 104 | }); |
109 | 105 | ||
110 | -$doc.on('ready', removeAppFloatLayerFixed); | 106 | +$doc.on('ready', updateLayerPosition); |
@@ -83,6 +83,7 @@ function loadData($parent, url, page) { | @@ -83,6 +83,7 @@ function loadData($parent, url, page) { | ||
83 | } | 83 | } |
84 | 84 | ||
85 | if (data === ' ') { | 85 | if (data === ' ') { |
86 | + $parent.closest('.fav-type').find('.fav-content-loading').addClass('hide'); | ||
86 | $parent.closest('.fav-type').find('.fav-null-box').removeClass('hide'); | 87 | $parent.closest('.fav-type').find('.fav-null-box').removeClass('hide'); |
87 | } else if (data === 'end') { | 88 | } else if (data === 'end') { |
88 | $parent.closest('.fav-type').find('.fav-load-background') | 89 | $parent.closest('.fav-type').find('.fav-load-background') |
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | <div class="goto-consult"> | 3 | <div class="goto-consult"> |
4 | <i class="iconfont consult-logo"></i> | 4 | <i class="iconfont consult-logo"></i> |
5 | <span>我要咨询</span> | 5 | <span>我要咨询</span> |
6 | - <a href="/consultform" class="iconfont enter-consult-page"></a> | 6 | + <a href="{{consultUrl}}" class="iconfont enter-consult-page"></a> |
7 | </div> | 7 | </div> |
8 | {{# consults}} | 8 | {{# consults}} |
9 | <div class="goods-consults" id="goods-consults"> | 9 | <div class="goods-consults" id="goods-consults"> |
@@ -122,9 +122,9 @@ | @@ -122,9 +122,9 @@ | ||
122 | {{#if numInCart}} | 122 | {{#if numInCart}} |
123 | <span class="num-tag">{{numInCart}}</span> | 123 | <span class="num-tag">{{numInCart}}</span> |
124 | {{/if}} | 124 | {{/if}} |
125 | - <a href="/shoppingCart" class="num-incart iconfont"></a> | 125 | + <a href="{{cartUrl}}" class="num-incart iconfont"></a> |
126 | {{#if goodsInstore}} | 126 | {{#if goodsInstore}} |
127 | - <a href="/shoppingCart" id="addtoCart" class="addto-cart">加入购物车</a> | 127 | + <a href="{{cartUrl}}" id="addtoCart" class="addto-cart">加入购物车</a> |
128 | {{else}} | 128 | {{else}} |
129 | <a href="javascript:;" class="sold-out">已售罄</a> | 129 | <a href="javascript:;" class="sold-out">已售罄</a> |
130 | {{/if}} | 130 | {{/if}} |
@@ -199,6 +199,7 @@ class DetailModel | @@ -199,6 +199,7 @@ class DetailModel | ||
199 | 199 | ||
200 | // 悬浮的购物车信息 | 200 | // 悬浮的购物车信息 |
201 | $result['cartInfo'] = array( | 201 | $result['cartInfo'] = array( |
202 | + 'cartUrl' => Helpers::url('/shoppingCart'), | ||
202 | 'numInCart' => 0, | 203 | 'numInCart' => 0, |
203 | 'goodsInstore' => $baseInfo['storage'], | 204 | 'goodsInstore' => $baseInfo['storage'], |
204 | ); | 205 | ); |
@@ -361,9 +362,25 @@ class DetailModel | @@ -361,9 +362,25 @@ class DetailModel | ||
361 | /** | 362 | /** |
362 | * 获取评价列表 | 363 | * 获取评价列表 |
363 | */ | 364 | */ |
364 | - public static function getComments() | 365 | + public static function getComments($productId, $pageNum = 1, $pageSize = 100) |
365 | { | 366 | { |
367 | + $result = array(); | ||
366 | 368 | ||
369 | + if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) { | ||
370 | + $commentList = DetailData::commentList($productId, $pageNum, $pageSize); | ||
371 | + if (!empty($commentList)) { | ||
372 | + $build = array(); | ||
373 | + foreach ($commentList as $value) { | ||
374 | + $build['userName'] = ''; | ||
375 | + $build['desc'] = ''; | ||
376 | + $build['content'] = ''; | ||
377 | + $build['time'] = ''; | ||
378 | + $result[] = $build; | ||
379 | + } | ||
380 | + } | ||
381 | + } | ||
382 | + | ||
383 | + return $result; | ||
367 | } | 384 | } |
368 | 385 | ||
369 | /** | 386 | /** |
@@ -406,7 +423,7 @@ class DetailModel | @@ -406,7 +423,7 @@ class DetailModel | ||
406 | $result = array(); | 423 | $result = array(); |
407 | 424 | ||
408 | if (is_numeric($productSkn)) { | 425 | if (is_numeric($productSkn)) { |
409 | - $preference = DetailData::preference($productSkn); var_dump($preference); exit; | 426 | + $preference = DetailData::preference($productSkn); |
410 | if (!empty($preference['data'])) { | 427 | if (!empty($preference['data'])) { |
411 | foreach ($preference['data'] as $value) { | 428 | foreach ($preference['data'] as $value) { |
412 | $result['recommendList'][] = Helpers::formatProduct($value, false, true, true, 299, 388, false, false); | 429 | $result['recommendList'][] = Helpers::formatProduct($value, false, true, true, 299, 388, false, false); |
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | use Action\AbstractAction; | 3 | use Action\AbstractAction; |
4 | +use Plugin\Helpers; | ||
4 | 5 | ||
5 | /** | 6 | /** |
6 | * 商品详情的控制器 | 7 | * 商品详情的控制器 |
@@ -31,6 +32,7 @@ class DetailController extends AbstractAction | @@ -31,6 +32,7 @@ class DetailController extends AbstractAction | ||
31 | $this->error(); | 32 | $this->error(); |
32 | } | 33 | } |
33 | $data['goodsDetailPage'] = true; | 34 | $data['goodsDetailPage'] = true; |
35 | + $data['pageFooter'] = true; | ||
34 | 36 | ||
35 | if (isset($data['goodsName'])) { | 37 | if (isset($data['goodsName'])) { |
36 | $this->setTitle($data['goodsName']); | 38 | $this->setTitle($data['goodsName']); |
@@ -66,6 +68,7 @@ class DetailController extends AbstractAction | @@ -66,6 +68,7 @@ class DetailController extends AbstractAction | ||
66 | */ | 68 | */ |
67 | public function commentsAction() | 69 | public function commentsAction() |
68 | { | 70 | { |
71 | + $productId = $this->get('product_id', 0); | ||
69 | $total = $this->get('total'); | 72 | $total = $this->get('total'); |
70 | if (!is_numeric($total)) { | 73 | if (!is_numeric($total)) { |
71 | $total = 0; | 74 | $total = 0; |
@@ -81,29 +84,7 @@ class DetailController extends AbstractAction | @@ -81,29 +84,7 @@ class DetailController extends AbstractAction | ||
81 | 'goodsCommentsPage' => true, | 84 | 'goodsCommentsPage' => true, |
82 | 'pageFooter' => true, | 85 | 'pageFooter' => true, |
83 | 'comments' => array( | 86 | 'comments' => array( |
84 | - 'list' => array( | ||
85 | - array( | ||
86 | - 'userName' => 'Lynnic', | ||
87 | - 'desc' => '购买了白色Mate7', | ||
88 | - 'content' => '活动时买的,挺超值。上身效果也不错。质量 | ||
89 | - 很好,买送人的,很满意。而且物流相当给...', | ||
90 | - 'time' => '2014-08-12 10:24:26' | ||
91 | - ), | ||
92 | - array( | ||
93 | - 'userName' => 'Lynnic', | ||
94 | - 'desc' => '购买了白色Mate7', | ||
95 | - 'content' => '活动时买的,挺超值。上身效果也不错。质量 | ||
96 | - 很好,买送人的,很满意。而且物流相当给...', | ||
97 | - 'time' => '2014-08-12 10:24:26' | ||
98 | - ), | ||
99 | - array( | ||
100 | - 'userName' => 'Lynnic', | ||
101 | - 'desc' => '购买了白色Mate7', | ||
102 | - 'content' => '活动时买的,挺超值。上身效果也不错。质量 | ||
103 | - 很好,买送人的,很满意。而且物流相当给...', | ||
104 | - 'time' => '2014-08-12 10:24:26' | ||
105 | - ) | ||
106 | - ) | 87 | + 'list' => \Product\DetailModel::getConsults($productId), |
107 | ), | 88 | ), |
108 | ); | 89 | ); |
109 | 90 | ||
@@ -136,7 +117,8 @@ class DetailController extends AbstractAction | @@ -136,7 +117,8 @@ class DetailController extends AbstractAction | ||
136 | 'pageFooter' => true, | 117 | 'pageFooter' => true, |
137 | 'consults' => array( | 118 | 'consults' => array( |
138 | 'list' => \Product\DetailModel::getConsults($productId), | 119 | 'list' => \Product\DetailModel::getConsults($productId), |
139 | - ) | 120 | + ), |
121 | + 'consultUrl' => Helpers::url('/product/detail/consultform'), | ||
140 | ); | 122 | ); |
141 | 123 | ||
142 | // 渲染模板 | 124 | // 渲染模板 |
@@ -148,19 +130,11 @@ class DetailController extends AbstractAction | @@ -148,19 +130,11 @@ class DetailController extends AbstractAction | ||
148 | */ | 130 | */ |
149 | public function consultformAction() | 131 | public function consultformAction() |
150 | { | 132 | { |
151 | - $data = array( | ||
152 | - 'consultform' => true, | ||
153 | - 'pageHeader' => array( | ||
154 | - 'navBack' => 'sss ', | ||
155 | - // 'navHome' => 'sss ', | ||
156 | - 'navTitle' => '我要咨询' | ||
157 | - ) | ||
158 | - ); | 133 | + $this->setTitle('我要咨询'); |
134 | + $this->setNavHeader('我要咨询'); | ||
159 | 135 | ||
160 | - $this->_view->assign('title', '我要咨询'); | ||
161 | - //$this->_view->display('brand', compact('brands')); | ||
162 | // 渲染模板 | 136 | // 渲染模板 |
163 | - $this->_view->display('consultform', $data); | 137 | + $this->_view->display('consultform', array('consultform' => true)); |
164 | } | 138 | } |
165 | 139 | ||
166 | /** | 140 | /** |
@@ -173,10 +147,10 @@ class DetailController extends AbstractAction | @@ -173,10 +147,10 @@ class DetailController extends AbstractAction | ||
173 | { | 147 | { |
174 | $result = array(); | 148 | $result = array(); |
175 | 149 | ||
176 | - //if ($this->isAjax()) { | ||
177 | - $productSkn = $this->get('productSkn', 50000058); | ||
178 | - $result = \Product\DetailModel::getPreference($productSkn); var_dump($result); | ||
179 | - //} | 150 | + if ($this->isAjax()) { |
151 | + $productSkn = $this->get('productSkn'); // 50000058 | ||
152 | + $result = \Product\DetailModel::getPreference($productSkn); | ||
153 | + } | ||
180 | 154 | ||
181 | if (empty($result)) { | 155 | if (empty($result)) { |
182 | echo ' '; | 156 | echo ' '; |
-
Please register or login to post a comment