Authored by yyq

店铺封面图

@@ -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="shop_id" 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}}
@@ -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,
@@ -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%;
@@ -61,6 +61,41 @@ class ShopModel @@ -61,6 +61,41 @@ 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 + foreach ($sknProList['data']['product_list'] as $prod) {
  84 + $coverList[$prod['product_skn']] = HelperSearch::getProductPic(array(0 => $prod));
  85 + }
  86 +
  87 + foreach ($data['newArrivel']['list'] as $k => $v) {
  88 + if (isset($coverList[$v['product_skn']])) {
  89 + $data['newArrivel']['list'][$k]['img'] = $coverList[$v['product_skn']][0]['coverImg'];
  90 + }
  91 + }
  92 + foreach ($data['hotSingle']['list'] as $k => $v) {
  93 + if (isset($coverList[$v['product_skn']])) {
  94 + $data['hotSingle']['list'][$k]['img'] = $coverList[$v['product_skn']][0]['coverImg'];
  95 + }
  96 + }
  97 + }
  98 +
64 //店铺介绍 99 //店铺介绍
65 $data['brandIntro'] = self::getIntro($shopId, $parameters['uid']); 100 $data['brandIntro'] = self::getIntro($shopId, $parameters['uid']);
66 101
@@ -699,6 +734,7 @@ class ShopModel @@ -699,6 +734,7 @@ class ShopModel
699 public static function getResourceData($data, $shopId) 734 public static function getResourceData($data, $shopId)
700 { 735 {
701 $result = isset($data['resource_data']) ? json_decode($data['resource_data'], true) : array(); 736 $result = isset($data['resource_data']) ? json_decode($data['resource_data'], true) : array();
  737 +
702 foreach ($result as $key => &$val) { 738 foreach ($result as $key => &$val) {
703 $val['url'] = self::modifyUrl($val, $shopId); 739 $val['url'] = self::modifyUrl($val, $shopId);
704 740
@@ -714,9 +750,11 @@ class ShopModel @@ -714,9 +750,11 @@ class ShopModel
714 750
715 if (!isset($val['data']) && is_array($val)) { 751 if (!isset($val['data']) && is_array($val)) {
716 foreach ($val as $k1 => &$v1) { 752 foreach ($val as $k1 => &$v1) {
717 - $url = self::modifyUrl($v1, $shopId);  
718 - if (!empty($url)) {  
719 - $v1['url'] = $url; 753 + if (is_array($v1)) {
  754 + $url = self::modifyUrl($v1, $shopId);
  755 + if (!empty($url)) {
  756 + $v1['url'] = $url;
  757 + }
720 } 758 }
721 } 759 }
722 } 760 }
@@ -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, // 先不做