Authored by 梁志锋

update

... ... @@ -52,11 +52,60 @@ if ($brandList.length > 0) {
});
}
myHammer = new Hammer($('#right-bar .con').find('b').unbind()[0]);
myHammer.on('tap', function(e) {
if ($('#right-bar .con').find('b').unbind()[0]) {
myHammer = new Hammer($('#right-bar .con').find('b').unbind()[0]);
myHammer.on('tap', function(e) {
var index = $(this).index();
if ($('.bar-' + index).size() > 0) {
document.body.scrollTop = parseInt($('.bar-' + index)[0].offsetTop) - parseInt(brandSwipe - 1);
}
});
}
function searchResult(type) {
var keyword = $('#keyword').val(),
gender = $('#gender').val();
$.get('/brands/search', {
keyword: keyword,
gender: gender,
type: type
}, function(html) {
$('.search-result').html(html);
});
}
$('#keyword').on('keyup', function() {
searchResult(0);
}).on('keydown', function() {
$(this).closest('.search-box').css('width', '11.25rem');
$('.search-action').show();
}).on('blur', function() {
$(this).closest('.search-box').css('width', '12.5rem');
$('.search-action').hide();
});
$('#search-btn').on('tap', function() {
searchResult(1);
});
$('.clear-text').on('tap', function() {
$('#keyword').val('').trigger('input');
});
$('form.search-box').on('submit', function() {
return false;
});
$('.clear-history').on('tap', function() {
// setcookie('h_brands', '', {
// expire: -1,
// path: '/',
// domain: '.m.yohobuy.com'
// });
$('#history-keyword').remove();
$(this).hide();
});
... ...
... ... @@ -57,7 +57,7 @@
img {
display: block;
width: 100%;
height: 366rem / $pxConvertRem;
// height: 366rem / $pxConvertRem;
}
.few-tag {
... ...
... ... @@ -11,6 +11,7 @@
z-index: 2;
.search-box {
position: relative;
width: 500rem / $pxConvertRem;//450
height: 60rem / $pxConvertRem;
background-color: #FFF;
border-radius: 30rem / $pxConvertRem;
... ... @@ -37,7 +38,25 @@
line-height: 60rem / $pxConvertRem;
color: #bdbdbd;
}
.search-input {
border: none;
width: 95%;
height: 60rem / $pxConvertRem;
line-height: 1;
padding: 0 10rem / $pxConvertRem;
}
.search-action {
display: none;
position: absolute;
top: 0;
right: -74rem / $pxConvertRem;
font-size: 32rem / $pxConvertRem;
line-height: 60rem / $pxConvertRem;
color: #666;
}
.clear-text {
margin-right: 20rem / $pxConvertRem;
}
}
}
... ...
... ... @@ -17,6 +17,10 @@
height: 192rem / $pxConvertRem;
border-bottom: 1px solid #e0e0e0;
border-right: 1px solid #e0e0e0;
border-top: 1px solid #e0e0e0;
&:nth-child(-n+3) {
border-bottom: none;
}
}
.classify-logo {
... ...
... ... @@ -70,14 +70,15 @@
.brands-swiper {
background: #fff;
width: 100%;
height: 140rem / $pxConvertRem;
height: 160rem / $pxConvertRem;
padding-top: 20rem / $pxConvertRem;
// margin-bottom: 28rem / $pxConvertRem;
border-top: 1px solid #e0e0e0;
overflow: hidden;
.brands-list {
position: relative;
height: 140rem / $pxConvertRem;
height: 160rem / $pxConvertRem;
li {
float: left;
... ...
{{> layout/header}}
<div class="brand-page yoho-page">
<div class="newbrand-search">
<form class="search-box clearfix">
<input type="text" class="search-input" id="keyword" placeholder="查找品牌">
<input type="hidden" id="gender" name="gender" value="1,3">
<i class="search-icon iconfont">&#xe60f;</i>
<div class="search-action">
<span class="iconfont clear-text">&#xe623;</span>
<span class="search-btn">搜索</span>
</div>
</form>
</div>
<div class="search-result">
</div>
</div>
{{> layout/footer}}
{{> layout/download_app}}
... ...
{{> layout/page_footer}}
{{> layout/download_app}}
{{#if hasWxShare}}
<script type="text/javascript" charset="utf-8" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
{{/if}}
{{#if rlsEnv}}
<script src="http://cdn.yoho.cn/myohobuy/{{version}}/lib.js"></script>
<script src="http://cdn.yoho.cn/myohobuy/{{version}}/index.js"></script>
... ...
... ... @@ -24,7 +24,6 @@
</script>
{{/if}}
{{#if guangDetail}}
<script type="text/javascript" charset="utf-8" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
seajs.use('js/guang/detail');
</script>
... ...
... ... @@ -43,4 +43,39 @@ class BrandController extends AbstractAction
$this->_view->display('index', Category\BrandModel::getBrandByChannel($channel));
}
/**
* 品牌一览搜索页
*
* @param string gender 老版本中使用的参数, 做兼容判断
* @param int channel 1表示男生频道, 2表示女生频道, 3表示潮童频道, 4表示创意生活频道
*/
public function searchAction()
{
$this->setTitle('品牌一览');
$this->setNavHeader('品牌一览');
/* 判断参数是否有效 */
$channel = null;
$gender = $this->get('gender');
if (!empty($gender)) {
switch ($gender) {
case '1,3': // 男
$channel = 1;
break;
case '2,3': // 女
$channel = 2;
break;
}
}
if (!isset($channel)) {
$channel = $this->get('channel', 1);
if (!is_numeric($channel) || intval($channel) > 4) {
$channel = 1;
}
}
// 渲染模板
$this->_view->display('search', Category\BrandModel::getBrandByChannel($channel));
}
}
... ...
... ... @@ -68,6 +68,13 @@ routes.brands.route.module = Category
routes.brands.route.controller = Brand
routes.brands.route.action = Index
; 品牌一览搜索页
routes.brands.type = "rewrite"
routes.brands.match = "/brands/search"
routes.brands.route.module = Category
routes.brands.route.controller = Brand
routes.brands.route.action = Search
; 新品到着(NEW)
routes.productnew.type = "rewrite"
routes.productnew.match = "/product/new$"
... ...