Authored by 毕凯

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

@@ -941,6 +941,7 @@ class HelperSearch @@ -941,6 +941,7 @@ class HelperSearch
941 if ($data) { 941 if ($data) {
942 $result['conditions'] = $data; 942 $result['conditions'] = $data;
943 } 943 }
  944 + $result['clearUrl'] = self::current();
944 return $result; 945 return $result;
945 } 946 }
946 947
@@ -1369,8 +1370,6 @@ class HelperSearch @@ -1369,8 +1370,6 @@ class HelperSearch
1369 public static function filter() 1370 public static function filter()
1370 { 1371 {
1371 $result = array(); 1372 $result = array();
1372 - //清除选中  
1373 - $result['checkedConditions']['clearUrl'] = self::current();  
1374 //频道 1373 //频道
1375 $result['channel'] = array(); 1374 $result['channel'] = array();
1376 //性别 1375 //性别
@@ -242,10 +242,12 @@ $yohoPage.on('touchstart', '.color-list .block', function() { @@ -242,10 +242,12 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
242 // 颜色块切换勾选样式 242 // 颜色块切换勾选样式
243 $this.siblings('.chosed').removeClass('chosed'); 243 $this.siblings('.chosed').removeClass('chosed');
244 244
245 - // 特殊处理 245 + // 特殊处理: 老的选中尺码在新选中的颜色对应尺码中不存在, 需要将颜色的第一行对应的颜色块加上勾选样式.
246 if (-1 === curGoodNum) { 246 if (-1 === curGoodNum) {
247 $curColorBlock = $($colorRowList.eq(0).children().get(index)); 247 $curColorBlock = $($colorRowList.eq(0).children().get(index));
248 $curColorBlock.addClass('chosed'); 248 $curColorBlock.addClass('chosed');
  249 +
  250 + // 当前选择的颜色块,加上勾选样式
249 } else { 251 } else {
250 $this.toggleClass('chosed'); 252 $this.toggleClass('chosed');
251 } 253 }
@@ -40,13 +40,16 @@ $('.employ span').each(function(index) { @@ -40,13 +40,16 @@ $('.employ span').each(function(index) {
40 }); 40 });
41 }); 41 });
42 42
43 -  
44 -$(window).scroll(function() {  
45 - if ($(window).scrollTop() + $(window).height() > $('body').height() - 1) { 43 +function scrollHandler() {
  44 + if ($(window).scrollTop() + $(window).height() > $('body').height() - 100) {
46 page++; 45 page++;
47 couponAJAX(statu, page); 46 couponAJAX(statu, page);
48 return; 47 return;
49 } 48 }
  49 +}
50 50
  51 +$(window).scroll(function() {
  52 + window.requestAnimationFrame(scrollHandler);
51 }); 53 });
  54 +
52 couponAJAX(statu, page); 55 couponAJAX(statu, page);
@@ -16,12 +16,16 @@ function ajaxCurrencyDetail(page) { @@ -16,12 +16,16 @@ function ajaxCurrencyDetail(page) {
16 }); 16 });
17 } 17 }
18 18
19 -$(window).scroll(function() {  
20 - if ($(window).scrollTop() + $(window).height() > $('body').height() - 1) { 19 +function scrollHandler() {
  20 + if ($(window).scrollTop() + $(window).height() > $('body').height() - 100) {
21 page++; 21 page++;
22 ajaxCurrencyDetail(page); 22 ajaxCurrencyDetail(page);
23 return; 23 return;
24 } 24 }
  25 +}
  26 +
  27 +$(window).scroll(function() {
  28 + window.requestAnimationFrame(scrollHandler);
25 }); 29 });
26 30
27 -ajaxCurrencyDetail(page);  
  31 +ajaxCurrencyDetail(page);
@@ -51,7 +51,7 @@ var $listNav = $('#list-nav'), @@ -51,7 +51,7 @@ var $listNav = $('#list-nav'),
51 end: false 51 end: false
52 }, 52 },
53 discount: { 53 discount: {
54 - order: 0, 54 + order: 1,
55 reload: true, 55 reload: true,
56 page: 0, 56 page: 0,
57 end: false 57 end: false
@@ -70,8 +70,8 @@ @@ -70,8 +70,8 @@
70 <a href="javascript:void(0);"> 70 <a href="javascript:void(0);">
71 <span class="nav-txt">折扣</span> 71 <span class="nav-txt">折扣</span>
72 <span class="icon"> 72 <span class="icon">
73 - <i class="iconfont up">&#xe615;</i>  
74 - <i class="iconfont down cur">&#xe616;</i> 73 + <i class="iconfont up cur">&#xe615;</i>
  74 + <i class="iconfont down">&#xe616;</i>
75 </span> 75 </span>
76 </a> 76 </a>
77 </li> 77 </li>
@@ -98,7 +98,7 @@ @@ -98,7 +98,7 @@
98 <li class="hide" key="2"> 98 <li class="hide" key="2">
99 <form class="feed-back-form" action="#"> 99 <form class="feed-back-form" action="#">
100 <div>您对新版还有哪些意见或建议?</div> 100 <div>您对新版还有哪些意见或建议?</div>
101 - <textarea name="answer" id="feedback-answer"></textarea> 101 + <textarea name="answer" id="feedback-answer" class="feedback-answer"></textarea>
102 <div> 102 <div>
103 <span class="feed-back-btn button">提交</span> 103 <span class="feed-back-btn button">提交</span>
104 </div> 104 </div>
@@ -208,22 +208,24 @@ @@ -208,22 +208,24 @@
208 <div class="senior-sub-wrap"> 208 <div class="senior-sub-wrap">
209 {{#each seniorChose}} 209 {{#each seniorChose}}
210 <div class="senior-sub hide" data-attr="{{attr}}"> 210 <div class="senior-sub hide" data-attr="{{attr}}">
211 - {{#if showMulti}}  
212 - <span class="multi-select">多选 +</span>  
213 - {{/if}}  
214 - <ul class="clearfix check-container">  
215 - {{#each sub}}  
216 - <li class="attr {{#if checked}}checked{{/if}}">  
217 - <a href="{{href}}">  
218 - <span class="iconfont checkbox" data-id="{{id}}">&#xe613;</span>  
219 - <span>{{name}}</span>  
220 - </a>  
221 - </li>  
222 - {{/each}}  
223 - </ul>  
224 - <div class="btns">  
225 - <button class="multi-select-ok dis">确定</button>  
226 - <button class="multi-select-cancel">取消</button> 211 + <div class="senior-content">
  212 + {{#if showMulti}}
  213 + <span class="multi-select">多选 +</span>
  214 + {{/if}}
  215 + <ul class="clearfix check-container">
  216 + {{#each sub}}
  217 + <li class="attr {{#if checked}}checked{{/if}}">
  218 + <a href="{{href}}">
  219 + <span class="iconfont checkbox" data-id="{{id}}">&#xe613;</span>
  220 + <span>{{name}}</span>
  221 + </a>
  222 + </li>
  223 + {{/each}}
  224 + </ul>
  225 + <div class="btns">
  226 + <button class="multi-select-ok dis">确定</button>
  227 + <button class="multi-select-cancel">取消</button>
  228 + </div>
227 </div> 229 </div>
228 </div> 230 </div>
229 {{/each}} 231 {{/each}}
@@ -8,8 +8,6 @@ var $ = require('yoho.jquery'); @@ -8,8 +8,6 @@ var $ = require('yoho.jquery');
8 8
9 var $returnTop = $('.return-top'); 9 var $returnTop = $('.return-top');
10 10
11 -var apiDomain;  
12 -  
13 /** 11 /**
14 * 订阅 12 * 订阅
15 * @return {[type]} [description] 13 * @return {[type]} [description]
@@ -19,41 +17,36 @@ function actionSubscription() { @@ -19,41 +17,36 @@ function actionSubscription() {
19 $subscriberBtn = $('#subscriber-btn'), 17 $subscriberBtn = $('#subscriber-btn'),
20 emailReg = /^[.\-_a-zA-Z0-9]+@[\-_a-zA-Z0-9]+\.[a-zA-Z0-9]/; 18 emailReg = /^[.\-_a-zA-Z0-9]+@[\-_a-zA-Z0-9]+\.[a-zA-Z0-9]/;
21 19
22 - var subscribeParam = {  
23 - method: 'open.subscriber.subscriber',  
24 - v: 1,  
25 - return_type: 'jsonp',  
26 - open_key: '12345'  
27 - };  
28 -  
29 var iconCode = { 20 var iconCode = {
30 mail: '&#xe61b;', 21 mail: '&#xe61b;',
31 tick: '&#xe61a' 22 tick: '&#xe61a'
32 }; 23 };
33 24
34 - var email = $.trim($subscriberBox.val());  
35 -  
36 - var params = {};  
37 -  
38 $subscriberBox.focus(function() { 25 $subscriberBox.focus(function() {
39 $(this).val('').css('color', ''); 26 $(this).val('').css('color', '');
40 $subscriberBtn.removeClass('done').html(iconCode.mail); 27 $subscriberBtn.removeClass('done').html(iconCode.mail);
41 }); 28 });
42 29
43 $subscriberBtn.click(function() { 30 $subscriberBtn.click(function() {
  31 + var email = $.trim($subscriberBox.val());
  32 +
44 if (email !== '' && emailReg.test(email)) { 33 if (email !== '' && emailReg.test(email)) {
45 - $.extend(params, subscribeParam, {  
46 - email: email,  
47 - tmp: Math.random(),  
48 - uid: $.uid('_UID')  
49 - });  
50 try { 34 try {
51 - $.getJSON('http://test.open.yohobuy.com' + '/?callback=?', params, function(data) {  
52 - if (data.data.result === 1) {  
53 - $subscriberBox.val('已订阅到:' + email);  
54 - $subscriberBtn.addClass('done').html(iconCode.tick);  
55 - } else {  
56 - $subscriberBox.css('color', 'red'); 35 + $.ajax({
  36 + url: 'http://www.yohobuy.com/common/emailsubscriber',
  37 + dataType: 'jsonp',
  38 + data: {
  39 + email: email,
  40 + tmp: Math.random(),
  41 + uid: window.getUid()
  42 + },
  43 + success: function(data) {
  44 + if (data.data.result === 1) {
  45 + $subscriberBox.val('已订阅到:' + email);
  46 + $subscriberBtn.addClass('done').html(iconCode.tick);
  47 + } else {
  48 + $subscriberBox.css('color', 'red');
  49 + }
57 } 50 }
58 }); 51 });
59 } catch (e) { 52 } catch (e) {
@@ -90,7 +83,6 @@ function actionhomeFootChange() { @@ -90,7 +83,6 @@ function actionhomeFootChange() {
90 var $this = $(this), 83 var $this = $(this),
91 $li = $this.closest('li'), 84 $li = $this.closest('li'),
92 index = $li.index(), 85 index = $li.index(),
93 - params = {},  
94 _solution = []; 86 _solution = [];
95 87
96 var _answer = $li.find('.feedback-answer').val(), 88 var _answer = $li.find('.feedback-answer').val(),
@@ -101,28 +93,30 @@ function actionhomeFootChange() { @@ -101,28 +93,30 @@ function actionhomeFootChange() {
101 _solution.push($(this).val()); 93 _solution.push($(this).val());
102 }); 94 });
103 95
104 - params = {  
105 - method: 'open.feedback.submit',  
106 - feedback: _feedback || 0,  
107 - question: _question || 0,  
108 - answer: _answer || '',  
109 - solution: _solution.join(',')  
110 - };  
111 -  
112 - $.getData(apiDomain, params, function(data) {  
113 - var next = index + 1;  
114 -  
115 - if (data.result === 1) {  
116 - if (index === count - 1) {  
117 - alert('感谢您的参与!');  
118 - return;  
119 - } 96 + $.ajax({
  97 + url: 'http://www.yohobuy.com/common/suggestfeedback',
  98 + dataType: 'jsonp',
  99 + data: {
  100 + feedback_id: _feedback || 0,
  101 + question_id: _question || 0,
  102 + answer: _answer || '',
  103 + solution: _solution.join(',')
  104 + },
  105 + success: function(data) {
  106 + var next = index + 1;
  107 +
  108 + if (~~data.data.result === 1) {
  109 + if (index === count - 1) {
  110 + alert('感谢您的参与!');
  111 + return;
  112 + }
120 113
121 - $li.addClass('hide'); 114 + $li.addClass('hide');
122 115
123 - $vote.eq(index + 1).removeClass('hide');  
124 - $feedBackPage.children('.cur').removeClass('cur');  
125 - $feedBackPage.eq(next).addClass('cur'); 116 + $vote.children(':eq(' + (index + 1) + ')').removeClass('hide');
  117 + $feedBackPage.children('.cur').removeClass('cur');
  118 + $feedBackPage.children(':eq(' + next + ')').addClass('cur');
  119 + }
126 } 120 }
127 }); 121 });
128 }); 122 });
@@ -293,7 +293,6 @@ @@ -293,7 +293,6 @@
293 293
294 .senior { 294 .senior {
295 padding-bottom: 6px; 295 padding-bottom: 6px;
296 - padding-right: 0;  
297 296
298 .attr-content { 297 .attr-content {
299 position: relative; 298 position: relative;
@@ -306,6 +305,8 @@ @@ -306,6 +305,8 @@
306 305
307 .senior-attr-wrap > .attr:hover, 306 .senior-attr-wrap > .attr:hover,
308 .senior-attr-wrap > .attr.hover { 307 .senior-attr-wrap > .attr.hover {
  308 + font-weight: bold;
  309 +
309 > .iconfont { 310 > .iconfont {
310 visibility: hidden; 311 visibility: hidden;
311 } 312 }
@@ -318,13 +319,13 @@ @@ -318,13 +319,13 @@
318 .senior-sub { 319 .senior-sub {
319 box-sizing: border-box; 320 box-sizing: border-box;
320 position: absolute; 321 position: absolute;
321 - padding: 15px 0 15px 91px; 322 + padding: 0 15px 15px 91px;
322 left: -91px; 323 left: -91px;
323 - right: -1px; 324 + right: -16px;
324 top: 39px; 325 top: 39px;
325 background: #fff; 326 background: #fff;
326 border: 1px solid #dfdfdf; 327 border: 1px solid #dfdfdf;
327 - border-top-color: #eaeceb; 328 + border-top: 0;
328 z-index: 2; 329 z-index: 2;
329 330
330 ul { 331 ul {
@@ -342,6 +343,11 @@ @@ -342,6 +343,11 @@
342 } 343 }
343 } 344 }
344 345
  346 + .senior-content {
  347 + padding-top: 15px;
  348 + border-top: 1px solid #eaeceb;
  349 + }
  350 +
345 .senior-up-icon { 351 .senior-up-icon {
346 position: relative; 352 position: relative;
347 width: 100%; 353 width: 100%;
@@ -217,7 +217,7 @@ class SearchModel @@ -217,7 +217,7 @@ class SearchModel
217 $result = SearchData::getSuggest($query); 217 $result = SearchData::getSuggest($query);
218 if (isset($result['code']) && $result['code'] == 200 && isset($result['suggest']['items']) && !empty($result['suggest']['items'])) { 218 if (isset($result['code']) && $result['code'] == 200 && isset($result['suggest']['items']) && !empty($result['suggest']['items'])) {
219 foreach ($result['suggest']['items'] as $v) { 219 foreach ($result['suggest']['items'] as $v) {
220 - $data .= '<li><a style="display: block;" href="http://search.yohobuy.com/?query='.$v['item'].'" class="clearfix clear search-item" title="'.$v['item'].'" act="http://search.yohobuy.com/?query='.$v['item'].'"><span class="searchvalue" >'.$v['item'].'</span><span class="valuenum">约'.$v['frequency'].'个商品</span></a></li>'; 220 + $data []= '<li><a style="display: block;" href="http://search.yohobuy.com/?query='.$v['item'].'" class="clearfix clear search-item" title="'.$v['item'].'" act="http://search.yohobuy.com/?query='.$v['item'].'"><span class="searchvalue" >'.$v['item'].'</span><span class="valuenum">约'.$v['frequency'].'个商品</span></a></li>';
221 } 221 }
222 } 222 }
223 return $data; 223 return $data;
@@ -21,13 +21,21 @@ class SearchController extends WebAction @@ -21,13 +21,21 @@ class SearchController extends WebAction
21 */ 21 */
22 public function suggestAction() 22 public function suggestAction()
23 { 23 {
24 - $suggest = ''; 24 + $callback = $this->get('callback');
25 $query = rawurldecode($this->get('query')); 25 $query = rawurldecode($this->get('query'));
  26 + $size = rawurldecode($this->get('size',10));
  27 + if (empty($query)) {
  28 + $this->helpJsonCallbackResult($callback, 412, '搜索词为空');
  29 + }
  30 + if ($size > 50) {
  31 + $size = 10;
  32 + }
26 if ($query) { 33 if ($query) {
27 $param['query'] = $query; 34 $param['query'] = $query;
  35 + $param['size'] = $size;
28 $suggest = SearchModel::getSuggest($param); 36 $suggest = SearchModel::getSuggest($param);
29 } 37 }
30 - echo $suggest; 38 + $this->helpJsonCallbackResult($callback, 200, 'suggest', $suggest);
31 } 39 }
32 40
33 /** 41 /**