Authored by xuqi

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

... ... @@ -270,11 +270,11 @@ class SearchData extends \LibModels\Wap\Product\SearchData
}
/**
* 并行调接口url获取(产品分类)
* @param
* @param $condition
* @return string
*/
public static function getClassesUrl($condition)
public static function getClassesUrl($condition = array())
{
$condition['sales'] = 'Y'; //在销售商品分类
$condition['status'] = 1; //上架商品分类
... ... @@ -284,7 +284,8 @@ class SearchData extends \LibModels\Wap\Product\SearchData
/**
* 并行调接口url获取(获取折扣区间)
* @param
* @param array $param
* @return string
*/
public static function getDiscountUrl($param = array())
... ...
... ... @@ -27,6 +27,8 @@ class HelperSearch
public static $selected = array();
//list分类面包屑
public static $listNav = array();
//
public static $specialsaleParam = array();
//设置导航
private static function setListNav()
{
... ... @@ -100,6 +102,10 @@ class HelperSearch
if (isset($data['discount']['discount']) && !empty($data['discount']['discount'])) {
$result['leftContent'][]['allDiscount'] = self::getDiscount($data['discount']['discount']);
}
//一周新品上架
if (isset($data['recent']['recent']) && !empty($data['recent']['recent'])) {
$result['leftContent'][]['newSales'] = self::recentShelve($data['recent']['recent']);
}
//分类条件(搜索页面)
if (isset($data['sort']['sort'])) {
//分类条件(搜索页面)
... ... @@ -110,10 +116,7 @@ class HelperSearch
$result['leftContent'][]['allSort'] = self::groupSort($data['sort']['sort']);
}
}
//一周新品上架
if (isset($data['recent']['recent']) && !empty($data['recent']['recent'])) {
$result['leftContent'][]['newSales'] = self::recentShelve($data['recent']['recent']);
}
//品牌banner
$result['brandBanner'] = isset($data['brand']) && !empty($data['brand']) ? self::getBannerFormat($data['brand'], $options['brandBanner']) : array();
//总记录数
... ... @@ -149,6 +152,7 @@ class HelperSearch
/**
* TODO 组织商品列表信息
* @param $product 接口返回商品列表
* @param $options 条件
* @author sefon 2015-12-21 17:24:04
* @return array
*/
... ... @@ -350,6 +354,13 @@ class HelperSearch
);
$sortList = array();
//加上specialsale_id参数
if (self::$options['controller'] == 'Sale') {
self::$specialsaleParam = array(
'specialsale_id' => isset(self::$params['specialsale_id']) ? self::$params['specialsale_id'] : ''
);
}
foreach ($sort as $key => $val) {
//是否有品牌
if ($options['action'] != 'brand' && $options['controller'] != 'Index') {
... ... @@ -379,13 +390,13 @@ class HelperSearch
$sortList[$key]['name'] = $val['sort_name'];
$sortList[$key]['active'] = isset(self::$params['msort']) && self::$params['msort'] == $val['sort_id'] ? true : false;
$sortList[$key]['childList'][] = array(
'name' => '全部分类',
'name' => '全部'.$val['sort_name'],
'href' => self::buildUrl(array_merge($gender, array('msort'=>$val['sort_id'])))
);
if (isset($val['sub']) && !empty($val['sub'])) {
foreach ($val['sub'] as $k => $v) {
$sortList[$key]['childList'][$k+1]['name'] = $v['sort_name'];
$sortList[$key]['childList'][$k+1]['href'] = self::buildUrl(array_merge($gender, array('msort' => $val['sort_id'], 'misort' => $v['sort_id'])));
$sortList[$key]['childList'][$k+1]['href'] = self::buildUrl(array_merge($gender, array('msort' => $val['sort_id'], 'misort' => $v['sort_id']), self::$specialsaleParam));
$sortList[$key]['childList'][$k+1]['childActive'] = isset(self::$params['misort']) && self::$params['misort'] == $v['sort_id'] ? true : false;
}
}
... ... @@ -1037,6 +1048,7 @@ class HelperSearch
if ($data) {
$result['conditions'] = $data;
$result['clearUrl'] = self::current();
}
return $result;
}
... ... @@ -1046,7 +1058,7 @@ class HelperSearch
* @param array $list
* @return array
*/
public static function getDiscount(array $list = array())
public static function getDiscount($list = array())
{
$params = self::$params;
$query = array();
... ... @@ -1085,7 +1097,7 @@ class HelperSearch
$data[$i]['active'] = true;
}
$data[$i]['href'] = self::buildUrl($query);
$data[$i]['name'] = $k;
$data[$i]['name'] = date('m月d日', strtotime($k));
$i++;
}
$result = array(
... ... @@ -1093,6 +1105,7 @@ class HelperSearch
);
unset($data);
unset($query);
return $result;
}
/**
... ... @@ -1100,7 +1113,10 @@ class HelperSearch
*/
public static function current()
{
$url = explode('?', 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
$url = explode('?', 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
if (!empty(self::$specialsaleParam)) {
$url[0] .= '?' . http_build_query(self::$specialsaleParam);
}
return $url[0];
}
/**
... ... @@ -1377,4 +1393,65 @@ class HelperSearch
}
return $url;
}
public static function stripTags($html) {
$search = array(
' ',
"'<script[^>]*?>.*?</script>'si",
"'<[\/\!]*?[^<>]*?>'si",
"'([\r\n])[\s]+'",
"'&(quot|#34|#034|#x22);'i",
"'&(amp|#38|#038|#x26);'i",
"'&(lt|#60|#060|#x3c);'i",
"'&(gt|#62|#062|#x3e);'i",
"'&(nbsp|#160|#xa0);'i",
"'&(iexcl|#161);'i",
"'&(cent|#162);'i",
"'&(pound|#163);'i",
"'&(copy|#169);'i",
"'&(reg|#174);'i",
"'&(deg|#176);'i",
"'&(#39|#039|#x27);'",
"'&(euro|#8364);'i",
"'&a(uml|UML);'",
"'&o(uml|UML);'",
"'&u(uml|UML);'",
"'&A(uml|UML);'",
"'&O(uml|UML);'",
"'&U(uml|UML);'",
"'&szlig;'i",
"\n",
"\r",
"\t",
"\0",
" "
);
return trim(str_replace($search, '', strip_tags($html,"")));
}
/**
*
* 按字来切分字符 (UTF-8截字)
*
* @param String $str
* @param Integer $length
* @param Integer $start
* @param String $encoding
* @return String
*/
public static function mbSubstr($str, $length, $start = 0, $suffix = '...', $encoding = "utf-8") {
if (!is_string($str)) {
return $str;
}
$str = trim($str);
if (mb_strlen($str) == $length) {
return $str;
}
$strs = mb_substr($str, $start, $length, $encoding);
if ((mb_strlen($str) / 3) > $length) {
$strs .= $suffix;
}
return $strs;
}
}
... ...
... ... @@ -97,7 +97,7 @@
<div class="category">
{{# thirdnav}}
<div class="thirdnavlist">
<h1 class="category-title thirdnavbar">{{title}}</h1>
<h1 class="category-title thirdnavbar"><a href="{{link}}">{{title}}</a> </h1>
<ul class="category-list">
{{#branditems}}
<li class="category-
... ...
{{#if pathNav}}
<p class="path-nav">
{{#each pathNav}}
{{#if href}}
<a href="{{href}}">
{{#if @last}}
<b>{{name}}</b>
{{else}}
{{name}}
{{/if}}
{{#unless @last}}
<span class="iconfont">&#xe601;</span>
{{/unless}}
</a>
{{^}}
{{#if @last}}
<b>{{name}}</b>
{{else}}
{{name}}
{{/if}}
{{#unless @last}}
<span>
<i class="iconfont">&#xe601;</i>
</span>
{{/unless}}
{{/if}}
{{/each}}
</p>
{{/if}}
{{#if pathNav}}
<p class="path-nav">
{{#each pathNav}}
{{#if href}}
<a href="{{href}}">
{{#if @last}}
<b>{{name}}</b>
{{else}}
{{name}}
{{/if}}
{{#unless @last}}
<span class="iconfont">&#xe601;</span>
{{/unless}}
</a>
{{^}}
{{#if @last}}
<b>{{{name}}}</b>
{{else}}
{{name}}
{{/if}}
{{#unless @last}}
<span>
<i class="iconfont">&#xe601;</i>
</span>
{{/unless}}
{{/if}}
{{/each}}
</p>
{{/if}}
... ...
... ... @@ -482,7 +482,15 @@ function actionGoodsCart() {
if (typeof window.cookie(params.cookie) === 'undefined') {
cartInfo = null;
} else {
cartInfo = json2.parse(window.cookie(params.cookie));
if (params.cookie) {
try {
cartInfo = json2.parse(window.cookie(params.cookie));
} catch (e) {
}
}
}
if (cartInfo != null) {
totalNum = parseInt(cartInfo._nac) + parseInt(cartInfo._ac);
... ... @@ -682,7 +690,7 @@ function JsonPCallBack(data) {
if (data.data.url !== '') {
topbanner = '<a target="_blank" href="' + data.data.url + '" class="page-top-banner"' +
'style="height:36px;border:none;background-image:url(' + window.unescape(data.data.src) + ');' +
'background-position: center;display:block;background-size:contain">&nbsp;</a>';
'background-position: center;display:block;">&nbsp;</a>';
} else {
topbanner = '<div class="noticewrapper">' +
'<div class="noticecontainer">' +
... ... @@ -1152,7 +1160,7 @@ function actionTipPic() {
}
});
logolink = $('.first-nav-list .cur').find('a').attr('href');
$('.main-link').attr('href', link);
$('.main-link').attr('href', logolink);
}
... ... @@ -1824,7 +1832,8 @@ function init() {
actionCover(); //初次登录弹框
actionAddKeyWords(); //增加关键字
}
init();
init();
});
define("js/simple-header", ["jquery"], function(require, exports, module){
var $ = require("jquery");
... ... @@ -1960,364 +1969,366 @@ require("js/product/latest-walk");
require("js/product/product");
});
define("js/product/filter", ["jquery","handlebars","source-map"], function(require, exports, module){
/**
* 商品筛选逻辑
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/12/4
*/
var $ = require("jquery"),
Handlebars = require("handlebars");
var checkUnicode = {
unchecked: '&#xe613;',
checked: '&#xe612;'
},
moreUnicode = {
up: '&#xe610;',
down: '&#xe600;'
};
//品牌相关变量
var $brandDefault = $('.brand .default'),
$brandPanel = $('.brand .brand-panel'),
$brandAttrs = $brandPanel.find('.attr'),
$brandMore = $('#brand-more'),
$brandMulti = $('#brand-multi');
var $brandMoreTxt, $brandMoreIcon;
//价格相关变量
var $udPrice = $('.ud-price-range'),
interReg = /^\d+$/,
$limit, $min, $max, $btn;
//分类相关变量
var $sortSub = $('.sort-sub-wrap');
//高级选项相关变量
var $seniorSubWrap = $('.senior-sub-wrap'),
$seniorAttrWrap = $('.senior-attr-wrap');
var seniorHoverTime, hoveredIndex;
// 尺寸 handlebars 模板
var sizeTmpl = '{{# size}}<a class="attr {{#if checked}}checked{{/if}}" href="{{href}}">{{name}}</a>{{/ size}}',
sizeCache = {}, // 缓存一下尺寸信息
$sizeWrap = $('.filter-box .size');
sizeTmpl = Handlebars.compile(sizeTmpl);
//清除checkbox选中状态
function clearChecked($checkbox) {
$checkbox.removeClass('checked').html(checkUnicode.unchecked);
}
//显示更多品牌面板
function brandShowMore() {
$brandDefault.addClass('hide');
$brandPanel.removeClass('hide');
}
//隐藏更多品牌面板
function brandHideMore() {
$brandPanel.addClass('hide');
$brandDefault.removeClass('hide');
}
//url构造&跳转
function uriLoc(attr, val) {
var href = decodeURIComponent(window.location.search),
query = attr + '=' + val,
newHref;
if (href === '') {
newHref = '?' + query;
} else {
newHref = href + '&' + query;
}
window.location.href = newHref;
}
//隐藏高级选项面板
function hideSeniorPanel(index) {
$seniorSubWrap.children('.senior-sub:eq(' + hoveredIndex + ')').addClass('hide');
$seniorAttrWrap.children('.attr:eq(' + hoveredIndex + ')').removeClass('hover');
hoveredIndex = -1;
}
//屏蔽筛选项双击文字选中
$('.filter-box').on('selectstart', '.attr, .brands-index span', function() {
return false;
});
//【分类】
$('.sort-pre').on('click', 'li', function() {
var $this = $(this),
index = $this.index(),
id = $this.data('id');
if ($this.hasClass('active')) {
// 选中时,再次点击取消选中
$this.removeClass('active');
$sortSub.children(':eq(' + index + ')').addClass('hide');
$sizeWrap.addClass('hide');
return;
}
$this.siblings('.active').removeClass('active');
$this.addClass('active');
$sortSub.children(':not(.hide)').addClass('hide');
$sortSub.children(':eq(' + index + ')').removeClass('hide');
if (!$sizeWrap.data('load')) {
if (sizeCache[id]) {
$sizeWrap.find('.attr-content').html(sizeCache[id]);
$sizeWrap.removeClass('hide');
} else {
$.ajax({
url: '/product/search/sortSize',
data: {
msort: id
}
}).then(function(res) {
if ($.type(res) === 'array' && res.length) {
sizeCache[id] = sizeTmpl({
size: res
});
$sizeWrap.find('.attr-content').html(sizeCache[id]);
$sizeWrap.removeClass('hide');
} else {
$sizeWrap.addClass('hide');
}
});
}
}
});
//【品牌】
if ($brandMore.length > 0) {
$brandMoreTxt = $brandMore.children('em');
$brandMoreIcon = $brandMore.children('.iconfont');
}
//【品牌】多选
$brandMulti.click(function() {
if ($brandPanel.css('display') === 'none') {
//显示品牌面板
$brandMore.trigger('click');
}
$brandPanel.addClass('multi'); //显示出checkbox
$(this).addClass('hide');
});
//【品牌】更多
$brandMore.click(function() {
var $this = $(this);
if ($this.hasClass('more')) {
brandHideMore();
$brandMoreTxt.text('更多');
$brandMoreIcon.html(moreUnicode.down);
} else {
brandShowMore();
$brandMoreTxt.text('收起');
$brandMoreIcon.html(moreUnicode.up);
}
$(this).toggleClass('more');
});
//【品牌】索引
$('.brands-index').on('mouseenter', 'span', function() {
var $this = $(this),
index = $this.data('index');
if ($this.hasClass('hover')) {
return;
}
$this.siblings('span.hover').removeClass('hover');
$this.addClass('hover');
if ($this.index() === 0) {
//全部
$brandAttrs.removeClass('hide');
} else {
$brandAttrs.addClass('hide').filter('[data-index=' + index + ']').removeClass('hide');
}
});
//【品牌】搜索
$('#brand-search-input').keyup(function() {
var val = $(this).val().toLowerCase();
if (val === '') {
$brandAttrs.removeClass('hide');
} else {
$brandAttrs.addClass('hide').filter('[data-key*="' + val + '"]').removeClass('hide');
}
});
//【品牌】多选确定
$('#brand-multi-ok').click(function() {
var val = '';
if ($(this).hasClass('dis')) {
return;
}
$brandPanel.find('.checked').each(function() {
var id = $(this).data('id');
val += (val === '') ? id : (',' + id);
});
uriLoc('brand', val);
});
//【品牌/高级选项】多选取消
$('.multi-select-cancel').click(function() {
var $panel = $(this).closest('.multi');
if ($panel.hasClass('brand-panel')) {
$brandMulti.removeClass('hide'); //显示多选按钮
$brandMore.trigger('click');
}
$panel.removeClass('multi');
clearChecked($panel.find('.checkbox.checked')); //清除选中状态
});
//【品牌/高级选项】checkbox
$('.check-container').on('click', '.attr', function() {
var $this = $(this),
$check = $this.find('.checkbox'),
$btnOk = $this.closest('.brand-panel, .senior-sub').find('.multi-select-ok');
$check.toggleClass('checked');
if ($check.hasClass('checked')) {
$check.html(checkUnicode.checked);
} else {
$check.html(checkUnicode.unchecked);
}
//更新按钮状态
if ($check.hasClass('checked') ||
$this.siblings('.attr').find('.checked').length > 0) {
$btnOk.removeClass('dis');
} else {
$btnOk.addClass('dis');
}
});
//【品牌/高级选项】当多选时阻止链接默认跳转
$('.brand, .senior').on('click', '.attr > a', function(e) {
if ($(this).closest('.multi').length > 0) {
e.preventDefault();
}
});
//【价格】用户定义价格处理
if ($udPrice.length > 0) {
$limit = $udPrice.find('.limit');
$min = $limit.filter('.min');
$max = $limit.filter('.max');
$btn = $udPrice.find('.price-sure');
//【价格】输入
$limit.keyup(function() {
var min = $.trim($min.val()),
max = $.trim($max.val()),
isMinInt = interReg.test(min),
isMaxInt = interReg.test(max);
if (isMaxInt && (min === '' || isMinInt) ||
isMinInt && (max === '' || isMaxInt)
) {
$btn.removeClass('hide');
} else {
$btn.addClass('hide');
}
});
//【价格】多项查询
$btn.click(function() {
var min = $.trim($min.val()),
max = $.trim($max.val()),
tmp;
//对于min大于max的情况,交换位置
if (min !== '' && max !== '' && +min > +max) {
tmp = max;
max = min;
min = tmp;
}
uriLoc('price', min + ',' + max);
});
}
//【高级选项】鼠标移入显示子项
$seniorAttrWrap.on('mouseenter', '.attr', function() {
var $this = $(this);
var index = $this.index();
if ($this.hasClass('no-sub')) {
return;
}
$this.addClass('hover').siblings().removeClass('hover');
$seniorSubWrap.children('.senior-sub:eq(' + index + ')').removeClass('hide').siblings().addClass('hide');
}).on('mouseleave', '.attr', function() {
var $this = $(this),
index = $this.index();
if ($this.hasClass('no-sub')) {
return;
}
hoveredIndex = index;
seniorHoverTime = setTimeout(function() {
hideSeniorPanel();
}, 100);
});
//【高级选项】多选
$('.senior-sub').on('click', '.multi-select', function() {
$(this).closest('.senior-sub').addClass('multi');
}).on('click', '.multi-select-ok', function() {
var $btn = $(this),
$sub = $btn.closest('.senior-sub'),
val = '';
if ($btn.hasClass('dis')) {
return;
}
$sub.find('.checked').each(function() {
var id = $(this).data('id');
val += (val === '') ? id : (',' + id);
});
uriLoc($sub.data('attr'), val);
}).on('mouseenter', function() {
clearTimeout(seniorHoverTime);
}).on('mouseleave', function() {
hideSeniorPanel();
});
/**
* 商品筛选逻辑
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/12/4
*/
var $ = require("jquery"),
Handlebars = require("handlebars");
var checkUnicode = {
unchecked: '&#xe613;',
checked: '&#xe612;'
},
moreUnicode = {
up: '&#xe610;',
down: '&#xe600;'
};
//品牌相关变量
var $brandDefault = $('.brand .default'),
$brandPanel = $('.brand .brand-panel'),
$brandAttrs = $brandPanel.find('.attr'),
$brandMore = $('#brand-more'),
$brandMulti = $('#brand-multi');
var $brandMoreTxt, $brandMoreIcon;
//价格相关变量
var $udPrice = $('.ud-price-range'),
interReg = /^\d+$/,
$limit, $min, $max, $btn;
//分类相关变量
var $sortSub = $('.sort-sub-wrap');
//高级选项相关变量
var $seniorSubWrap = $('.senior-sub-wrap'),
$seniorAttrWrap = $('.senior-attr-wrap');
var seniorHoverTime, hoveredIndex;
// 尺寸 handlebars 模板
var sizeTmpl = '{{# size}}<a class="attr {{#if checked}}checked{{/if}}" href="{{href}}">{{name}}</a>{{/ size}}',
sizeCache = {}, // 缓存一下尺寸信息
$sizeWrap = $('.filter-box .size');
sizeTmpl = Handlebars.compile(sizeTmpl);
//清除checkbox选中状态
function clearChecked($checkbox) {
$checkbox.removeClass('checked').html(checkUnicode.unchecked);
}
//显示更多品牌面板
function brandShowMore() {
$brandDefault.addClass('hide');
$brandPanel.removeClass('hide');
}
//隐藏更多品牌面板
function brandHideMore() {
$brandPanel.addClass('hide');
$brandDefault.removeClass('hide');
}
//url构造&跳转
function uriLoc(attr, val) {
var href = decodeURIComponent(window.location.search),
query = attr + '=' + val,
newHref;
if (href === '') {
newHref = '?' + query;
} else {
newHref = href + '&' + query;
}
window.location.href = newHref;
}
//隐藏高级选项面板
function hideSeniorPanel(index) {
$seniorSubWrap.children('.senior-sub:eq(' + hoveredIndex + ')').addClass('hide');
$seniorAttrWrap.children('.attr:eq(' + hoveredIndex + ')').removeClass('hover');
hoveredIndex = -1;
}
//屏蔽筛选项双击文字选中
$('.filter-box').on('selectstart', '.attr, .brands-index span', function() {
return false;
});
//【分类】
$('.sort-pre').on('click', 'li', function() {
var $this = $(this),
index = $this.index(),
id = $this.data('id');
if ($this.hasClass('active')) {
// 选中时,再次点击取消选中
$this.removeClass('active');
$sortSub.children(':eq(' + index + ')').addClass('hide');
$sizeWrap.addClass('hide');
return;
}
$this.siblings('.active').removeClass('active');
$this.addClass('active');
$sortSub.children(':not(.hide)').addClass('hide');
$sortSub.children(':eq(' + index + ')').removeClass('hide');
if (!$sizeWrap.data('load')) {
if (sizeCache[id]) {
$sizeWrap.find('.attr-content').html(sizeCache[id]);
$sizeWrap.removeClass('hide');
} else {
$.ajax({
url: '/product/search/sortSize',
data: {
msort: id
}
}).then(function(res) {
if ($.type(res) === 'array' && res.length) {
sizeCache[id] = sizeTmpl({
size: res
});
$sizeWrap.find('.attr-content').html(sizeCache[id]);
$sizeWrap.removeClass('hide');
} else {
$sizeWrap.addClass('hide');
}
});
}
}
});
//【品牌】
if ($brandMore.length > 0) {
$brandMoreTxt = $brandMore.children('em');
$brandMoreIcon = $brandMore.children('.iconfont');
}
//【品牌】多选
$brandMulti.click(function() {
if ($brandPanel.css('display') === 'none') {
//显示品牌面板
$brandMore.trigger('click');
}
brandShowMore();
$brandPanel.removeClass('hide').addClass('multi'); //显示出checkbox
$(this).addClass('hide');
});
//【品牌】更多
$brandMore.click(function() {
var $this = $(this);
if ($this.hasClass('more')) {
brandHideMore();
$brandMoreTxt.text('更多');
$brandMoreIcon.html(moreUnicode.down);
} else {
brandShowMore();
$brandMoreTxt.text('收起');
$brandMoreIcon.html(moreUnicode.up);
}
$(this).toggleClass('more');
});
//【品牌】索引
$('.brands-index').on('mouseenter', 'span', function() {
var $this = $(this),
index = $this.data('index');
if ($this.hasClass('hover')) {
return;
}
$this.siblings('span.hover').removeClass('hover');
$this.addClass('hover');
if ($this.index() === 0) {
//全部
$brandAttrs.removeClass('hide');
} else {
$brandAttrs.addClass('hide').filter('[data-index=' + index + ']').removeClass('hide');
}
});
//【品牌】搜索
$('#brand-search-input').keyup(function() {
var val = $(this).val().toLowerCase();
if (val === '') {
$brandAttrs.removeClass('hide');
} else {
$brandAttrs.addClass('hide').filter('[data-key*="' + val + '"]').removeClass('hide');
}
});
//【品牌】多选确定
$('#brand-multi-ok').click(function() {
var val = '';
if ($(this).hasClass('dis')) {
return;
}
$brandPanel.find('.checked').each(function() {
var id = $(this).data('id');
val += (val === '') ? id : (',' + id);
});
uriLoc('brand', val);
});
//【品牌/高级选项】多选取消
$('.multi-select-cancel').click(function() {
var $panel = $(this).closest('.multi');
if ($panel.hasClass('brand-panel')) {
$brandMulti.removeClass('hide'); //显示多选按钮
$brandMore.trigger('click');
}
$panel.addClass('hide').removeClass('multi');
brandHideMore();
clearChecked($panel.find('.checkbox.checked')); //清除选中状态
});
//【品牌/高级选项】checkbox
$('.check-container').on('click', '.attr', function() {
var $this = $(this),
$check = $this.find('.checkbox'),
$btnOk = $this.closest('.brand-panel, .senior-sub').find('.multi-select-ok');
$check.toggleClass('checked');
if ($check.hasClass('checked')) {
$check.html(checkUnicode.checked);
} else {
$check.html(checkUnicode.unchecked);
}
//更新按钮状态
if ($check.hasClass('checked') ||
$this.siblings('.attr').find('.checked').length > 0) {
$btnOk.removeClass('dis');
} else {
$btnOk.addClass('dis');
}
});
//【品牌/高级选项】当多选时阻止链接默认跳转
$('.brand, .senior').on('click', '.attr > a', function(e) {
if ($(this).closest('.multi').length > 0) {
e.preventDefault();
}
});
//【价格】用户定义价格处理
if ($udPrice.length > 0) {
$limit = $udPrice.find('.limit');
$min = $limit.filter('.min');
$max = $limit.filter('.max');
$btn = $udPrice.find('.price-sure');
//【价格】输入
$limit.keyup(function() {
var min = $.trim($min.val()),
max = $.trim($max.val()),
isMinInt = interReg.test(min),
isMaxInt = interReg.test(max);
if (isMaxInt && (min === '' || isMinInt) ||
isMinInt && (max === '' || isMaxInt)
) {
$btn.removeClass('hide');
} else {
$btn.addClass('hide');
}
});
//【价格】多项查询
$btn.click(function() {
var min = $.trim($min.val()),
max = $.trim($max.val()),
tmp;
//对于min大于max的情况,交换位置
if (min !== '' && max !== '' && +min > +max) {
tmp = max;
max = min;
min = tmp;
}
uriLoc('price', min + ',' + max);
});
}
//【高级选项】鼠标移入显示子项
$seniorAttrWrap.on('mouseenter', '.attr', function() {
var $this = $(this);
var index = $this.index();
if ($this.hasClass('no-sub')) {
return;
}
$this.addClass('hover').siblings().removeClass('hover');
$seniorSubWrap.children('.senior-sub:eq(' + index + ')').removeClass('hide').siblings().addClass('hide');
}).on('mouseleave', '.attr', function() {
var $this = $(this),
index = $this.index();
if ($this.hasClass('no-sub')) {
return;
}
hoveredIndex = index;
seniorHoverTime = setTimeout(function() {
hideSeniorPanel();
}, 100);
});
//【高级选项】多选
$('.senior-sub').on('click', '.multi-select', function() {
$(this).closest('.senior-sub').addClass('multi');
}).on('click', '.multi-select-ok', function() {
var $btn = $(this),
$sub = $btn.closest('.senior-sub'),
val = '';
if ($btn.hasClass('dis')) {
return;
}
$sub.find('.checked').each(function() {
var id = $(this).data('id');
val += (val === '') ? id : (',' + id);
});
uriLoc($sub.data('attr'), val);
}).on('mouseenter', function() {
clearTimeout(seniorHoverTime);
}).on('mouseleave', function() {
hideSeniorPanel();
});
});
define("js/product/sort-pager", ["jquery"], function(require, exports, module){
... ... @@ -3501,49 +3512,49 @@ var $ = require("jquery");
}($));
});
define("js/common/accordion", ["jquery"], function(require, exports, module){
var Slide = require("js/common/yohoui/YH.slide");
var $ = require("jquery");
var $contain = $('.slide-accordion');
var $item = $contain.find('li');
var $width = $item.width();
var $spn = parseInt($('.home-page').width()) === 1150 ? (120 + 5) : (102 + 5);
var slide;
function switchfun(to) {
$item.each(function(index) {
$(this).css('zIndex', index);
if (index <= to) {
$(this).stop().animate({
left: index * $spn
}, 400);
} else {
$(this).stop().animate({
left: (to) * $spn + $width + $spn * (index - to - 1)
}, 400);
}
});
}
switchfun(0);
slide = new Slide({
length: 5,
loop: false,
auto: false,
timeout: 2,
index: 3
});
slide.on('change', function(data) {
switchfun(data.to);
});
$item.mouseover(function() {
slide.go($(this).index());
});
var Slide = require("js/common/yohoui/YH.slide");
var $ = require("jquery");
var $contain = $('.slide-accordion');
var $item = $contain.find('li');
var $width = $item.width();
var $spn = parseInt($('.home-page').width()) === 1150 ? (120 + 5) : (102 + 5);
var slide;
function switchfun(to) {
$item.each(function(index) {
$(this).css('zIndex', index);
if (index <= to) {
$(this).stop().animate({
left: index * $spn
}, 400);
} else {
$(this).stop().animate({
left: (to) * $spn + $width + $spn * (index - to - 1)
}, 400);
}
});
}
switchfun(0);
slide = new Slide({
length: 5,
loop: false,
auto: false,
timeout: 2,
index: 1
});
slide.on('change', function(data) {
switchfun(data.to);
});
$item.mouseover(function() {
slide.go($(this).index());
});
slide.init();
});
define("js/common/yohoui/YH.slide", [], function(require, exports, module){
... ... @@ -4764,7 +4775,7 @@ function validateRule(page, $element, callback) {
callback();
} else if (val.length <= 3) {
validateResult[2].message = '短信验证码为4位';
validateResult[2].message = '短信验证码错误';
validateResult[2].status = false;
callback();
... ... @@ -5778,7 +5789,7 @@ $('#login-btn').on('click', function() {
}
} else {
$passwordTip.removeClass('hide').children('em').html(data.message);
$password.addClass('error');
$password.addClass('error').val('');
}
},
complete: function() {
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
... ... @@ -147,7 +147,15 @@ function actionGoodsCart() {
if (typeof window.cookie(params.cookie) === 'undefined') {
cartInfo = null;
} else {
cartInfo = json2.parse(window.cookie(params.cookie));
if (params.cookie) {
try {
cartInfo = json2.parse(window.cookie(params.cookie));
} catch (e) {
}
}
}
if (cartInfo != null) {
totalNum = parseInt(cartInfo._nac) + parseInt(cartInfo._ac);
... ... @@ -817,7 +825,7 @@ function actionTipPic() {
}
});
logolink = $('.first-nav-list .cur').find('a').attr('href');
$('.main-link').attr('href', link);
$('.main-link').attr('href', logolink);
}
... ...
... ... @@ -254,7 +254,7 @@ function validateRule(page, $element, callback) {
callback();
} else if (val.length <= 3) {
validateResult[2].message = '短信验证码为4位';
validateResult[2].message = '短信验证码错误';
validateResult[2].status = false;
callback();
... ...
... ... @@ -759,10 +759,10 @@
.gobuy {
margin-top: 47px;
margin-left: 23px;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2Voa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OSAFZMysNdDrBU6BDeDMzIb/DAHTgXwQGAiMJ4B2P28DppqBCqHxfSC/rTP3V9AMcA08AvOSLgK9FWCT8gHPAwtRC3wCDWxrvGA4PUcAAAAASUVORK5CYII=);
background-repeat: no-repeat;
width: 30px;
height: 30px;
width: 26px;
height: 26px;
position: relative;
cursor: pointer;
}
... ...
... ... @@ -42,15 +42,13 @@ class SaleModel
}
$special = $specialInfo['data'];
//Sale首页 banner数据
$data['saleBanner']['bannerHeight'] = $special['banner'][0]['height'];
$data['saleBanner']['img'] = $special['banner'][0]['img'];
$data['saleTitle']['name'] = '全部商品';
$data['saleTitle']['count'] = $data['totalCount'];
//Sale首页 banner数据
$data['saleBanner']['bannerHeight'] = $special['banner'][0]['height'];
$data['saleBanner']['img'] = $special['banner'][0]['img'];
$data['saleTitle']['name'] = '全部商品';
$data['saleTitle']['count'] = isset($data['totalCount']) ? $data['totalCount'] : 0;
}
//获取广告位数据
if (isset($special['left_ad_code'])) {
$nodeContent = HelperSearch::getNodeContent($special['left_ad_code']);
... ...
... ... @@ -157,9 +157,10 @@ class SearchModel
// 组合搜索商品url
$urlList['product'] = SearchData::getProductUrl($searchCondition['condition']);
// 组合搜索分类url
$urlList['sort'] = SearchData::getClassesUrl($searchCondition['sortCondition']);
//$urlList['sort'] = SearchData::getClassesUrl($searchCondition['sortCondition']);
$urlList['sort'] = SearchData::getClassesUrl();
// 组合搜索折扣区间url
$urlList['discount'] = SearchData::getDiscountUrl($searchCondition['condition']);
$urlList['discount'] = SearchData::getDiscountUrl();
$result = Yohobuy::getMulti($urlList);
// 组织模板数据
$data = HelperSearch::getList($result, $searchCondition['options']);
... ... @@ -275,4 +276,32 @@ class SearchModel
return HelperSearch::size($result['data']['filter'], true);
}
}
/**
* @param $keyword
* @return array
*/
public static function searchError($keyword) {
$keyword = HelperSearch::stripTags($keyword);
$keyword = HelperSearch::mbSubstr($keyword, 300);
$data = array(
//初始化js
'searchListPage' => true,
'search' => array(
'keyWord' => $keyword,
'searchActionUrl' => 'http://search.yohobuy.com',
'latestWalk' => 7,
'pathNav' => Array(
'0'=>array(
'href' => '/',
'name' => '首页'
),
'1'=>array(
'name' => '搜索“<span id="nav_keyword">'.$keyword.'</span>”共<span id="nav_keyword_count">0</span>个结果'
)
)
)
);
return $data;
}
}
\ No newline at end of file
... ...
... ... @@ -66,14 +66,15 @@ class ListController extends WebAction
$options['controller'] = 'Index';
$options['action'] = 'sale';
$options['reviewNum'] = 6;
$condition = array(
'p_d' => '0.01,0.99'
);
$option = array(
'controller' => 'List',
'action' => 'sale',
'reviewNum' => 6
);
$condition = array();
if (!$this->get('p_d')){
$condition['p_d'] = '0.01,0.99';
}
$list = SearchModel::getListData($condition,$option);
$data = array(
//初始化js
... ...
... ... @@ -29,7 +29,6 @@ class SaleController extends WebAction
} else {
$special = array();
}
$condition = array();
//传品牌ID参数
... ... @@ -50,7 +49,6 @@ class SaleController extends WebAction
);
$saleData = SaleModel::getSaleSearchData($condition, $options, $specialInfo);
$data = array(
//初始化js
'productListPage' => true,
... ...
... ... @@ -63,24 +63,7 @@ class SearchController extends WebAction
public function errorAction()
{
$keyword = $this->get('query');
$data = array(
//初始化js
'searchListPage' => true,
'search' => array(
'keyWord' => $keyword,
'searchActionUrl' => 'http:://search.yohobuy.com',
'latestWalk' => 7,
'pathNav' => Array(
'0'=>array(
'href' => '/',
'name' => '首页'
),
'1'=>array(
'name' => '搜索“<span id="nav_keyword">'.$keyword.'</span>”共<span id="nav_keyword_count">0</span>个结果'
)
)
)
);
$data = SearchModel::searchError($keyword);
$this->setTitle('潮流商品搜索 | YOHO!有货');
$this->setKeywords('Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流');
$this->setDescription('潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜');
... ...
... ... @@ -26,10 +26,18 @@ routes.searchsuggest.route.module = Product
routes.searchsuggest.route.controller = Search
routes.searchsuggest.route.action = suggest
;error(suggest 错误提示)
routes.searcherror.type = "rewrite"
routes.searcherror.match = "/error"
routes.searcherror.route.module = Product
routes.searcherror.route.controller = Search
routes.searcherror.route.action = error
;about(品牌介绍)
routes.brandabout.type = "rewrite"
routes.brandabout.match = "/about"
routes.brandabout.route.module = Product
routes.brandabout.route.controller = Index
routes.brandabout.route.action = about
\ No newline at end of file
routes.brandabout.route.action = about
... ...