Authored by 郭成尧

Merge branch 'release/newSearch'

@@ -365,15 +365,7 @@ const favoriteBrand = (req, res, next) => { @@ -365,15 +365,7 @@ const favoriteBrand = (req, res, next) => {
365 let opt = req.query.opt || 'ok'; 365 let opt = req.query.opt || 'ok';
366 let type = req.query.type || 'product'; 366 let type = req.query.type || 'product';
367 let appVersion = req.query.appVersion || false; 367 let appVersion = req.query.appVersion || false;
368 - let refer = req.headers.origin;  
369 -  
370 - if (req.headers.referer) {  
371 - let refererSplit = _.split(req.headers.referer, '?');  
372 -  
373 - if (id) {  
374 - refer = refererSplit[0] + '?shop_id=' + id;  
375 - }  
376 - } 368 + let refer = req.get('referer');
377 369
378 let url = helpers.urlFormat('/signin.html') + '?refer=' + refer; 370 let url = helpers.urlFormat('/signin.html') + '?refer=' + refer;
379 371
@@ -385,6 +377,7 @@ const favoriteBrand = (req, res, next) => { @@ -385,6 +377,7 @@ const favoriteBrand = (req, res, next) => {
385 } 377 }
386 378
387 url = `${refer}&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"${refer}","param":{}},"requesturl":{"param":{"method":"app.favorite.add","id":"${id}","fav_id":"${id}","type":"shop"},"url":"${_.get(global, 'yoho.API.ApiUrl', '')}"},"priority":"Y"}}`; // eslint-disable-line 379 url = `${refer}&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"${refer}","param":{}},"requesturl":{"param":{"method":"app.favorite.add","id":"${id}","fav_id":"${id}","type":"shop"},"url":"${_.get(global, 'yoho.API.ApiUrl', '')}"},"priority":"Y"}}`; // eslint-disable-line
  380 +
388 } 381 }
389 382
390 if (!id) { 383 if (!id) {
@@ -476,23 +469,7 @@ const userCoupon = (req, res, next) => { @@ -476,23 +469,7 @@ const userCoupon = (req, res, next) => {
476 return; 469 return;
477 }).catch(next); 470 }).catch(next);
478 } else { 471 } else {
479 - let refer = req.headers.origin;  
480 -  
481 - if (req.headers.referer) {  
482 - let refererSplit = _.split(req.headers.referer, '?');  
483 -  
484 - let shopIdSplit = _.split(refererSplit[1], '&');  
485 - let shopId = '';  
486 -  
487 - _.forEach(shopIdSplit, value => {  
488 - if (_.startsWith(value, 'shop_id')) {  
489 - shopId = value;  
490 - return;  
491 - }  
492 - });  
493 -  
494 - refer = refererSplit[0] + '?' + shopId;  
495 - } 472 + let refer = req.get('referer');
496 473
497 if (req.yoho.isApp !== 'false') { 474 if (req.yoho.isApp !== 'false') {
498 let toUrl = refer + '&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' + 475 let toUrl = refer + '&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' +
@@ -365,6 +365,16 @@ const _formShopData = (data, shopId, isApp) => { @@ -365,6 +365,16 @@ const _formShopData = (data, shopId, isApp) => {
365 title: '全部商品' 365 title: '全部商品'
366 }; 366 };
367 367
  368 + let moreUrl = helpers.urlFormat('', {
  369 + shop_id: shopId,
  370 + order: 's_n_d',
  371 + title: '人气单品'
  372 + }, 'search'); // 人气单品的链接
  373 +
  374 + if (isApp) {
  375 + moreUrl = 'openby:yohobuy={"action":"go.list","params":{"shop_id":"' + shopId + '","title":"人气单品"}}';
  376 + }
  377 +
368 formatData = _.assign({ 378 formatData = _.assign({
369 shopIntro: _.get(data, 'shopInfo.shop_intro', ''), 379 shopIntro: _.get(data, 'shopInfo.shop_intro', ''),
370 logoImg: _.get(data, 'shopInfo.shop_logo', ''), 380 logoImg: _.get(data, 'shopInfo.shop_logo', ''),
@@ -375,11 +385,7 @@ const _formShopData = (data, shopId, isApp) => { @@ -375,11 +385,7 @@ const _formShopData = (data, shopId, isApp) => {
375 url: helpers.urlFormat('', { 385 url: helpers.urlFormat('', {
376 shop_id: shopId 386 shop_id: shopId
377 }, 'search'), // 搜索链接 387 }, 'search'), // 搜索链接
378 - more_url: helpers.urlFormat('', {  
379 - shop_id: shopId,  
380 - order: 's_n_d',  
381 - title: '人气单品'  
382 - }, 'search') // 人气单品的链接 388 + more_url: moreUrl
383 }, formatData); 389 }, formatData);
384 390
385 if (single) { // 单品点 391 if (single) { // 单品点
@@ -187,12 +187,16 @@ $search.on('touchend', function() { @@ -187,12 +187,16 @@ $search.on('touchend', function() {
187 } 187 }
188 188
189 $history.html(html); 189 $history.html(html);
  190 +
190 if (html !== '') { 191 if (html !== '') {
191 $clearHistory.removeClass('hide'); 192 $clearHistory.removeClass('hide');
192 $historySearch.removeClass('hide'); 193 $historySearch.removeClass('hide');
193 } 194 }
194 195
195 - // window.rePosFooter(); 196 + window.rePosFooter();
  197 + } else {
  198 + $historySearch.hide();
  199 + $clearHistory.hide();
196 } 200 }
197 } 201 }
198 }()); 202 }());