Authored by hf

Merge remote-tracking branch 'origin/develop' into test

framework @ 119c247f
Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05
... ...
... ... @@ -14,11 +14,11 @@ class Helpers
* 备注:所有的URL构建都尽量使用该方法,便于以后维护.
*
* @param string $uri 如 "/passport/reg/index"
* @param array $param 参数项 array(key1 => value1, key2 => value2,)
* @param array $param 参数项 array(key1 => value1, key2 => value2,),默认为array()
* @param string $module 模块名 如"index"表示默认, "guang"表示逛,"list"表示商品列表,"search"表示搜索
* @return string
*/
public static function url($uri, $param, $module = 'index')
public static function url($uri, $param = array(), $module = 'index')
{
$url = '';
... ...
... ... @@ -5,7 +5,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer'),
Hammer = require('yoho.hammer'),
Swiper = require('yoho.iswiper'),
lazyLoad = require('yoho.lazyload');
... ... @@ -52,11 +52,60 @@ if ($brandList.length > 0) {
});
}
myHammer = new Hammer($('#right-bar .con').find('b').unbind()[0]);
myHammer.on('tap', function(e) {
var index = $(this).index();
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);
}
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();
});
... ...
... ... @@ -5,7 +5,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer');
Hammer = require('yoho.hammer');
var $nav = $('.category-nav'),
$categoryContainer = $('.category-container'),
... ...
... ... @@ -5,7 +5,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer'),
Hammer = require('yoho.hammer'),
Swiper = require('yoho.iswiper');
var info = require('./info'),
... ...
... ... @@ -5,7 +5,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer'),
Hammer = require('yoho.hammer'),
ellipsis = require('mlellipsis'),
lazyLoad = require('yoho.lazyload');
... ...
... ... @@ -5,7 +5,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer'),
Hammer = require('yoho.hammer'),
ellipsis = require('mlellipsis'),
lazyLoad = require('yoho.lazyload');
... ... @@ -85,7 +85,9 @@ likeHammer.on('tap', function(e) {
success: function(data) {
if (data.code === 200) {
$this.toggleClass('like');
} else if (data.code === 400) {
} else if (data.code === 400 || data.code === 412) {
//code:412 用户ID不正确,即未登录
tip.show('未登录');
} else {
tip.show(data.message);
... ...
... ... @@ -5,7 +5,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer'),
Hammer = require('yoho.hammer'),
lazyLoad = require('yoho.lazyload'),
Swiper = require('yoho.iswiper');
... ...
... ... @@ -4,7 +4,7 @@
* @date: 2015/10/12
*/
var $ = require('jquery'),
Hammer = require('hammer'),
Hammer = require('yoho.hammer'),
Swiper = require('yoho.iswiper'),
lazyLoad = require('yoho.lazyload'),
$mobileWrap = $('.mobile-wrap'),
... ... @@ -45,6 +45,7 @@ navHammer.on('tap', function(event) {
});
event.srcEvent.stopPropagation();
return false;
});
mobileWrapHammer = new Hammer($('.mobile-wrap')[0]);
... ... @@ -62,11 +63,12 @@ mobileWrapHammer.on('tap', function(e) {
$('.overlay').hide();
}, 300);
e.srcEvent.stopPropagation();
return false;
}
});
//点击一级导航,弹出二级导航
$sideNav.on('touchstart', 'li', function () {
$sideNav.on('touchend', 'li', function () {
if ($(this).find('.sub-nav').size() > 0) {
$('.sub-nav').removeClass('show');
$(this).find('.sub-nav').addClass('show');
... ... @@ -75,10 +77,12 @@ $sideNav.on('touchstart', 'li', function () {
//返回一级导航,收起二级导航
$('.sub-nav').each(function () {
$(this).find('li').eq(0).on('touchstart', function (e) {
$(this).find('li').eq(0).on('touchend', function (e) {
$('.sub-nav').removeClass('show');
e.stopPropagation();
return false;
});
}).on('touchend', function() {
$('.sub-nav').find('li').removeClass('current');
});
//头部banner轮播
... ...
... ... @@ -5,10 +5,12 @@
*/
var $ = require('jquery'),
Hammer = require('yoho.hammer'),
tip = require('../plugin/tip'),
lazyLoad = require('yoho.lazyload');
var winH = $(window).height(),
var navHammer,
winH = $(window).height(),
loadMoreH = $('#load-more').height(),
$goodList = $('#goods-list'),
loading = false,
... ... @@ -35,91 +37,101 @@ if (kidsType) {
$curNav = $navList.children('.focus');
$('#maybe-like-nav').delegate('li', 'tap', function() {
var $this = $(this),
$goods = $('.goods-list'),
$content;
if (lifestyleType) {
navHammer = new Hammer($navList[0]);
navHammer.on('tap', function(e) {
var $this = $(e.target).closest('li'),
$goods = $('.goods-list'),
$content;
if ($this.hasClass('focus')) {
return;
}
if ($this.hasClass('focus')) {
return;
}
index = $this.index();
index = $this.index();
$this.addClass('focus');
$curNav.removeClass('focus');
$this.addClass('focus');
$curNav.removeClass('focus');
$goods.not('.hide').addClass('hide');
$content = $goods.eq(index);
$content.removeClass('hide');
$goods.not('.hide').addClass('hide');
$content = $goods.eq(index);
$content.removeClass('hide');
$curNav = $this;
$curNav = $this;
$(document).trigger('scroll'); //Trigger lazyLoad
});
}
$(document).trigger('scroll'); //Trigger lazyLoad
});
//srcoll to load more
$(window).scroll(function () {
if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH - 50) {
if (loading) {
return;
}
loading = true;
//num = $goodList.find('.good-info').length;
$.ajax({
type: 'GET',
url: url,
data: {
page: page + 1
},
success: function(data) {
if (data === ' ') {
loading = true;
if (gender) {
if (gender === '1,3') {
url = '/boys/bottomBanner';
} else {
url = '/girls/bottomBanner';
}
$.ajax({
type: 'GET',
url: url,
success: function(data) {
if (data && data[0] && data[0].banner[0]) {
$('#load-more-img').show();
$('#load-more-img a').attr('url', data[0].banner[0].url);
$('#load-more-img a > img').attr('src', data[0].banner[0].img);
}
},
error: function() {
function search() {
if (loading) {
return;
}
loading = true;
//num = $goodList.find('.good-info').length;
$.ajax({
type: 'GET',
url: url,
data: {
page: page + 1
},
success: function(data) {
if (data === ' ') {
loading = true;
if (gender) {
if (gender === '1,3') {
url = '/boys/bottomBanner';
} else {
url = '/girls/bottomBanner';
}
$.ajax({
type: 'GET',
url: url,
success: function(data) {
if (data) {
$('#load-more-img').show();
$('#load-more-img a').attr('href', data.url);
$('#load-more-img a > img').attr('src', data.img);
}
});
},
error: function() {
}
});
}
return;
}
return;
}
num = $goodList.find('.good-info').length;
$goodList.append(data);
num = $goodList.find('.good-info').length;
// 2015/10/31 fei.hong: 修复第一页分页不显示图片的问题
if (num === 0) {
lazyLoad($goodList.find('.good-info').find('img.lazy'));
} else {
lazyLoad($goodList.find('.good-info:gt(' + (num - 1) + ')').find('img.lazy'));
}
$goodList.append(data);
loading = false;
page++;
},
error: function() {
tip.show('网络断开连接了~');
loading = false;
// 2015/10/31 fei.hong: 修复第一页分页不显示图片的问题
if (num === 0) {
lazyLoad($goodList.find('.good-info').find('img.lazy'));
} else {
lazyLoad($goodList.find('.good-info:gt(' + (num - 1) + ')').find('img.lazy'));
}
});
}
loading = false;
page++;
},
error: function() {
tip.show('网络断开连接了~');
loading = false;
}
});
}
$('.maybe-like p').on('touchstart', function (e) {
search();
});
//srcoll to load more
$(window).scroll(function () {
if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH - 50) {
search();
}
});
\ No newline at end of file
... ...
... ... @@ -39,16 +39,6 @@ $searchBox.find('.clear-text').click(function () {
$searchBox.find('input').val('').trigger('focus');
});
// clearTextHammer = new Hammer($searchBox.find('.clear-text')[0]);
// clearTextHammer.on('tap', function(e) {
// $searchBox.find('input').val('').trigger('focus');
// });
$searchBox.find('.search-icon').click(function () {
$indexSearch.submit();
});
// searchIconHammer = new Hammer($searchBox.find('.search-icon')[0]);
// searchIconHammer.on('tap', function(e) {
// $indexSearch.submit();
// });
\ No newline at end of file
});
\ No newline at end of file
... ...
... ... @@ -5,4 +5,5 @@
*/
require('./search');
require('./footer');
\ No newline at end of file
require('./footer');
require('./channel');
\ No newline at end of file
... ...
... ... @@ -5,7 +5,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer');
Hammer = require('yoho.hammer');
var floatLayerCloseHammer, floatLayerBtnHammer;
... ...
... ... @@ -5,7 +5,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer');
Hammer = require('yoho.hammer');
var $input = $('#search-input input');
... ...
... ... @@ -6,7 +6,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer');
Hammer = require('yoho.hammer');
var $filter;
... ... @@ -17,13 +17,6 @@ var missStatus; //是否忽略选中状态
//隐藏筛选界面
function hideFilter() {
$filter.addClass('hide');
if (missStatus) {
//重置一级筛选项选中状态
$filter.find('.classify-item.active').removeClass('active');
$filter.find('.classify-item:first-child').addClass('active');
}
}
//显示筛选界面
... ... @@ -31,6 +24,7 @@ function showFilter() {
$filter.removeClass('hide');
}
//主筛选项Tap事件句柄
function classifyTapEvt($this) {
if ($this.hasClass('active')) {
return;
... ... @@ -41,9 +35,8 @@ function classifyTapEvt($this) {
$this.addClass('active');
}
function subClassifyTapEvt($this) {
var id = $this.data('id');
//子筛选项选中处理
function setSubClassify($this) {
var $sub = $this.closest('.sub-classify');
var $shower = $sub.siblings('.shower');
... ... @@ -72,6 +65,17 @@ function subClassifyTapEvt($this) {
$shower.removeClass('default');
}
return $sub;
}
//子筛选项Tap句柄
function subClassifyTapEvt($this) {
var id = $this.data('id');
var $sub;
$sub = setSubClassify($this);
if (fCbFn) {
fCbFn({
type: $sub.data('type'),
... ... @@ -80,12 +84,6 @@ function subClassifyTapEvt($this) {
}
hideFilter();
//重置选中状态
if (missStatus) {
$this.removeClass('chosed');
$sub.children(':first-child').addClass('chosed');
}
}
//初始化筛选
... ... @@ -133,8 +131,25 @@ function initFilter(opt) {
});
}
//重置筛选面板
function resetFilter() {
if (typeof $filter === 'undefined') {
return;
}
//重置子筛选项
$('.sub-classify').each(function() {
setSubClassify($(this).children(':first-child'));
});
//重置主筛选项
classifyTapEvt($('.classify > :first-child'));
}
exports.initFilter = initFilter;
exports.showFilter = showFilter;
exports.hideFilter = hideFilter;
\ No newline at end of file
exports.hideFilter = hideFilter;
exports.resetFilter = resetFilter;
\ No newline at end of file
... ...
... ... @@ -5,7 +5,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer'),
Hammer = require('yoho.hammer'),
lazyLoad = require('yoho.lazyload');
//品牌页参数
... ...
... ... @@ -6,7 +6,7 @@
var $ = require('jquery'),
Swiper = require('yoho.iswiper'),
Hammer = require('hammer'),
Hammer = require('yoho.hammer'),
lazyLoad = require('yoho.lazyload');
var swiper;
... ...
... ... @@ -6,7 +6,7 @@
var $ = require('jquery'),
Swiper = require('yoho.iswiper'),
Hammer = require('hammer'),
Hammer = require('yoho.hammer'),
lazyLoad = require('yoho.lazyload');
var swiper,
... ... @@ -41,6 +41,8 @@ var defaultOpt = {
dayLimit: 1
};
var storeOpt = $.extend({}, defaultOpt); //存储默认筛选条件以便重置
var now = new Date(),
month = now.getMonth() + 1,
date = now.getDate();
... ... @@ -267,8 +269,7 @@ $.ajax({
//切换active状态到$pre上
$pre.addClass('active');
$pre.siblings('.filter').removeClass('active');
},
missStatus: true
}
});
}
});
... ... @@ -343,6 +344,10 @@ navHammer.on('tap', function(e) {
$dgc.removeClass('hide');
break;
}
//重置筛选项
filter.resetFilter();
defaultOpt = $.extend({}, storeOpt);
}
$active.removeClass('active');
... ...
... ... @@ -23,7 +23,7 @@
"import-style": "1.0.0",
"yoho.lazyload": "1.1.0",
"yoho.handlebars": "3.0.3",
"hammer": "2.0.4"
"yoho.hammer": "2.0.4"
},
"devDependencies": {
"expect.js": "0.3.1"
... ...
.good-info {
float: left;
width: 46.4%;
width: 276rem / $pxConvertRem;
height: 486rem / $pxConvertRem;
margin: 28rem / $pxConvertRem 0 0 2.4%;
margin: 0 (15rem / $pxConvertRem) (28rem / $pxConvertRem);
.tag-container {
height: 28rem / $pxConvertRem;
width: 100%;
overflow: hidden;
.good-tag {
display: block;
... ... @@ -15,23 +15,27 @@
height: 28rem / $pxConvertRem;
font-size: 18rem / $pxConvertRem;
text-align: center;
line-height: 32rem / $pxConvertRem;
line-height: 28rem / $pxConvertRem;
box-sizing: border-box;
margin-right: 4rem / $pxConvertRem;
&:last-child {
margin-right: 0;
}
}
.new-tag {
width: 60rem / $pxConvertRem;
background-color: #78dc7e;
color: #fff;
}
.renew-tag {
width: 90rem / $pxConvertRem;
background-color: #78dc7e;
color: #fff;
}
.sale-tag {
width: 60rem / $pxConvertRem;
background-color: #ff575c;
... ... @@ -43,17 +47,31 @@
color: #fff;
}
.limit-tag {
box-sizing: border-box;
width: 90rem / $pxConvertRem;
border: 1px solid #000;
color: #000;
line-height: 24rem / $pxConvertRem;
}
}
}
.good-detail-img {
position: relative;
.good-islike {
position: absolute;
width: 60rem / $pxConvertRem;
height: 60rem / $pxConvertRem;
top: 0rem / $pxConvertRem;
right: 0rem / $pxConvertRem;
line-height: 60rem / $pxConvertRem;
font-size: 30rem / $pxConvertRem;
text-align: center;
color: #b0b0b0;
text-decoration: none;
}
.good-like {
color: #d72928;
}
img {
display: block;
width: 100%;
... ...
... ... @@ -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,7 +17,6 @@
height: 192rem / $pxConvertRem;
border-bottom: 1px solid #e0e0e0;
border-right: 1px solid #e0e0e0;
border-top: 1px solid #e0e0e0;
}
.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;
... ...
... ... @@ -16,7 +16,7 @@
li {
float: left;
width: 158rem / $pxConvertRem;
height: 154rem / $pxConvertRem;
height: 174rem / $pxConvertRem;
border-top: 1px solid #e0e0e0;
border-left: 1px solid #e0e0e0;
overflow: hidden;
... ... @@ -31,6 +31,8 @@
img {
vertical-align: middle;
width: 100%;
height: 100%;
max-width: 100%;
max-height: 100%;
}
... ...
... ... @@ -2,7 +2,7 @@
background: #fff;
padding-left: 15rem / $pxConvertRem;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
// border-bottom: 1px solid #ccc;
margin-top: 30rem / $pxConvertRem;
.title {
height: 104rem / $pxConvertRem;
... ... @@ -59,6 +59,7 @@
.load-more-img {
padding-left: 0;
height: 200rem / $pxConvertRem;
border-top: 1px solid #ccc;
overflow: hidden;
img {
display: block;
... ...
... ... @@ -110,12 +110,12 @@
}
.sub-nav {
// display: none;
display: none;
position: fixed;
bottom: 0;
top: 0;
right: 100rem / $pxConvertRem;
left: 0;
bottom: 0;
// right: 100rem / $pxConvertRem;
width: 100%;
background: #fff !important;
// z-index: 2;
... ... @@ -185,7 +185,7 @@
}
.sub-nav.show {
display: block;
@include transform(translateX(0));
@include transition(transform 0.3s);
}
\ No newline at end of file
... ...
... ... @@ -91,20 +91,20 @@
padding-top: 50%;
width: 100%;
position: absolute;
top: -230rem / $pxConvertRem;
top: -180rem / $pxConvertRem;
.list-item {
display: block;
position: relative;
margin: 0 auto 50rem / $pxConvertRem;
width: 444rem / $pxConvertRem;
height: 110rem / $pxConvertRem;
margin: 0 auto 40rem / $pxConvertRem;
width: 216px;
height: 52px;
text-align: center;
font-size: 30rem / $pxConvertRem;
line-height: 110rem / $pxConvertRem;
font-size: 16px;
line-height: 52px;
color: #fff;
background: #000;
border: 5rem / $pxConvertRem solid #fff;
border: 4px solid #fff;
font-weight: bold;
}
.lighter {
... ...
{{> 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}}
... ...
<div class="maybe-like">
<p class="title">
<i class="icon"></i>
<span>你可能喜欢</span>
</p>
<ul id="maybe-like-nav" class="maybe-like-nav clearfix">
<li class="maybe-like-nav-item focus">新品到着</li>
<li class="maybe-like-nav-item">人气单品</li>
</ul>
<ul id="maybe-like-nav" class="maybe-like-nav clearfix">
<li class="maybe-like-nav-item focus">新品到着</li>
<li class="maybe-like-nav-item">人气单品</li>
</ul>
<div id="goods-list">
{{# goodsContainer}}
<div class="goods-list {{^show}}hide{{/show}}">
{{# goods}}
{{> good}}
{{/ goods}}
</div>
{{/ goodsContainer}}
</div>
<div id="goods-list">
{{# goodsContainer}}
<div class="goods-list {{^show}}hide{{/show}}">
{{# goods}}
{{> good}}
{{/ goods}}
</div>
{{/ goodsContainer}}
</div>
<div id="load-more-info" class="load-more-info">
<div class="loading status hide">
... ...
{{> 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>
... ...
... ... @@ -46,9 +46,9 @@ class HomeModel
const COOKIE_NAME_LIFESTYLE = 'lifestyle';
/* COOKIE标识访问的是男生频道底部Banner */
const COOKIE_NAME_BOYS_BOTTOM_BANNER = '8c48745a39373d621bf5fd80edf59b5e';
const CODE_NAME_BOYS_BOTTOM_BANNER = '8c48745a39373d621bf5fd80edf59b5e';
/* COOKIE标识访问的是女生频道频道底部Banner */
const COOKIE_NAME_GIRLS_BOTTOM_BANNER = 'c63939b2ad458e9cb51147940c1da2e5';
const CODE_NAME_GIRLS_BOTTOM_BANNER = 'c63939b2ad458e9cb51147940c1da2e5';
/**
* 选择频道
... ... @@ -125,10 +125,10 @@ class HomeModel
{
$result = false;
if($channel == 2) {
$resource = self::COOKIE_NAME_GIRLS_BOTTOM_BANNER;
$resource = self::CODE_NAME_GIRLS_BOTTOM_BANNER;
$cache = CacheConfig::KEY_ACTION_GRILS_BOTTOM_BANNER;
} else {
$resource = self::COOKIE_NAME_BOYS_BOTTOM_BANNER;
$resource = self::CODE_NAME_BOYS_BOTTOM_BANNER;
$cache = CacheConfig::KEY_ACTION_BOYS_BOTTOM_BANNER;
}
... ... @@ -143,13 +143,14 @@ class HomeModel
// 调用接口获取数据
$banner = IndexData::getBannerStart($resource);
if (isset($banner['code']) && $banner['code'] == 200) {
// 构建数据
$data = array();
$result = array();
// 处理数据
foreach ($banner['data'] as $val) {
$data['list'][] = $val;
foreach ($val['data'] as $single) {
$result['url'] = ($channel === 2) ? Helpers::url('/boys') : Helpers::url('/girls');
$result['img'] = Helpers::getImageUrl($single['src'], 640, 200);
}
}
$result = FloorProcess::getContent($data, $channel);
}
if (USE_CACHE) {
... ...
... ... @@ -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$"
... ...