Authored by wangqing
Commit d0204b6ebe86df619fa84da77ac95d94f3d24a68 2 parents b92042ee 3b6ec971 master ... develop feature/4LevelAddr feature/birthCoupon feature/cartEvent feature/colorLength feature/commentImgShow feature/deleteMark feature/favShopDelAll feature/help feature/jitTip feature/paySuccess feature/seoUrl feature/shoppingCart feature/wholesaleFrom5.3 gray hotfix/firefoxCart hotfix/govLink hotfix/newPy hotfix/serviceSwitch hotfix/studentSwitch hotfix/yas2.1.2 release/5.3.1 release/5.4 release/5.4.1 release/5.5 5.4.3 5.4.2 5.4.1 5.4.0 5.3.8 5.3.7 5.3.6 5.3.5 5.3.4 5.3.3 5.3.2 5.3.1 5.3.0 5.2.4 5.2.3 5.2.2 5.2.1 5.2.0 5.1.5 5.1.4 5.1.2 5.1.1 5.1.0 5.0.4 5.0.3 5.0.2 5.0.1 5.0.0.before 4.9.24 4.9.23 4.9.22 4.9.21 4.9.20 4.9.19 4.9.18 4.9.17.encryBugsFenliu 4.9.16 4.9.15 4.9.15.pinyou 4.9.14 4.9.14.icon 4.9.13 4.9.12 4.9.11 4.9.10 4.9.1.1 4.9.1.0 4.9.1 4.8.15 4.8.13 4.8.12 4.8.8.2 4.8.8.1 4.8.8 4.8.5 4.8.3 4.8.2 4.8.bak 4.7.2 4.6.2.1 4.6.2 4.6 4 1.3.22 1.3.21 wap.3.2.5 wap.1.4.22 wap.1.4.21 wap.1.4.20 wap.1.4.19 wap.1.4.18 wap.1.4.17 wap.1.4.16.3 wap.1.4.16.2 wap.1.4.16.1 wap.1.4.16 wap.1.4.15 wap.1.4.14 wap.1.4.13 wap.1.4.12 wap.1.4.11 wap.1.4.10 wap.1.4.9 wap.1.4.8 wap.1.4.7 wap.1.4.6 wap.1.4.5 wap.1.4.4 wap.1.4.3 wap.1.4.2 wap.1.4.1 wap.1.4.0 pchttps pc4.8.9 pc4.5 pc.1.4.24 pc.1.4.23 pc.1.4.22 pc.1.4.21 pc.1.4.20 pc.1.4.19 pc.1.4.18 pc.1.4.17 pc.1.4.16 pc.1.4.15 pc.1.4.14 pc.1.4.13 pc.1.4.12 pc.1.4.11 pc.1.4.10 pc.1.4.9 pc.1.4.8 pc.1.4.7 pc.1.4.6 pc.1.0.7 pc.1.0.6 pc.1.0.5 pc.1.0.4 pc.1.0.3 pc.1.0.2 pc.1.0.1 pc.1.0.0 list fix-ip-login-limit fix-ip-limit

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

... ... @@ -12,5 +12,6 @@ class WebCacheConfig
const KEY_WEB_HOME_CHANNEL_DATA = 'key_web_home_channel_data';//web首页频道数据[boys, girls, kids, lifestyle]
const KEY_WEB_HOME_CHANNEL_NEWARRIVAL_DATA = 'key_web_home_newarrival_data';//web频道最新上架数据[boys, girls, kids, lifestyle]
const KEY_WEB_PRODUCT_SEARCH_DATA = 'key_web_product_search_data'; // web搜索的数据
const KEY_WEB_GUANG_PLUSSTAR_DATA = 'key_web_guang_plussstar_data';//web逛的plusstar
}
... ...
<?php
namespace LibModels\Web\Guang;
use Api\Yohobuy;
use Api\Sign;
class PlusstarData extends \LibModels\Wap\Guang\PlusstarData {
const URI_BRANDLIST = 'guang/api/v3/plustar/getlist';
/**
* 获取品牌列表
*
* @param int $brandType
* @param string $gender
* @param string $isRecommend
* @param string $type
* @return array
*/
public static function getList($brandType, $gender = '', $isRecommend = '', $type = 'h5') {
// 公共的参数
$param = Yohobuy::param();
$param['gender'] = $gender;
$param['gender'] = $gender;
$param['brand_type'] = $brandType;
$param['gender'] = $gender;
$param['client_type'] = $type;
$param['is_recommend'] = $isRecommend;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_BRANDLIST, $param);
}
}
\ No newline at end of file
... ...
... ... @@ -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;
}
}
... ... @@ -636,7 +647,15 @@ class HelperSearch
//设置已选中价格
if (!empty($priceId)) {
$price = explode(',' ,$priceId);
$customName = isset($price[1]) && $price[1] == 99999 ? '¥'.$price[0].'以上' : '¥' . intval($price[0]-1) . '-' . intval($price[1]);
if (isset($price[1]) && empty($price[1])) {
$customName = '¥' . intval($price[0]) . '-99999';
}
elseif (isset($price[1]) && $price[1] == 99999) {
$customName = '¥'.intval($price[0]-1).'以上';
}
else {
$customName = '¥' . intval($price[0]) . '-' . intval($price[1]);
}
$name = isset($filter['price'][$priceId]) ? $filter['price'][$priceId] : $customName;
self::$selected['price'] = array(
'name' => $name,
... ... @@ -875,10 +894,12 @@ class HelperSearch
}
$result = array(
'name' => '最新',
'href' => isset(self::$params['order']) && self::$params['order'] == 's_t_desc' ? self::buildUrl($params) : self::buildUrl(array_merge($params, array(
'href' => isset(self::$params['order']) && self::$params['order'] == 's_t_desc' ? self::buildUrl(array_merge($params, array(
'order' => 's_t_asc'
))) : self::buildUrl(array_merge($params, array(
'order' => 's_t_desc'
))) ,
'active' => isset(self::$params['order']) && self::$params['order'] == 's_t_asc' ? true : ''
'active' => isset(self::$params['order']) && self::$params['order'] == 's_t_desc' ? true : ''
);
return $result;
}
... ... @@ -1027,6 +1048,7 @@ class HelperSearch
if ($data) {
$result['conditions'] = $data;
$result['clearUrl'] = self::current();
}
return $result;
}
... ... @@ -1036,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();
... ... @@ -1075,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(
... ... @@ -1083,6 +1105,7 @@ class HelperSearch
);
unset($data);
unset($query);
return $result;
}
/**
... ... @@ -1090,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];
}
/**
... ... @@ -1347,6 +1373,9 @@ class HelperSearch
elseif ($controller == 'list' && $action == 'sale') {
$type = isset(self::$params['discount']) && self::$params['discount'] ? self::$params['discount'] : '0,0.9';
}
elseif ($controller == 'sale' && $action == 'index') {
$type = isset(self::$params['specialsale_id']) && self::$params['specialsale_id'] ? self::$params['specialsale_id'] : '';
}
// 品牌
elseif ($controller == 'list' && $action == 'sale') {
$type = isset(self::$params['brandId']) && self::$params['brandId'] ? self::$params['brandId'] : '';
... ... @@ -1364,4 +1393,65 @@ class HelperSearch
}
return $url;
}
public static function stripTags($html) {
$search = array(
'&nbsp;',
"'<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;
}
}
... ...
... ... @@ -38,7 +38,7 @@
<input id="agree-terms" class="agree-terms" type="checkbox" checked="">
<span>
我已阅读并同意遵守
<a class="link go-yoho-items" href="{{itemUrl}}">YOHO!有货服务条款</a>
<a class="link go-yoho-items" href="{{itemUrl}}" target="_blank">YOHO!有货服务条款</a>
</span>
</li>
<li class="clearfix">
... ...
... ... @@ -682,7 +682,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">' +
... ... @@ -1824,7 +1824,8 @@ function init() {
actionCover(); //初次登录弹框
actionAddKeyWords(); //增加关键字
}
init();
init();
});
define("js/simple-header", ["jquery"], function(require, exports, module){
var $ = require("jquery");
... ... @@ -1960,364 +1961,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 +3504,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 +4767,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 +5781,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.
... ... @@ -30,7 +30,7 @@ slide = new Slide({
loop: false,
auto: false,
timeout: 2,
index: 3
index: 1
});
slide.on('change', function(data) {
... ...
... ... @@ -355,7 +355,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">' +
... ... @@ -1497,4 +1497,4 @@ function init() {
actionCover(); //初次登录弹框
actionAddKeyWords(); //增加关键字
}
init();
\ No newline at end of file
init();
... ...
... ... @@ -285,7 +285,7 @@ $('#login-btn').on('click', function() {
}
} else {
$passwordTip.removeClass('hide').children('em').html(data.message);
$password.addClass('error');
$password.addClass('error').val('');
}
},
complete: function() {
... ...
... ... @@ -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();
... ...
... ... @@ -150,7 +150,8 @@ $brandMulti.click(function() {
$brandMore.trigger('click');
}
$brandPanel.addClass('multi'); //显示出checkbox
brandShowMore();
$brandPanel.removeClass('hide').addClass('multi'); //显示出checkbox
$(this).addClass('hide');
});
... ... @@ -232,7 +233,8 @@ $('.multi-select-cancel').click(function() {
$brandMore.trigger('click');
}
$panel.removeClass('multi');
$panel.addClass('hide').removeClass('multi');
brandHideMore();
clearChecked($panel.find('.checkbox.checked')); //清除选中状态
});
... ...
... ... @@ -99,55 +99,94 @@
margin-left:10px;
}
}
//990样式
.tpl-nav{
width: 158px;
.keywords0,.keywords1,.keywords2{
margin-bottom:8px;
height: 65px;
width: 185px;
.keywords0,.keywords1,.keywords2{
margin-bottom:10px;
height: 76px;
}
.keywords2{
margin-bottom:0px;
}
.tpl-category{
height: 192px;
height: 228px;
a{
height: 32px;
line-height: 32px;
font-size: 12px;
&:hover{
text-decoration: underline;
}
height: 38px;
line-height: 38px;
font-size: 14px;
}
}
}
.tpl-brands{
width: 324px;
height: 432px;
width: 378px;
height: 504px;
li a{
height: 212px;
height: 248px;
}
}
.tpl-types{
width: 498px;
width: 579px;
li a{
width: 158px;
height: 212px;
width: 185px;
height: 248px;
}
}
.tpl-products{
li a{
width: 190px;
height: 254px;
width: 222px;
height: 298px;
}
}
}
}
.min-screen .home-page .tpl-recommend{
//990样式
.tpl-nav{
width: 158px;
.keywords0,.keywords1,.keywords2{
margin-bottom:8px;
height: 65px;
}
.keywords2{
margin-bottom:0px;
}
.tpl-category{
height: 192px;
a{
height: 32px;
line-height: 32px;
font-size: 12px;
&:hover{
text-decoration: underline;
}
}
}
}
.tpl-brands{
width: 324px;
height: 432px;
li a{
height: 212px;
}
}
.tpl-types{
width: 498px;
li a{
width: 158px;
height: 212px;
}
}
.tpl-products{
li a{
width: 190px;
height: 254px;
}
}
}
/**
* 单品模板样式
... ... @@ -161,15 +200,7 @@
margin-bottom:8px;
}
}
.singlehot{
li a{
width: 158px;
height: 212px;
}
.impo1,.impo9{
width: 323px;
}
}
.floor-ad{
a{
display: block;
... ... @@ -183,19 +214,64 @@
margin-right:-10px;
width: inherit;
.good-info{
margin-bottom:0px;
}
.good-detail-text{
text-align: center;
}
}
.singlehot{
li a{
width: 185px;
height: 248px;
}
.impo1,.impo9{
width: 378px;
}
}
.goods-container{
.good-info{
width: 280px;
height: 485px;
.good-detail-img{
height: 374px;
}
}
}
.adbanner{
margin-top:12px;
a{
height: 150px;
}
}
}
.min-screen .home-page{
.singlehot{
li a{
width: 158px;
height: 212px;
}
.impo1,.impo9{
width: 323px;
}
}
.goods-container{
.good-info{
width: 240px;
height: 412px;
margin-bottom:0px;
.good-detail-img{
height: 320px;
}
}
.good-detail-text{
text-align: center;
}
}
}
/*
* 人气单品
*/
.home-page{
.commodity{
.commodity-list{
... ... @@ -273,11 +349,36 @@
line-height: 35px;
text-align: center;
}
}
}
//990
//1150
.commodity{
.commodity-list{
a{
height: 465px;
width: 280px;
}
.commodity-img{
height: 374px;
}
i.top{
height: 60px;
width: 60px;
line-height: 60px;
font-size: 20px;
}
}
.commodity-brands{
a{
width: 185px;
height: 86px;
}
}
}
}
//990
.min-screen .home-page{
.commodity{
.commodity-list{
a{
... ... @@ -303,11 +404,13 @@
}
}
/*
* 手风琴
*/
.home-page{
.slide-accordion{
overflow: hidden;
height: 342px;
position: relative;
a{
display: block;
... ... @@ -334,170 +437,84 @@
}
}
}
//1150
.slide-accordion{
height: 400px;
li{
a{
width: 650px;
height: 400px;
}
}
}
}
.min-screen .home-page{
.slide-accordion{
height: 342px;
li{
a{
width: 558px;
height: 342px;
}
}
}
}
.boys{
.tpl-nav{
.keywords0{
margin-bottom: 8px!important;
height: 130px!important;
margin-bottom: 10px!important;
height: 152px!important;
}
.keywords1{
margin-bottom:0px!important;
height: 74px!important;
height: 86px!important;
}
.tpl-category{
a{
height: 38px!important;
line-height: 38px!important;
font-size: 14px!important;
}
}
}
.tpl-brands{
margin-top:-8px!important;
}
}
.boys,.lifestyle{
.goods-container{
.good-info{
width: 188px;
height: 360px;
width: 222px!important;
height: 408px!important;
.good-detail-img{
height: 255px;
height: 298px!important;
}
}
}
}
//1150样式
@media screen and (min-width: 1150px) {
.home-page{
.tpl-recommend{
.tpl-nav{
width: 185px;
.keywords0,.keywords1,.keywords2{
margin-bottom:10px;
height: 76px;
}
.keywords2{
margin-bottom:0px;
}
.tpl-category{
height: 228px;
a{
height: 38px;
line-height: 38px;
font-size: 14px;
}
}
}
.tpl-brands{
width: 378px;
height: 504px;
li a{
height: 248px;
}
}
.tpl-types{
width: 579px;
li a{
width: 185px;
height: 248px;
}
}
.tpl-products{
li a{
width: 222px;
height: 298px;
}
}
}
.singlehot{
li a{
width: 185px;
height: 248px;
}
.impo1,.impo9{
width: 378px;
}
}
.adbanner{
margin-top:12px;
a{
height: 150px;
}
}
.slide-accordion{
height: 400px;
li{
a{
width: 650px;
height: 400px;
}
}
}
.goods-container{
.good-info{
width: 280px;
height: 485px;
.good-detail-img{
height: 374px;
}
}
}
.commodity{
.commodity-list{
a{
height: 465px;
width: 280px;
}
.commodity-img{
height: 374px;
}
i.top{
height: 60px;
width: 60px;
line-height: 60px;
font-size: 20px;
}
}
.commodity-brands{
a{
width: 185px;
height: 86px;
}
}
}
}
.min-screen{
.boys{
.tpl-nav{
width: 185px!important;
.keywords0{
margin-bottom: 10px!important;
height: 152px!important;
margin-bottom: 8px!important;
height: 130px!important;
}
.keywords1{
height: 86px!important;
}
.tpl-category{
a{
height: 38px!important;
line-height: 38px!important;
font-size: 14px!important;
}
margin-bottom:0px!important;
height: 74px!important;
}
}
.tpl-brands{
margin-top:-8px!important;
}
}
.boys,.lifestyle{
.goods-container{
.good-info{
width: 222px!important;
height: 408px!important;
width: 188px;
height: 360px;
.good-detail-img{
height: 298px!important;
height: 255px;
}
}
}
... ... @@ -505,7 +522,6 @@
}
.brands{
.brands-tabs{
... ... @@ -660,289 +676,292 @@
//990
.sit-nav{
padding-top: 10px;
padding-left: 22px;
font-size: 12px;
.sep{
margin: 0 6px;
padding-left: 26px;
font-size: 12px;
.sep{
margin: 0 8px;
}
}
}
.brands-category{
margin-top: 84px;
width: 990px;
}
.brands-tabs{
ul{
margin-left: -9px;
.brands-category{
width: 1150px;
}
li{
margin-left: 9px;
a{
width: 190px;
height: 154px;
position: relative;
.brands-tabs{
height: 280px;
ul{
margin-left: -10px;
}
}
.brands-content{
width: 990px;
top: 200px;
.brands-icon{
margin-left: -33px;
padding: 0 4px;
li{
margin-left: 10px;
a{
float: left;
width: 68px;
height: 44px;
margin-left: 33px;
width: 222px;
height: 180px;
position: relative;
}
}
}
.hover-contain{
height: 25px;
.hoverarr{
height: 4px;
width: 190px;
}
}
}
.brandfloor{
//990
ul{
margin-left: -12px;
}
li{
margin-left: 12px;
margin-bottom:26px;
a{
width: 322px;
height: 206px;
}
.brands-content{
width: 1150px;
top: 230px;
.brands-icon{
margin-left: -38px;
padding: 0 4px;
a{
float: left;
width: 80px;
height: 50px;
margin-left: 38px;
}
}
}
.hover-contain{
height: 30px;
.hoverarr{
height: 5px;
width: 222px;
}
}
}
}
.singlegoods{
//990
ul{
margin-left: -10px;
}
li{
margin-left: 10px;
margin-bottom:10px;
a{
width: 240px;
height: 322px;
}
}
.singlegoods-title{
position: absolute;
left: 0;
bottom: 0;
height: 50px;
width: 100%;
p{
position: absolute;
z-index: 2;
top: 0;
left: 0;
display: block;;
width: 100%;
height: 100%;
line-height: 50px;
font-size: 18px;
text-align: center;
color: #fff;
.brandfloor{
ul{
margin-left: -10px;
}
}
}
.video{
ul{
margin-left: -10px;
}
li{
margin-left: 10px;
margin-bottom:10px;
a{
width: 323px;
height: 208px;
}
}
.video-play{
display: block;
position: absolute;
left: 50%;
top: 50%;
margin-left: -30px;
margin-top: -28px;
width: 60px;
height: 56px;
background-image: image-url("index/play.png");
}
.video-title{
position: absolute;
left: 0;
bottom: 0;
height: 32px;
width: 100%;
p{
position: absolute;
z-index: 2;
top: 0;
left: 0;
display: block;;
width: 100%;
height: 100%;
font-size: 14px;
line-height: 32px;
text-align: center;
color: #fff;
li{
margin-left: 10px;
margin-bottom:32px;
a{
width: 376px;
height: 206px;
}
}
}
}
.news{
margin-bottom: 30px;
.news-pic{
float: left;
width: 660px;
height: 376px;
.slide-wrapper{
height: 376px;
img{
.singlegoods{
//990
ul{
margin-left: -10px;
}
li{
margin-left: 10px;
margin-bottom:10px;
a{
width: 280px;
height: 376px;
}
&:hover {
.slide-switch.show {
display: none;
}
}
}
}
.slide-tips{
.singlegoods-title{
position: absolute;
left: 0;
bottom: 0;
height: 30px;
height: 50px;
width: 100%;
p{
position: absolute;
left: 18px;
z-index: 2;
height: 30px;
font-size: 14px;
line-height: 30px;
top: 0;
left: 0;
display: block;;
width: 100%;
height: 100%;
line-height: 50px;
font-size: 18px;
text-align: center;
color: #fff;
}
}
.slide-pagination{
right: 0;
left: initial;
bottom: 0;
.slide-shade{
@include opacity(0);
background:none;
}
}
}
.news-txt{
float: right;
padding: 20px 16px;
width: 284px;
height: 334px;
float: right;
border: 1px solid #000;
overflow: auto;
.video{
ul{
margin-left: -10px;
}
li{
position: relative;
display: block;
margin-top: 12px;
margin-left: 20px;
margin-left: 10px;
margin-bottom:10px;
a{
width: 376px;
height: 240px;
}
}
a{
font-size: 14px;
line-height: 24px;
cursor: pointer;
color: #010101;
.video-play{
display: block;
&:hover {
color: #fff;
background: #000;
padding-left: 12px;
-webkit-transition: padding 0.4s;
transition: padding 0.4s;
}
position: absolute;
left: 50%;
top: 50%;
margin-left: -30px;
margin-top: -28px;
width: 60px;
height: 56px;
background-image: image-url("index/play.png");
}
i{
.video-title{
position: absolute;
top: -6px;
left: -26px;
font-size: 30px;
left: 0;
bottom: 0;
height: 32px;
width: 100%;
p{
position: absolute;
z-index: 2;
top: 0;
left: 0;
display: block;;
width: 100%;
height: 100%;
font-size: 14px;
line-height: 32px;
text-align: center;
color: #fff;
}
}
}
}
.ads{
margin-bottom: 30px;
ul{
margin-left: -10px;
}
li{
margin-left: 10px;
margin-bottom: 10px;
a{
width: 240px;
img{
height: 140px;
.news{
margin-bottom: 30px;
.news-pic{
position: relative;
float: left;
width: 764px;
height: 436px;
.slide-container {
height: 436px;
li a{
height: 436px;
width: 764px;
}
&:hover {
.slide-switch.show {
display: none;
}
}
}
.slide-tips{
position: absolute;
left: 0;
bottom: 0;
height: 30px;
width: 100%;
p{
position: absolute;
left: 18px;
z-index: 2;
height: 30px;
font-size: 14px;
line-height: 30px;
color: #fff;
}
}
.slide-pagination{
right: 0;
left: initial;
bottom: 0;
.slide-shade{
@include opacity(0);
background:none;
}
}
}
.name{
font-size: 14px
.news-txt{
float: right;
padding: 20px 16px;
float: right;
border: 1px solid #000;
overflow: auto;
li{
position: relative;
display: block;
margin-top: 12px;
margin-left: 20px;
}
a{
font-size: 14px;
line-height: 24px;
cursor: pointer;
color: #010101;
display: block;
&:hover {
color: #fff;
background: #000;
padding-left: 12px;
-webkit-transition: padding 0.4s;
transition: padding 0.4s;
}
}
i{
position: absolute;
top: -6px;
left: -26px;
font-size: 30px;
}
}
.des{
font-size: 12px;
.news-txt{
width: 342px;
height: 394px;
}
}
}
.brands-items{
margin: 25px auto;
.brands-item{
float: left;
padding: 15px 0;
width: 50%;
}
a.brands-pic{
float: left;
width: 240px;
height: 116px;
display: block;
img{
width: 100%;
height: 100%;
.ads{
ul{
margin-left: -10px;
}
li{
margin-left: 10px;
margin-bottom: 10px;
a{
width: 280px;
img{
height: 160px;
}
}
.name{
font-size: 14px
}
.des{
font-size: 12px;
}
}
}
.brand-info{
float: right;
padding: 0 20px;
width: 212px;
color: #000;
h3{
width: 100%;
font-size: 20px;
line-height: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
.brands-items{
margin: 25px auto;
.brands-item{
float: left;
padding: 15px 0;
width: 50%;
}
.brand-desc{
padding: 12px 0;
height: 72px;
font-size: 14px;
line-height: 22px;
overflow: hidden;
text-overflow: ellipsis;
word-wrap: break-word;
a.brands-pic{
float: left;
width: 280px;
height: 136px;
display: block;
img{
width: 100%;
height: 100%;
}
}
.brand-info{
float: right;
padding: 0 20px;
width: 255px;
color: #000;
h3{
width: 100%;
font-size: 20px;
line-height: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.brand-desc{
padding: 12px 0;
height: 92px;
font-size: 14px;
line-height: 22px;
overflow: hidden;
text-overflow: ellipsis;
word-wrap: break-word;
}
}
}
}
.pagination{
margin-top: 60px;
margin-bottom: 60px;
... ... @@ -969,62 +988,64 @@
}
}
}
@media screen and (min-width: 1150px) {
.brands{
.sit-nav{
padding-left: 26px;
.min-screen .brands{
.sit-nav{
padding-top: 10px;
padding-left: 22px;
font-size: 12px;
.sep{
margin: 0 8px;
margin: 0 6px;
}
}
.brands-category{
width: 1150px;
margin-top: 84px;
width: 990px;
}
.brands-tabs{
ul{
margin-left: -10px;
margin-left: -9px;
}
li{
margin-left: 10px;
li{
margin-left: 9px;
a{
width: 222px;
height: 180px;
width: 190px;
height: 154px;
}
}
}
.brands-content{
width: 1150px;
top: 230px;
width: 990px;
top: 200px;
.brands-icon{
margin-left: -38px;
margin-left: -33px;
padding: 0 4px;
a{
float: left;
width: 80px;
height: 50px;
margin-left: 38px;
width: 68px;
height: 44px;
margin-left: 33px;
}
}
}
.hover-contain{
height: 30px;
height: 25px;
.hoverarr{
height: 5px;
width: 222px;
height: 4px;
width: 190px;
}
}
}
.brandfloor{
//990
ul{
margin-left: -10px;
margin-left: -12px;
}
li{
margin-left: 10px;
margin-bottom:32px;
margin-left: 12px;
margin-bottom:26px;
a{
width: 376px;
width: 322px;
height: 206px;
}
}
... ... @@ -1038,8 +1059,8 @@
margin-left: 10px;
margin-bottom:10px;
a{
width: 280px;
height: 376px;
width: 240px;
height: 322px;
}
}
... ... @@ -1072,8 +1093,8 @@
margin-left: 10px;
margin-bottom:10px;
a{
width: 376px;
height: 240px;
width: 323px;
height: 208px;
}
}
.video-play{
... ... @@ -1110,21 +1131,25 @@
}
.news{
.news-pic{
width: 764px;
height: 436px;
.slide-wrapper{
height: 436px;
width: 660px;
height: 376px;
.slide-container {
height: 376px;
img{
height: 436px;
height: 376px;
}
}
}
.news-txt{
width: 342px;
height: 394px;
width: 284px;
height: 334px;
}
}
.ads{
margin-bottom: 30px;
ul{
margin-left: -10px;
}
... ... @@ -1132,9 +1157,9 @@
margin-left: 10px;
margin-bottom: 10px;
a{
width: 280px;
width: 240px;
img{
height: 160px;
height: 140px;
}
}
.name{
... ... @@ -1146,23 +1171,20 @@
}
}
.brands-items{
a.brands-pic{
width: 280px;
height: 136px;
width: 240px;
height: 116px;
}
.brand-info{
width: 255px;
color: #000;
width: 212px;
.brand-desc{
height: 92px;
height: 72px;
}
}
}
}
}
.brands-layer{
position: absolute;
z-index: 100;
... ... @@ -1208,7 +1230,6 @@
}
}
}
}
.brands-layer-right{
background: url(http://static.yohobuy.com/images/v3/index/brands-layer.png) no-repeat 0 -287px;
... ...
... ... @@ -173,6 +173,18 @@
height: 150px;
line-height: 150px;
}
.logo-brand-switch {
.iconfont {
font-size: 24px;
&.prev {
top: -12px;
}
&.bottom {
bottom: -12px;
}
}
}
}
... ...
... ... @@ -2,15 +2,20 @@
use Action\WebAction;
use Product\BrandsModel;
use LibModels\Web\Product\SearchData;
use Plugin\Helpers;
use WebPlugin\Cache;
use WebPlugin\Images;
use LibModels\Web\Guang\PlusstarData;
use Api\Yohobuy;
use WebPlugin\Paging;
use Configs\WebCacheConfig;
use Guang\PlusstarModel;
/**
* 品牌首页
*/
class BrandsController extends WebAction
{
const URL_PRODUCT_BRAND = '/cmsproduct/service/v1/brands';
public function brandsAction()
{
//品牌一览头部
... ... @@ -529,247 +534,52 @@ class BrandsController extends WebAction
*/
public function listAction()
{
$headerdata = array(
'gobytype' => 'gobuyboys',
'searchcate' => 'searchcateboys',
'navbars' => array(
array(
'name_cn' => '男生',
'name_en' => 'BOYS',
'link' => '',
'classname' => 'boys',
'index_main' => 0,
'subnav' => array(
array(
'name' => '男首1',
'link' => '',
'index_sub' => 0,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '男首2',
'link' => '',
'index_sub' => 1,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '男首3',
'link' => '',
'index_sub' => 2,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
)
)
),
array(
'name_cn' => '女生',
'name_en' => 'GIRLS',
'link' => 'http=>//www.baidu.com',
'classname' => '',
'index_main' => 0,
'subnav' => array(
array(
'name' => '女生1',
'link' => '',
'index_sub' => 0,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '女生2',
'link' => '',
'index_sub' => 1,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '女生3',
'link' => '',
'index_sub' => 2,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
)
)
)
),
'myyoho' => array(
'email' => 'hhh@126.com',
'viptype' => '普通会员',
'currentscore' => 495,
'totalscore' => 600,
'cardtype' => '银卡',
'infolist' => array(
array(
'name' => '待处理的订单',
'link' => '',
'num' => '0'
),
array(
'name' => '我的收藏',
'link' => '',
'num' => '1'
),
array(
'name' => '我的优惠券',
'link' => '',
'num' => '2'
),
array(
'name' => '我的YOHO币',
'link' => '',
'num' => '1'
),
array(
'name' => '我的退货换货',
'link' => '',
'num' => '1'
)
),
'updlink' => ''
),
'gobuy' => array(
'gobuynum' => 3
),
'breadcrumbnav' => array(
array(
'notend' => array(
'link' => 'http=>//www.baidu.com',
'name' => 'BOYS首页'
)
),
array(
'notend' => array(
'link' => 'http=>//www.baidu.com',
'name' => '上衣'
)
),
array(
'isend' => array(
'link' => 'http=>//www.baidu.com',
'name' => '衬衫'
)
)
)
);
$imgsrc = 'http://img11.static.yhbimg.com/goodsimg/2015/10/19/10/01b312c3b7a7efebcd671e73495ff3e306.jpg';
$item1 = array(
'name' => '所有品牌',
'src' => $imgsrc,
'url' => ''
);
$item2 = array(
'name' => '所有品牌',
'src' => $imgsrc,
'url' => '',
'name' => 'Millefed',
'desc' => ' I.T于2006年冬季在香港推出最新品牌创始 人Shawn Stussy将滑板服、工作服、旧校 服的设计加入到 '
);
$this->setWebNavHeader();
$gender = empty($_COOKIE['_Gender']) ? '' : $_COOKIE['_Gender'];
$gender = $this->get('gender', $gender);
$id = $this->get('id', 1);
$brandType = 1;
$isRecommend = 0;
$limit = 20;
$items = BrandsModel::getBrandListItem();
if(isset($items[$id])) {
$brandType = $items[$id]['brandType'];
$isRecommend = $items[$id]['isRecommend'];
}
$list = PlusstarModel::getPlustarList($brandType, '1,3', $isRecommend);
$paging = new Paging('yoho');
$msgPager = $paging->setTotal(count($list))->setSize($limit)->setQuery(array('id' => $id));
$offset = $msgPager->getOffset();
$brands = array();
$brandIds = array_slice(array_keys($list), $offset, $limit);
$key = implode(',', $brandIds);
if(!empty($brandIds))
{
$brands = Cache::get($key);
if(empty($brands))
{
//获取品牌信息
$brandsInfo = BrandsModel::getBrandInfoByIds($brandIds);
foreach($brandIds as $brandId)
{
if(isset($brandsInfo[$brandId]))
{
$list[$brandId]['desc'] = trim(str_replace(array("\t","\n","\r"),'',strip_tags($brandsInfo[$brandId]['brand_intro'])));
$list[$brandId]['url'] = 'http://'.$brandsInfo[$brandId]['brand_domain'].'.yohobuy.com/?gender='.$gender;
}
$brands[] = $list[$brandId];
}
if(!empty($brands))
{
Cache::set($key, $brands, 600);
}
}
}
$brandList = array('items' => $brands,'tabs' => $items);
$data = array(
'brandsHomePage' => true,
'headerdata' => $headerdata,
'brands' => array(
'tabs' => array(
$item1,
$item1,
$item1,
$item1,
$item1
),
'items' => array(
$item2,
$item2,
$item2,
$item2,
$item2,
$item2,
$item2,
$item2
)
)
'brands' => $brandList
);
$this->_view->display('list', $data);
}
}
... ...
<?php
use Action\WebAction;
use Product\BrandsModel;
use LibModels\Web\Product\SearchData;
use Plugin\Helpers;
/**
* 品牌首页
*/
class BrandsController extends WebAction
{
public function brandsAction()
{
//品牌一览头部
$channelStr = $this->getCookie("_Channel");
$channel = empty($channelStr) ? 'boys': $channelStr;
$this->setWebNavHeader($channel);
//banner-list
$res = BrandsModel::getBrandView($channel);
//数据整合
$data = array(
'brandsHomePage' => true,
'brands' => array(
'category' => $res['brandList'],
'tabs' => $res['brandTop']
)
);
$this->_view->display('brands', $data);
}
/**
* 品牌接口数据
*
* @param string brandId 获取品牌ID
* @return json
*/
public function brandinfoAction()
{
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
$brandId = $this->get('brandId', 0);
$uid = $this->getUid(false);
$data = BrandsModel::getBrandInfo($brandId, $uid);
$result = array(
'code' => 200,
'brand' => $data
);
}
while (false);
$this->echoJson($result);
}
/*
* 品牌list
*/
public function indexAction()
{
$headerdata = array(
'gobytype' => 'gobuyboys',
'searchcate' => 'searchcateboys',
'navbars' => array(
array(
'name_cn' => '男生',
'name_en' => 'BOYS',
'link' => '',
'classname' => 'boys',
'index_main' => 0,
'subnav' => array(
array(
'name' => '男首1',
'link' => '',
'index_sub' => 0,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '男首2',
'link' => '',
'index_sub' => 1,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '男首3',
'link' => '',
'index_sub' => 2,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
)
)
),
array(
'name_cn' => '女生',
'name_en' => 'GIRLS',
'link' => 'http=>//www.baidu.com',
'classname' => '',
'index_main' => 0,
'subnav' => array(
array(
'name' => '女生1',
'link' => '',
'index_sub' => 0,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '女生2',
'link' => '',
'index_sub' => 1,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '女生3',
'link' => '',
'index_sub' => 2,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
)
)
)
),
'myyoho' => array(
'email' => 'hhh@126.com',
'viptype' => '普通会员',
'currentscore' => 495,
'totalscore' => 600,
'cardtype' => '银卡',
'infolist' => array(
array(
'name' => '待处理的订单',
'link' => '',
'num' => '0'
),
array(
'name' => '我的收藏',
'link' => '',
'num' => '1'
),
array(
'name' => '我的优惠券',
'link' => '',
'num' => '2'
),
array(
'name' => '我的YOHO币',
'link' => '',
'num' => '1'
),
array(
'name' => '我的退货换货',
'link' => '',
'num' => '1'
)
),
'updlink' => ''
),
'gobuy' => array(
'gobuynum' => 3
),
'breadcrumbnav' => array(
array(
'notend' => array(
'link' => 'http=>//www.baidu.com',
'name' => 'BOYS首页'
)
),
array(
'notend' => array(
'link' => 'http=>//www.baidu.com',
'name' => '上衣'
)
),
array(
'isend' => array(
'link' => 'http=>//www.baidu.com',
'name' => '衬衫'
)
)
)
);
$imgsrc = 'http://img01.yohoboys.com/staticimg/2015/11/26/17/01350e0e001b91af0fc91c974a772b931c.png';
$name_href = array(
'name' => '衣服',
'url' => ''
);
$name_href_img = array(
'href' => '',
'src' => $imgsrc,
'name' => '优显led触控台灯'
);
$data = array(
'brandsHomePage' => true,
'headerdata' => $headerdata,
'brands' => array(
array(
'slide' => array(
'list' => array(
array(
'href' => '/?gender=1,3',
'img' => 'http://img10.static.yhbimg.com/taobaocms/2015/11/26/12/01c3b99f554ad50d9e5a9900719715c94c.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img12.static.yhbimg.com/taobaocms/2015/11/27/09/02a4f1c10e1e81574520e5c0239741a076.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img10.static.yhbimg.com/taobaocms/2015/11/26/12/01c3b99f554ad50d9e5a9900719715c94c.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img12.static.yhbimg.com/taobaocms/2015/11/27/09/02a4f1c10e1e81574520e5c0239741a076.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img10.static.yhbimg.com/taobaocms/2015/11/26/12/01c3b99f554ad50d9e5a9900719715c94c.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img12.static.yhbimg.com/taobaocms/2015/11/27/09/02a4f1c10e1e81574520e5c0239741a076.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img10.static.yhbimg.com/taobaocms/2015/11/26/12/01c3b99f554ad50d9e5a9900719715c94c.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img12.static.yhbimg.com/taobaocms/2015/11/27/09/02a4f1c10e1e81574520e5c0239741a076.jpg'
)
)
)
),
array(
'brand' => array(
'name' => '品牌 BRAND',
'navs' => array(
array(
'id' => '',
'href' => '',
'name' => '设计师品牌'
),
array(
'id' => '',
'href' => '',
'name' => '街头品牌'
),
array(
'id' => '',
'href' => '',
'name' => '明星品牌'
)
),
'list' => array(
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img
)
)
),
array(
'singlegoods' => array(
'name' => '单品 SINGLE GOODS',
'navs' => array(
array(
'id' => '',
'href' => '',
'name' => '设计师品牌'
),
array(
'id' => '',
'href' => '',
'name' => '街头品牌'
),
array(
'id' => '',
'href' => '',
'name' => '明星品牌'
)
),
'list' => array(
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img
)
)
),
array(
'video' => array(
'name' => '视频 VIDEO',
'navs' => array(
array(
'id' => '',
'href' => '',
'name' => '设计师品牌'
),
array(
'id' => '',
'href' => '',
'name' => '街头品牌'
),
array(
'id' => '',
'href' => '',
'name' => '明星品牌'
)
),
'list' => array(
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img
)
)
),
array(
'news' => array(
'name' => '新闻 NEWS',
"pics" => array(
'list' => array(
array(
'href' => '/?gender=1,3',
'img' => 'http://img10.static.yhbimg.com/taobaocms/2015/11/26/12/01c3b99f554ad50d9e5a9900719715c94c.jpg',
'tips' => '轻户外 TEENTEAM ,2015 A/W !'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img12.static.yhbimg.com/taobaocms/2015/11/27/09/02a4f1c10e1e81574520e5c0239741a076.jpg',
'tips' => '轻户外TEENTEAM ,2015 A/W !'
)
)
),
"txts" => array(
'list' => array(
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
),
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
),
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
),
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
),
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
),
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
),
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
),
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
),
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
),
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
),
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
),
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
)
)
)
)
),
array(
'ads' => array(
'list' => array(
array(
'href' => '',
'src' => $imgsrc,
'name' => 'Vans联乘再次出击',
'des' => '携手印花大师Eley Kishimot'
),
array(
'href' => '',
'src' => $imgsrc,
'name' => 'Vans联乘再次出击',
'des' => '携手印花大师Eley Kishimot'
),
array(
'href' => '',
'src' => $imgsrc,
'name' => 'Vans联乘再次出击',
'des' => '携手印花大师Eley Kishimot'
),
array(
'href' => '',
'src' => $imgsrc,
'name' => 'Vans联乘再次出击',
'des' => '携手印花大师Eley Kishimot'
)
)
)
)
)
);
$this->_view->display('index', $data);
}
/**
* 品牌列表
*/
public function listAction()
{
$headerdata = array(
'gobytype' => 'gobuyboys',
'searchcate' => 'searchcateboys',
'navbars' => array(
array(
'name_cn' => '男生',
'name_en' => 'BOYS',
'link' => '',
'classname' => 'boys',
'index_main' => 0,
'subnav' => array(
array(
'name' => '男首1',
'link' => '',
'index_sub' => 0,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '男首2',
'link' => '',
'index_sub' => 1,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '男首3',
'link' => '',
'index_sub' => 2,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
)
)
),
array(
'name_cn' => '女生',
'name_en' => 'GIRLS',
'link' => 'http=>//www.baidu.com',
'classname' => '',
'index_main' => 0,
'subnav' => array(
array(
'name' => '女生1',
'link' => '',
'index_sub' => 0,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '女生2',
'link' => '',
'index_sub' => 1,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '女生3',
'link' => '',
'index_sub' => 2,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
)
)
)
),
'myyoho' => array(
'email' => 'hhh@126.com',
'viptype' => '普通会员',
'currentscore' => 495,
'totalscore' => 600,
'cardtype' => '银卡',
'infolist' => array(
array(
'name' => '待处理的订单',
'link' => '',
'num' => '0'
),
array(
'name' => '我的收藏',
'link' => '',
'num' => '1'
),
array(
'name' => '我的优惠券',
'link' => '',
'num' => '2'
),
array(
'name' => '我的YOHO币',
'link' => '',
'num' => '1'
),
array(
'name' => '我的退货换货',
'link' => '',
'num' => '1'
)
),
'updlink' => ''
),
'gobuy' => array(
'gobuynum' => 3
),
'breadcrumbnav' => array(
array(
'notend' => array(
'link' => 'http=>//www.baidu.com',
'name' => 'BOYS首页'
)
),
array(
'notend' => array(
'link' => 'http=>//www.baidu.com',
'name' => '上衣'
)
),
array(
'isend' => array(
'link' => 'http=>//www.baidu.com',
'name' => '衬衫'
)
)
)
);
$imgsrc = 'http://img11.static.yhbimg.com/goodsimg/2015/10/19/10/01b312c3b7a7efebcd671e73495ff3e306.jpg';
$item1 = array(
'name' => '所有品牌',
'src' => $imgsrc,
'url' => ''
);
$item2 = array(
'name' => '所有品牌',
'src' => $imgsrc,
'url' => '',
'name' => 'Millefed',
'desc' => ' I.T于2006年冬季在香港推出最新品牌创始 人Shawn Stussy将滑板服、工作服、旧校 服的设计加入到 '
);
$data = array(
'brandsHomePage' => true,
'headerdata' => $headerdata,
'brands' => array(
'tabs' => array(
$item1,
$item1,
$item1,
$item1,
$item1
),
'items' => array(
$item2,
$item2,
$item2,
$item2,
$item2,
$item2,
$item2,
$item2
)
)
);
$this->_view->display('list', $data);
}
}
... ...
<?php
namespace Guang;
use LibModels\Web\Guang\PlusstarData;
use WebPlugin\Images;
use WebPlugin\Cache;
use Configs\WebCacheConfig;
class PlusstarModel
{
/**
* 获取Plustar列表
*
* @param string $brandType
* @param string $gender
* @param int $isRecommend
* @return array
*/
public static function getPlustarList($brandType, $gender, $isRecommend = 0)
{
$key = WebCacheConfig::KEY_WEB_GUANG_PLUSSTAR_DATA.'_'.$brandType.'_'.$isRecommend;
$data = Cache::get($key);
if(empty($data)) {
$list = PlusstarData::getList($brandType, $gender, $isRecommend);;
$brandList = $brandIds = array();
if(isset($list['data']['data']['list'])) {
$brandList = current($list['data']['data']['list']);
}
if(isset($brandList['data'])) {
foreach ($brandList['data'] as $brand) {
$pos = 0;
if(isset($brand['data'][0])) {
$src = Images::getImageUrl($brand['data'][0]['src'], 320, 160, 1);
}
$brandIds[] = $brand['brand_id'];
$data[$brand['brand_id']] = array(
'brand_id' => $brand['brand_id'],
'name'=> $brand['brand_name'],
'sort_id' => $brand['sort_id'],
'src' => $src,
'desc' =>'',
'url'=> '',
);
}
}
Cache::set($key, $data, 600);
}
return $data;
}
}
?>
\ No newline at end of file
... ...
... ... @@ -10,6 +10,7 @@ use Product\SearchModel;
use WebPlugin\Helpers;
use Plugin\Images;
use LibModels\Web\Product\SearchData;
use LibModels\Web\Home\IndexData;
/**
* 品牌首页模板数据模型
... ... @@ -24,7 +25,10 @@ class BrandsModel
const GIRLS_BRAND_CODE = 'c95ae9e40f0add10549b819f821ad626';
const KIDS_BRAND_CODE = '84b7926282fdef92f1039bdcf77c18ba';
const LIFESTYLE_BRAND_CODE = 'c575c6bfdfa4125fae7d24bbec7119c8';
const BRAND_LIST_CODE = 'f0f72b1e8f30e6ad086dfc4401f3a856';//品牌列表资源位CODE码
const URL_PRODUCT_BRAND = '/cmsproduct/service/v1/brands';
/**
* 搜索品牌数据
* @param $condition array 搜索数据的条件
... ... @@ -262,7 +266,6 @@ class BrandsModel
/*
* 获取品牌一览资源位&channelType
*/
public static function switchBrandParams($channelStr = 'boys')
{
$res = array('channelType' => 1, 'brandCode' => self::BOYS_BRAND_CODE);
... ... @@ -290,5 +293,55 @@ class BrandsModel
}
return $res;
}
/**
* 多个品牌ID获取品牌信息
*
* @param array $brands
* @return array
*/
public static function getBrandInfoByIds(array $brandIds)
{
$brandsInfo = array();
foreach($brandIds as $brandId)
{
Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URL_PRODUCT_BRAND, 'getOneBrand',
array($brandId, 'id,brand_name,brand_intro,brand_domain'),
function($data)use(&$brandsInfo) {
if(isset($data['data']['id'])) {
$brandsInfo[$data['data']['id']] = $data['data'];
}
});
}
Yohobuy::yarConcurrentLoop();
return $brandsInfo;
}
/**
* 获取品牌列表项目
*
* @return array
*/
public static function getBrandListItem()
{
$items = array(
0 => array('name'=>'所有品牌','src'=>'','url'=>'http://www.yohobuy.com/brands','brandType'=> '','isRecommend'=>''),
1 => array('name'=>'设计师品牌','src'=>'','url'=>'','brandType' => 1,'isRecommend' => 0),
2 => array('name'=>'街头品牌','src'=>'','url'=>'','brandType' => 1,'isRecommend' => 1),
3 => array('name'=>'明星品牌','src'=>'','url'=>'','brandType'=> 2, 'isRecommend'=> 0),
4 => array('name'=>'个人原创','src'=>'','url'=>'','brandType'=> 3, 'isRecommend'=> 0),
);
// $resource = IndexData::getResourceData(self::BRAND_LIST_CODE, 'web');
$pos = 0;
foreach($items as $id => &$val) {
if(empty($val['url'])) {
$val['url'] = '/brands/list?id='.$id;
}
if(isset($resource[0]['data'][$pos])) {
// $val['src'] = Images::getImageUrl($resource[0]['data'][$pos]['src'], 222, 180, 1);
}
$pos++;
}
return $items;
}
}
... ...
... ... @@ -67,9 +67,9 @@ class HotrankModel
public static function getHotrankResource($data, $sid, $page)
{
//焦点图 热门品牌
// $focus = self::getFocusResource($data['channel'], $data['code']);
// $data['slide'] = $focus[0]['slide'];
// $data['hotBrands'] = $focus[1]['hotBrands'];
$focus = self::getFocusResource($data['channel'], $data['code']);
$data['slide'] = $focus[0]['slide'];
$data['hotBrands'] = $focus[1]['hotBrands'];
//人气单品 一周热卖
$sort = ($sid == 1) ? '' : $sid;
$config = array(
... ... @@ -203,6 +203,7 @@ class HotrankModel
public static function getProductList($result, $page, $ajax = 0)
{
$product = array();
$url = Helpers::url('/product/pro', '', 'item');
if (empty($result) || empty($result['data']) || empty($result['data']['product_list'])) {
return $product;
}
... ... @@ -213,36 +214,35 @@ class HotrankModel
if (empty($val['goods_list'])) {
continue;
}
$defaultGoodsId = 0;
//$defaultGoodsId = 0;
foreach ($val['goods_list'] as $v) {
if ($v['is_default'] == 'Y') {
$defaultGoodsId = $v['goods_id'];
$defaultGoodsId = empty($v['goods_id']) ? $val['goods_list'][0]['goods_id'] : $v['goods_id'];
}
}
if (empty($defaultGoodsId)) {
$defaultGoodsId = $val['goods_list'][0]['goods_id'];
}
$product_id = empty($val['product_id']) ? '' : $val['product_id'];
$product['name'] = $val['product_name'];
if ($key <= 9 && $page == 1 && $ajax == 0) {
//人气单品
$product['rank'] = $key + 1;
$product['href'] = 'http://item.yohobuy.com/product/pro_' . $product_id . '_' . $defaultGoodsId . '.html';
$product['title'] = $val['product_name'];
$product['href'] = $url . '_' . $product_id . '_' . $defaultGoodsId . '.html';
$product['price'] = (int) $val['market_price'] == (int) $val['sales_price'] ? '' : $val['market_price'];
$product['sPrice'] = empty($val['sales_price']) ? '' : $val['sales_price'];
if ($key <= 5) {
//6张大图
$product['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 378, 504, 2);
$popular['list'][] = $product;
}
else {
//4张小图
$product['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);
$popular['list'][] = $product;
}
}
else {
//一周热卖
// $product['url'] = 'http://item.yohobuy.com/product/pro_' . $product_id . '_' . $defaultGoodsId . '.html';
$product['url'] = Helpers::url('/product/pro',array('product_id' => $product_id,'defaultGoodsId'=> $defaultGoodsId),'item');
$product['name'] = $val['product_name'];
$product['url'] = $url . '_' . $product_id . '_' . $defaultGoodsId . '.html';
$product['marketPrice'] = (int) $val['market_price'] == (int) $val['sales_price'] ? '' : $val['market_price'];
$product['salePrice'] = empty($val['sales_price']) ? '' : $val['sales_price'];
$product['rank'] = '';
... ...
... ... @@ -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
... ...
<?php
<?php
use Action\WebAction;
use LibModels\Web\Product\FavoriteData;
use Product\BrandsModel;
use product\HotrankModel;
class IndexController extends WebAction
{
/**
* 品牌首页
*/
* 品牌首页
*/
public function brandAction()
{
//品牌域名,没有获取到品牌域名的跳转首页
$domain = $this->param('named');
if (empty($domain)) {
$this->go(SITE_MAIN);
}
}
//根据品牌域名获取品牌id(同时判断品牌域名是否有效),无效跳转首页
$type = 1;
$result = BrandsModel::getBrandByDomain($domain, $type);
if (!$result) {
$this->go(SITE_MAIN);
}
//获取uid
$uid = $this->getUid();
//传品牌ID参数
$condition = array();
$condition['brand'] = isset($result['brandId']) ? $result['brandId'] : '';
//品牌系列参数
$condition['folder_id'] = $this->get('folder_id');
//$options参数数组
$options = array();
$options['brandName'] = $domain;
... ... @@ -46,10 +47,10 @@ class IndexController extends WebAction
$options['reviewNum'] = 6;
$options['controller'] = 'Index';
$options['action'] = 'brand';
//调用模型获得数据
$data = BrandsModel::getBrandSearchData($condition, $options);
$data = array(
//初始化js
'searchListPage' => true,
... ... @@ -60,9 +61,9 @@ class IndexController extends WebAction
$this->setDescription('潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜');
$this->setWebNavHeader();
//渲染模板
$this->_view->display('list',$data);
$this->_view->display('list', $data);
}
//品牌介绍页
public function aboutAction()
{
... ... @@ -70,21 +71,21 @@ class IndexController extends WebAction
$domain = $this->param('named');
if (empty($domain)) {
$this->go(SITE_MAIN);
}
}
$uid = $this->getUid();
//根据品牌域名获取品牌id(同时判断品牌域名是否有效),无效跳转首页TODO
$type = 2;
$result = BrandsModel::getBrandByDomain($domain, $type);
if (!$result) {
$this->go(SITE_MAIN);
}
//品牌ID参数
$condition = array();
$condition['brand'] = isset($result['brandId']) ? $result['brandId'] : '';
//$options参数数组
$options = array();
$options['brandName'] = $domain;
... ... @@ -96,18 +97,18 @@ class IndexController extends WebAction
$options['action'] = 'brand';
//调用模型获得数据
$data = BrandsModel::getBrandIntro($condition, $options);
$data = array(
//初始化js
'searchListPage' => true,
'list' => $data
);
$this->setWebNavHeader();
//渲染模板
$this->_view->display('list',$data);
$this->_view->display('list', $data);
}
//收藏品牌
public function favoriteBrandAction()
{
... ... @@ -117,15 +118,15 @@ class IndexController extends WebAction
$result = array(
'code' => 400,
'message' => 'operation failed'
);
);
$uid = $this->getUid();
$brandId = $this->post('brandId');
do{
do {
if (!$uid) {
$result = array(
'code' => 403,
'message' => 'uid is null'
);
);
break;
}
if ($uid && $brandId) {
... ... @@ -133,46 +134,49 @@ class IndexController extends WebAction
$result = FavoriteData::changeFavoriteBrand($uid, $brandId);
break;
}
}while(false);
}
while (false);
$this->echoJson($result);
}
/**
/**
* 热销排行
*/
public function hotrankAction()
public function hotrankAction()
{
//获取频道
$channel = HotrankModel::getChannelResource();
$this->setWebNavHeader($channel['channel']);
$page = $this->get('page',1);
$sort = $this->get('sid',1);
$data = array( 'hotrankPage' => true,
'footerTop'=> true,
'hotrank' => HotrankModel::getHotrankResource($channel, $sort, $page)
);
$this->_view->display('hotrank', $data);
$page = $this->get('page', 1);
$sort = $this->get('sid', 1);
$data = array('hotrankPage' => true,
'footerTop' => true,
'hotrank' => HotrankModel::getHotrankResource($channel, $sort, $page)
);
$this->_view->display('hotrank', $data);
}
/*
* 一周热卖加载更多
*/
public function getdataAction()
{
$page = $this->get('page',1);
$page = $this->get('page', 1);
//加载到100个以后停止
if($page > 2)
{
echo json_encode(array('code'=>201,'data'=>''));
if ($page > 2) {
echo json_encode(array('code' => 201, 'data' => ''));
exit;
}
$sid = $this->get('sid',1);
$sid = $this->get('sid', 1);
//获取频道资源
$channel = HotrankModel::getChannelResource();
//获取一周热卖资源
$data = HotrankModel::getListData($channel, $sid, $page);
$data = HotrankModel::getListData($channel, $sid, $page);
echo json_encode($data);
exit;
exit;
}
}
\ 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
... ...