Authored by yyq

Merge branch 'feature/newPro-icon' into release/newProduct

@@ -220,7 +220,11 @@ class HelperSearch @@ -220,7 +220,11 @@ class HelperSearch
220 return array(); 220 return array();
221 } 221 }
222 $gender = isset(self::$params['gender']) ? self::$params['gender'] : Helpers::getGenderByCookie(); 222 $gender = isset(self::$params['gender']) ? self::$params['gender'] : Helpers::getGenderByCookie();
223 - $gender = substr($gender,0,1); 223 + if ($options['defaultCover'] && $gender === '1,2,3') {
  224 + $gender = 0;
  225 + } else {
  226 + $gender = substr($gender,0,1);
  227 + }
224 foreach($product as $key => $val){ 228 foreach($product as $key => $val){
225 if (!isset($val['goods_list']) || empty($val['goods_list'])) { 229 if (!isset($val['goods_list']) || empty($val['goods_list'])) {
226 continue; 230 continue;
@@ -6,6 +6,16 @@ @@ -6,6 +6,16 @@
6 {{> product/shop-header}} 6 {{> product/shop-header}}
7 7
8 <div class="list-left pull-left"> 8 <div class="list-left pull-left">
  9 + <div class="shop-search">
  10 + <form action="//search.yohobuy.com" method="get" id="shop-search-form">
  11 + <span>
  12 + <input type="hidden" name="shopId" value="{{shopId}}">
  13 + <input id="shop-query-key" type="text" name="query" class="shop-query-key" autocomplete="off" x-webkit-speech="" lang="zh-CN" placeholder="关键词搜索">
  14 + </span>
  15 + <span class="iconfont shop-query-submit">&#xe611;</span>
  16 + </form>
  17 + </div>
  18 +
9 {{> product/left-content}} 19 {{> product/left-content}}
10 20
11 {{> product/shop-sidebar}} 21 {{> product/shop-sidebar}}
@@ -6,6 +6,15 @@ @@ -6,6 +6,15 @@
6 {{> product/shop-header}} 6 {{> product/shop-header}}
7 7
8 <div class="list-left pull-left"> 8 <div class="list-left pull-left">
  9 + <div class="shop-search">
  10 + <form action="/shoplist" method="get" id="shop-search-form">
  11 + <span>
  12 + <input type="hidden" name="shopId" value="{{shopId}}">
  13 + <input id="shop-query-key" type="text" name="query" class="shop-query-key" autocomplete="off" x-webkit-speech="" lang="zh-CN" placeholder="关键词搜索">
  14 + </span>
  15 + <span class="iconfont shop-query-submit">&#xe611;</span>
  16 + </form>
  17 + </div>
9 {{> product/left-content}} 18 {{> product/left-content}}
10 19
11 {{> product/shop-sidebar}} 20 {{> product/shop-sidebar}}
No preview for this file type
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.

13.8 KB | W: | H:

14.7 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
@@ -10,6 +10,8 @@ var $ = require('yoho.jquery'), @@ -10,6 +10,8 @@ var $ = require('yoho.jquery'),
10 10
11 var $shopIntro = $('.shop-intro'), 11 var $shopIntro = $('.shop-intro'),
12 $shopCollect = $('.shop-collect'), 12 $shopCollect = $('.shop-collect'),
  13 + $shopSearch = $('#shop-search-form'),
  14 + $queryKey = $('#shop-query-key'),
13 $sliderLeft = $('.slider-left'), 15 $sliderLeft = $('.slider-left'),
14 $allGoods = $('.all-goods'), 16 $allGoods = $('.all-goods'),
15 $fixedArea = $allGoods.find('.fixed-area'), 17 $fixedArea = $allGoods.find('.fixed-area'),
@@ -94,6 +96,12 @@ if (window.cookie('needColloect') * 1 === 1 && window.getUid()) { @@ -94,6 +96,12 @@ if (window.cookie('needColloect') * 1 === 1 && window.getUid()) {
94 }); 96 });
95 } 97 }
96 98
  99 +$('.shop-query-submit').click(function() {
  100 + if ($queryKey.val()) {
  101 + $shopSearch.submit();
  102 + }
  103 +});
  104 +
97 // 全部商品使用 pjax 翻页 105 // 全部商品使用 pjax 翻页
98 $allGoods.pjax('a.pjax', '.goods-wrap', { 106 $allGoods.pjax('a.pjax', '.goods-wrap', {
99 timeout: 5000, 107 timeout: 5000,
@@ -110,6 +110,14 @@ @@ -110,6 +110,14 @@
110 background: #fff; 110 background: #fff;
111 } 111 }
112 112
  113 + .new-festival-tag {
  114 + width: 72px;
  115 + text-align: center;
  116 + background-image: url(/product/newPro-icon.png);
  117 + color: #000;
  118 + padding: 0;
  119 + }
  120 +
113 .thumbs { 121 .thumbs {
114 width: 75px; 122 width: 75px;
115 height: 510px; 123 height: 510px;
@@ -112,6 +112,14 @@ @@ -112,6 +112,14 @@
112 color: #4e4e4e; 112 color: #4e4e4e;
113 border: 1px solid #4e4e4e; 113 border: 1px solid #4e4e4e;
114 } 114 }
  115 +
  116 + .new-festival-tag {
  117 + width: 72px;
  118 + text-align: center;
  119 + background-image: url(/product/newPro-icon.png);
  120 + color: #000;
  121 + padding: 0;
  122 + }
115 } 123 }
116 } 124 }
117 125
@@ -115,6 +115,34 @@ @@ -115,6 +115,34 @@
115 line-height: 28px; 115 line-height: 28px;
116 } 116 }
117 117
  118 + .shop-search {
  119 + width: 100%;
  120 + border: 1px solid #3a3a3a;
  121 + margin-bottom: 10px;
  122 + overflow: hidden;
  123 + position: relative;
  124 +
  125 + .shop-query-key {
  126 + width: 120px;
  127 + height: 34px;
  128 + border: none;
  129 + font-size: 13px;
  130 + padding: 0 34px 0 6px;
  131 + }
  132 +
  133 + .shop-query-submit {
  134 + width: 34px;
  135 + height: 34px;
  136 + line-height: 38px;
  137 + font-size: 22px;
  138 + text-align: center;
  139 + position: absolute;
  140 + top: 0;
  141 + right: 0;
  142 + cursor: pointer;
  143 + }
  144 + }
  145 +
118 .coupon { 146 .coupon {
119 margin-top: 20px; 147 margin-top: 20px;
120 width: 100%; 148 width: 100%;
@@ -49,6 +49,7 @@ class SearchModel @@ -49,6 +49,7 @@ class SearchModel
49 'query' => FILTER_FLAG_NO_ENCODE_QUOTES , 49 'query' => FILTER_FLAG_NO_ENCODE_QUOTES ,
50 'keyword' => FILTER_FLAG_NO_ENCODE_QUOTES , 50 'keyword' => FILTER_FLAG_NO_ENCODE_QUOTES ,
51 'brand' => FILTER_SANITIZE_STRING, 51 'brand' => FILTER_SANITIZE_STRING,
  52 + 'shop' => FILTER_DEFAULT,
52 'sort' => FILTER_VALIDATE_INT, 53 'sort' => FILTER_VALIDATE_INT,
53 'category' => FILTER_VALIDATE_INT, 54 'category' => FILTER_VALIDATE_INT,
54 'channel' => FILTER_VALIDATE_INT, 55 'channel' => FILTER_VALIDATE_INT,
@@ -61,6 +61,46 @@ class ShopModel @@ -61,6 +61,46 @@ class ShopModel
61 exit(); 61 exit();
62 } 62 }
63 63
  64 + $sknList = array();
  65 +
  66 + if (isset($data['newArrivel']['list'])) {
  67 + foreach ($data['newArrivel']['list'] as $prod) {
  68 + $sknList[] = $prod['productSkn'];
  69 + }
  70 + }
  71 +
  72 + if (isset($data['hotSingle']['list'])) {
  73 + foreach ($data['hotSingle']['list'] as $prod) {
  74 + $sknList[] = $prod['productSkn'];
  75 + }
  76 + }
  77 +
  78 + $sknProList = SearchData::searchAll(array('query' => join(',', array_unique($sknList))));
  79 +
  80 + if (isset($sknProList['data']['product_list'])) {
  81 + $coverList = array();
  82 +
  83 + $proList = HelperSearch::getProductList($sknProList['data']['product_list'], array(
  84 + 'imgSize' => array(250, 250),
  85 + 'defaultCover' => true
  86 + ));
  87 +
  88 + foreach ($proList as $prod) {
  89 + $coverList[$prod['skn']] = $prod['thumb'];
  90 + }
  91 +
  92 + foreach ($data['newArrivel']['list'] as &$v) {
  93 + if (isset($coverList[$v['product_skn']])) {
  94 + $v['img'] = $coverList[$v['product_skn']];
  95 + }
  96 + }
  97 + foreach ($data['hotSingle']['list'] as &$v) {
  98 + if (isset($coverList[$v['product_skn']])) {
  99 + $v['img'] = $coverList[$v['product_skn']];
  100 + }
  101 + }
  102 + }
  103 +
64 //店铺介绍 104 //店铺介绍
65 $data['brandIntro'] = self::getIntro($shopId, $parameters['uid']); 105 $data['brandIntro'] = self::getIntro($shopId, $parameters['uid']);
66 106
@@ -87,7 +127,11 @@ class ShopModel @@ -87,7 +127,11 @@ class ShopModel
87 } 127 }
88 128
89 // 组织模板数据 129 // 组织模板数据
90 - $result = HelperSearch::getList($res, $searchCondition['options'], $searchCondition['userInput']); 130 + $result = HelperSearch::getList($res, array_merge(
  131 + array('defaultCover' => true),
  132 + $searchCondition['options']
  133 + ), $searchCondition['userInput']);
  134 +
91 $data['pathNav'] = array_merge( 135 $data['pathNav'] = array_merge(
92 HelperSearch::$listNav, 136 HelperSearch::$listNav,
93 array( 137 array(
@@ -169,7 +213,10 @@ class ShopModel @@ -169,7 +213,10 @@ class ShopModel
169 } 213 }
170 214
171 // 组织模板数据 215 // 组织模板数据
172 - $result = HelperSearch::getList($res, $searchCondition['options'], $searchCondition['userInput']); 216 + $result = HelperSearch::getList($res, array_merge(
  217 + array('defaultCover' => true),
  218 + $searchCondition['options']
  219 + ), $searchCondition['userInput']);
173 220
174 $data['goods'] = $result['goods']; 221 $data['goods'] = $result['goods'];
175 $data['opts'] = $result['opts']; 222 $data['opts'] = $result['opts'];
@@ -699,6 +746,7 @@ class ShopModel @@ -699,6 +746,7 @@ class ShopModel
699 public static function getResourceData($data, $shopId) 746 public static function getResourceData($data, $shopId)
700 { 747 {
701 $result = isset($data['resource_data']) ? json_decode($data['resource_data'], true) : array(); 748 $result = isset($data['resource_data']) ? json_decode($data['resource_data'], true) : array();
  749 +
702 foreach ($result as $key => &$val) { 750 foreach ($result as $key => &$val) {
703 $val['url'] = self::modifyUrl($val, $shopId); 751 $val['url'] = self::modifyUrl($val, $shopId);
704 752
@@ -714,9 +762,11 @@ class ShopModel @@ -714,9 +762,11 @@ class ShopModel
714 762
715 if (!isset($val['data']) && is_array($val)) { 763 if (!isset($val['data']) && is_array($val)) {
716 foreach ($val as $k1 => &$v1) { 764 foreach ($val as $k1 => &$v1) {
717 - $url = self::modifyUrl($v1, $shopId);  
718 - if (!empty($url)) {  
719 - $v1['url'] = $url; 765 + if (is_array($v1)) {
  766 + $url = self::modifyUrl($v1, $shopId);
  767 + if (!empty($url)) {
  768 + $v1['url'] = $url;
  769 + }
720 } 770 }
721 } 771 }
722 } 772 }
@@ -489,6 +489,7 @@ class IndexController extends WebAction @@ -489,6 +489,7 @@ class IndexController extends WebAction
489 489
490 $data = array_merge( 490 $data = array_merge(
491 array( 491 array(
  492 + 'shopId' => $shopId,
492 'shopIndexPage' => true, 493 'shopIndexPage' => true,
493 'pathNav' => false, // pathNav数据结构同其他页面 494 'pathNav' => false, // pathNav数据结构同其他页面
494 'coupon' => false, // 先不做 495 'coupon' => false, // 先不做
@@ -540,6 +541,7 @@ class IndexController extends WebAction @@ -540,6 +541,7 @@ class IndexController extends WebAction
540 $data = array_merge( 541 $data = array_merge(
541 array( 542 array(
542 'shopIndexPage' => true, 543 'shopIndexPage' => true,
  544 + 'shopId' => $shopId,
543 'pathNav' => false, // pathNav数据结构同其他页面 545 'pathNav' => false, // pathNav数据结构同其他页面
544 'coupon' => false, // 先不做 546 'coupon' => false, // 先不做
545 ), 547 ),