Authored by yyq

店铺封面图

... ... @@ -6,6 +6,16 @@
{{> product/shop-header}}
<div class="list-left pull-left">
<div class="shop-search">
<form action="//search.yohobuy.com" method="get" id="shop-search-form">
<span>
<input type="hidden" name="shop_id" value="{{shopId}}">
<input id="shop-query-key" type="text" name="query" class="shop-query-key" autocomplete="off" x-webkit-speech="" lang="zh-CN" placeholder="关键词搜索">
</span>
<span class="iconfont shop-query-submit">&#xe611;</span>
</form>
</div>
{{> product/left-content}}
{{> product/shop-sidebar}}
... ...
... ... @@ -10,6 +10,8 @@ var $ = require('yoho.jquery'),
var $shopIntro = $('.shop-intro'),
$shopCollect = $('.shop-collect'),
$shopSearch = $('#shop-search-form'),
$queryKey = $('#shop-query-key'),
$sliderLeft = $('.slider-left'),
$allGoods = $('.all-goods'),
$fixedArea = $allGoods.find('.fixed-area'),
... ... @@ -94,6 +96,12 @@ if (window.cookie('needColloect') * 1 === 1 && window.getUid()) {
});
}
$('.shop-query-submit').click(function() {
if ($queryKey.val()) {
$shopSearch.submit();
}
});
// 全部商品使用 pjax 翻页
$allGoods.pjax('a.pjax', '.goods-wrap', {
timeout: 5000,
... ...
... ... @@ -115,6 +115,34 @@
line-height: 28px;
}
.shop-search {
width: 100%;
border: 1px solid #3a3a3a;
margin-bottom: 10px;
overflow: hidden;
position: relative;
.shop-query-key {
width: 120px;
height: 34px;
border: none;
font-size: 13px;
padding: 0 34px 0 6px;
}
.shop-query-submit {
width: 34px;
height: 34px;
line-height: 38px;
font-size: 22px;
text-align: center;
position: absolute;
top: 0;
right: 0;
cursor: pointer;
}
}
.coupon {
margin-top: 20px;
width: 100%;
... ...
... ... @@ -61,6 +61,41 @@ class ShopModel
exit();
}
$sknList = array();
if (isset($data['newArrivel']['list'])) {
foreach ($data['newArrivel']['list'] as $prod) {
$sknList[] = $prod['productSkn'];
}
}
if (isset($data['hotSingle']['list'])) {
foreach ($data['hotSingle']['list'] as $prod) {
$sknList[] = $prod['productSkn'];
}
}
$sknProList = SearchData::searchAll(array('query' => join(',', array_unique($sknList))));
if (isset($sknProList['data']['product_list'])) {
$coverList = array();
foreach ($sknProList['data']['product_list'] as $prod) {
$coverList[$prod['product_skn']] = HelperSearch::getProductPic(array(0 => $prod));
}
foreach ($data['newArrivel']['list'] as $k => $v) {
if (isset($coverList[$v['product_skn']])) {
$data['newArrivel']['list'][$k]['img'] = $coverList[$v['product_skn']][0]['coverImg'];
}
}
foreach ($data['hotSingle']['list'] as $k => $v) {
if (isset($coverList[$v['product_skn']])) {
$data['hotSingle']['list'][$k]['img'] = $coverList[$v['product_skn']][0]['coverImg'];
}
}
}
//店铺介绍
$data['brandIntro'] = self::getIntro($shopId, $parameters['uid']);
... ... @@ -699,6 +734,7 @@ class ShopModel
public static function getResourceData($data, $shopId)
{
$result = isset($data['resource_data']) ? json_decode($data['resource_data'], true) : array();
foreach ($result as $key => &$val) {
$val['url'] = self::modifyUrl($val, $shopId);
... ... @@ -714,6 +750,7 @@ class ShopModel
if (!isset($val['data']) && is_array($val)) {
foreach ($val as $k1 => &$v1) {
if (is_array($v1)) {
$url = self::modifyUrl($v1, $shopId);
if (!empty($url)) {
$v1['url'] = $url;
... ... @@ -721,6 +758,7 @@ class ShopModel
}
}
}
}
$data['resource_data'] = $result;
return $data;
... ...
... ... @@ -489,6 +489,7 @@ class IndexController extends WebAction
$data = array_merge(
array(
'shopId' => $shopId,
'shopIndexPage' => true,
'pathNav' => false, // pathNav数据结构同其他页面
'coupon' => false, // 先不做
... ...