Authored by hf

do fixes bug to version 0.0.7

Showing 44 changed files with 644 additions and 236 deletions
... ... @@ -66,7 +66,7 @@ class BrandData
}
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
return Yohobuy::get(Yohobuy::API_URL, $param, 3600); // 有缓存1小时
}
/**
... ...
... ... @@ -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 = '';
... ... @@ -175,9 +175,11 @@ class Helpers
* @param bool $showTag 控制是否显示标签
* @param bool $showNew 控制是否显示NEW图标
* @param bool $showSale 控制是否显示SALE图标
* @param int $width 图片的宽度
* @param int $height 图片的高度
* @return array | false
*/
public static function formatProduct($productData, $showTags = true, $showNew = true, $showSale = true)
public static function formatProduct($productData, $showTags = true, $showNew = true, $showSale = true, $width = 290, $height = 388)
{
// 商品信息有问题,则不显示
if (!isset($productData['product_skn']) || !isset($productData['goods_list'][0])) {
... ... @@ -197,7 +199,7 @@ class Helpers
$result = array();
$result['id'] = $productData['product_skn'];
$result['product_id'] = $productData['product_id'];
$result['thumb'] = Images::getImageUrl($productData['default_images'], 235, 314);
$result['thumb'] = Images::getImageUrl($productData['default_images'], $width, $height);
$result['name'] = $productData['product_name'];
$result['price'] = $productData['market_price'];
$result['salePrice'] = $productData['sales_price'];
... ...
... ... @@ -17,43 +17,238 @@ server
allow 172.16.0.0/16;
deny all;
# 子域名
if ($host = "sale.test.yoho.cn" ) {
rewrite ^/(.*)$ http://m.yohobuy.com/$1 permanent;
#账号相关
location = /reg.html {
root /Data/code/git/yohobuy/assets;
expires 7d;
}
location = /emailback.html {
root /Data/code/git/yohobuy/assets;
expires 7d;
}
location = /phoneback.html {
root /Data/code/git/yohobuy/assets;
expires 7d;
}
location = /error.html {
root /Data/code/git/yohobuy/assets;
expires 7d;
}
location ^~ /passport/back/ {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /passport/reg/ {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
#首页相关
location = / {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /boys {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /girls {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /kids {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /lifestyle {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /girl {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
# 商品相关
location = /cate {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /brands {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /sale {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /brands/search {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
if ($host = "cuxiao.test.yoho.cn" ) {
rewrite ^/(.*)$ http://m.yohobuy.com/$1 permanent;
location = /product/new {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
# 账号相关
location =/signin.html {
rewrite ^/(.*)$ http://m.yohobuy.com/$1 permanent;
location ^~ /product/newsale/ {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location /passport/auth {
rewrite ^/(.*)$ http://m.yohobuy.com/$1 permanent;
location ^~ /product/opt/ {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location /passport/signin {
rewrite ^/(.*)$ http://m.yohobuy.com/$1 permanent;
location ^~ /product/recom/ {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
# 个人中心
location /home {
rewrite ^/(.*)$ http://m.yohobuy.com/$1 permanent;
# 逛相关
location ^~ /guang/ {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /tags/index {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
# 购物车
location /cart {
rewrite ^/(.*)$ http://m.yohobuy.com/$1 permanent;
location ^~ /author/index {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /info/index {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ~* \.html$ {
root /Data/code/git/yohobuy/assets;
if (!-f $request_filename){
rewrite ^/(.*)$ http://m.yohobuy.com/$1 permanent;
}
expires 3m;
# 搜索相关
location ^~ /search {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
# 其它访问都跳到老版
location / {
proxy_redirect off;
proxy_pass http://61.155.222.163;
proxy_set_header Host m.yohobuy.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
# # 子域名
# if ($host = "sale.test.yoho.cn" ) {
# proxy_redirect off;
# proxy_pass http://61.155.222.162;
# proxy_set_header Host cuxiao.m.yohobuy.com;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header Accept-Encoding "gzip";
# }
# if ($host = "cuxiao.test.yoho.cn" ) {
# proxy_redirect off;
# proxy_pass http://101.201.176.121;
# proxy_set_header Host cuxiao.m.yohobuy.com;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header Accept-Encoding "gzip";
# }
#location ~* \.html$ {
# root /Data/code/git/yohobuy/assets;
# if (!-f $request_filename){
# rewrite ^/(.*)$ http://m.yohobuy.com/$1 permanent;
# }
# expires 3m;
# }
location ~* \.(ico|woff|svg|eot|ttf|otf)$ {
expires 30d;
}
... ...
... ... @@ -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>
<script type="text/tmpl">
{{{brandList}}}
</script>
{{> 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>
... ...
... ... @@ -14,6 +14,11 @@ class BoysController extends AbstractAction
*/
public function indexAction()
{
if (null !== $this->get('go')) {
// 先检查COOKIE是否有访问过, 有则跳转到相应的频道页
Index\HomeModel::goSwitchChannel();
}
// 设置COOKIE标识用户访问过该页面了
Index\HomeModel::setSwitchToCookie(Index\HomeModel::COOKIE_NAME_BOYS);
... ... @@ -25,7 +30,7 @@ class BoysController extends AbstractAction
// 渲染模板并输出
$this->_view->display('index', array(
'boysHomePage' => true,
'homeHeader' => array('searchUrl' => Helpers::url('/search.html', null, 'search')),
'homeHeader' => array('searchUrl' => Helpers::url('/search', null, 'search')),
'showFooterTab' => false,
'maybeLike' => true,
'content' => Index\HomeModel::getBoysFloor(),
... ... @@ -49,9 +54,8 @@ class BoysController extends AbstractAction
if (empty($bottomBanner)) {
break;
}
$this->echoJson($bottomBanner);
} while (false);
}
... ...
... ... @@ -25,7 +25,7 @@ class GirlsController extends AbstractAction
// 渲染模板并输出
$this->_view->display('index', array(
'grilsHomePage' => true,
'homeHeader' => array('searchUrl' => Helpers::url('/search.html', null, 'search')),
'homeHeader' => array('searchUrl' => Helpers::url('/search', null, 'search')),
'showFooterTab' => false,
'maybeLike' => true,
'content' => Index\HomeModel::getGirlsFloor(),
... ...
... ... @@ -25,7 +25,7 @@ class KidsController extends AbstractAction
// 渲染模板并输出
$this->_view->display('index', array(
'kidsHomePage' => true,
'homeHeader' => array('searchUrl' => Helpers::url('/search.html', null, 'search')),
'homeHeader' => array('searchUrl' => Helpers::url('/search', null, 'search')),
'showFooterTab' => false,
'maybeLike' => true,
'content' => Index\HomeModel::getKidsFloor(),
... ...
... ... @@ -25,7 +25,7 @@ class LifestyleController extends AbstractAction
// 渲染模板并输出
$this->_view->display('index', array(
'lifestyleHomePage' => true,
'homeHeader' => array('searchUrl' => Helpers::url('/search.html', null, 'search')),
'homeHeader' => array('searchUrl' => Helpers::url('/search', null, 'search')),
'showFooterTab' => false,
'maybeLike' => true,
'content' => Index\HomeModel::getLifestyleFloor(),
... ...
... ... @@ -16,7 +16,9 @@ class SearchController extends AbstractAction
*/
public function indexAction()
{
$this->_view->html('search');
$this->setNavHeader('搜索', true, SITE_MAIN);
//$this->_view->html('search');
$this->_view->display('index', array(
'search' => array('url' => Helpers::url('', null, 'search')),
'showDownloadApp' => true,
... ... @@ -120,9 +122,14 @@ class SearchController extends AbstractAction
} while (false);
$classNames = array();
} else {
$condition['query'] = '';
}
$data = array();
$data['goodListPage'] = true;
$data['goodList'] = $condition;
$data['query'] = $query;
// 搜索是一级品类
if ($isQueryFirstClass) {
$this->setTitle('全部' . $query);
... ... @@ -137,16 +144,12 @@ class SearchController extends AbstractAction
else {
if ($haveQuery) {
$data['goodList']['search']['default'] = $query;
$data['goodList']['search']['default'] = $query;
$data['goodList']['search']['url'] = Helpers::url('', null, 'search');
}
$this->setTitle('搜索');
$this->setNavHeader('搜索', true, SITE_MAIN);
}
$data['goodListPage'] = true;
$data['goodList'] = $condition;
$data['query'] = $query;
// // 查询数据
// if (!isset($condition['query'])) {
// $data['goodList'] += Product\ListModel::getClassData($condition);
... ...
... ... @@ -18,6 +18,7 @@ use Plugin\Helpers;
class BrandModel
{
/* 男生频道取品牌广告及热门品牌数据的位置码 */
const CODE_TOPPOS_BOYS = 'ce6ac059493ec26241a8cbe0bfa1b17a';
/* 女生频道取品牌广告及热门品牌数据的位置码 */
const CODE_TOPPOS_GIRLS = 'dac99cdedc1f948e84c145aca561f7d2';
... ... @@ -25,7 +26,7 @@ class BrandModel
const CODE_TOPPOS_KIDS = '713784f93f52bb1a7b93916b2bb15510';
/* 创意生活频道取品牌广告及热门品牌数据的位置码 */
const CODE_TOPPOS_LIFESTYLE = 'f1aa914fd23cbcda71a87de6f5416c75';
/**
* 根据频道获取品牌一览数据
*
... ... @@ -36,7 +37,7 @@ class BrandModel
{
$result = array();
$brand = array();
/* 根据频道调用接口 */
switch (intval($channel)) {
case 1: // 男生
... ... @@ -52,14 +53,14 @@ class BrandModel
$brand = BrandData::package(self::CODE_TOPPOS_LIFESTYLE, 4);
break;
}
// 模板中的使用JS标识
$result['brandPage'] = true;
// 是否显示app下载浮层标识
$result['showDownloadApp'] = true;
// 搜索链接地址
$result['searchUrl'] = Helpers::url('/search.html', null, 'search');
$result['searchUrl'] = Helpers::url('/brands/search', null);
/* 顶部的轮翻广告列表 */
if (!empty($brand['brandTop'][0]['data'])) {
$build = array();
... ... @@ -70,7 +71,7 @@ class BrandModel
$result['bannerTop']['list'][] = $build;
}
}
/* 顶部的热门品牌列表 */
if (!empty($brand['brandTop'][1]['data']['list'])) {
$build = array();
... ... @@ -81,7 +82,7 @@ class BrandModel
$result['hotBrand']['list'][] = $build;
}
}
/* 按字母'A-Z'分组的品牌列表 */
if (!empty($brand['brandList']['brands'])) {
$list = array();
... ... @@ -93,18 +94,48 @@ class BrandModel
$list['name'] = $row['brand_name'];
$list['isHot'] = ($row['is_hot'] === 'Y') ? true : false;
$list['isNew'] = ($row['is_show_new'] === 'Y') ? true : false;
$list['url'] = 'http://' . $row['brand_domain'] . SUB_DOMAIN;
$list['url'] = Helpers::url('', null, $row['brand_domain']);
$build['list'][] = $list;
}
$result['brandList'][] = $build;
}
}
$result['pageFooter'] = true;
$brand = array();
return $result;
}
/**
* 获取搜索的品牌列表
*
* @param int $channel 1表示男生频道, 2表示女生频道, 3表示潮童频道, 4表示创意生活频道
* @return array
*/
public static function getBrandForSearch($channel)
{
$result = array();
$brand = BrandData::getBrandsData($channel);
if (!empty($brand['data']['brands'])) {
$list = array();
$build = array();
foreach ($brand['data']['brands'] as $char => $value) {
foreach ($value as $row) {
$list['name'] = $row['brand_name'];
$list['isHot'] = ($row['is_hot'] === 'Y') ? true : false;
$list['isNew'] = ($row['is_show_new'] === 'Y') ? true : false;
$list['url'] = Helpers::url('', null, $row['brand_domain']);
$build[] = $list;
}
$result[$char] = $build;
}
}
$result['brandList'] = json_encode($result);
return $result;
}
}
... ...
... ... @@ -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) {
... ...
<?php
use Action\AbstractAction;
use Plugin\Helpers;
/**
* 品牌相关的控制器
... ... @@ -43,4 +44,21 @@ 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 = Helpers::getChannelByCookie();
// 渲染模板
$this->_view->display('search', Category\BrandModel::getBrandForSearch($channel));
}
}
... ...
... ... @@ -99,7 +99,7 @@ class InfoController extends AbstractAction
if ($i > 3) {
break;
}
$good[] = Helpers::formatProduct($goods, false);
$good[] = Helpers::formatProduct($goods, false, true, true, 235,314);
}
}
// 没有商品
... ... @@ -130,7 +130,7 @@ class InfoController extends AbstractAction
$product = ListData::productInfoBySkns($skns);
if (!empty($product['data']['product_list'])) {
foreach ($product['data']['product_list'] as $i => $goods) {
$good['goods'][] = Helpers::formatProduct($goods, false);
$good['goods'][] = Helpers::formatProduct($goods, false, true, true, 235,314);
}
$build['collocation'][] = $good;
}
... ... @@ -178,6 +178,9 @@ class InfoController extends AbstractAction
$data['shareImg'] = Helpers::getImageUrl($detail['getArticle']['cover_image'], 640, 320);
}
}
// 标识有微信分享
$data['hasWxShare'] = true;
$this->_view->display('index', $data);
... ...
... ... @@ -56,7 +56,7 @@ class RecomController extends AbstractAction
/* 构建商品数据 */
$data = array();
foreach ($recom['data']['product_list'] as $value) {
$data['goods'][] = Helpers::formatProduct($value, true);
$data['goods'][] = Helpers::formatProduct($value, true, true, true, 276, 366);
}
$this->_view->display('maylike', $data);
} while (false);
... ...
... ... @@ -14,7 +14,7 @@ routes.error.route.action = Index
; 搜索页
routes.search.type = "rewrite"
routes.search.match = "/search.html"
routes.search.match = "/(search.html|search)$"
routes.search.route.module = Index
routes.search.route.controller = Search
routes.search.route.action = Index
... ... @@ -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$"
... ... @@ -96,4 +103,11 @@ routes.goodsfilter.route.module = Index
routes.goodsfilter.route.controller = Search
routes.goodsfilter.route.action = Filter
; 品牌搜索
routes.productnew.type = "rewrite"
routes.productnew.match = "/brands/search$"
routes.productnew.route.module = Category
routes.productnew.route.controller = Brand
routes.productnew.route.action = Search
... ...