Authored by ccbikai

增加品牌一览 搜索页面

framework @ 119c247f
Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05
... ...
... ... @@ -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();
});
... ...
... ... @@ -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;
}
}
}
... ...
{{> 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}}
... ...
... ... @@ -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$"
... ...