Authored by whb

人气单品修改,模版中的url改为href,名称统一

... ... @@ -791,12 +791,7 @@ class Process
$oneGoods['img'] = Images::getImageUrl($goods['goods_list'][0]['images_url'], 280, 373, 1);
$oneGoods['name'] = $goods['product_name'];
$oneGoods['price'] = $goods['sales_price'];
/*
* if($pos < 4) {
* $oneGoods['tip'] = 'TOP'.$pos;
* }
*/
$url = 'http://item.yohobuy.com/`/product/pro_' .
$url = 'http://item.yohobuy.com/product/pro_' .
$goods['product_id'] . '_' . $goods['goods_list'][0]['goods_id']
. '/' . $goods['cn_alphabet'] . '.html';
$oneGoods['href'] = Helpers::transUrl($url, $type);
... ... @@ -807,7 +802,18 @@ class Process
uksort($result, function ($a, $b) use($skns) {
$skn_arr = explode(' ', $skns);
return array_search($a, $skn_arr) > array_search($b, $skn_arr);
});
});
$pos = 1;
//添加TOP标示
foreach($result as &$val) {
if($pos < 4) {
$val['tip'] = 'TOP'.$pos;
}
else {
break;
}
$pos ++;
}
return $result;
}
... ...
... ... @@ -2,7 +2,7 @@
{{> index/floor-header}}
<ul class="g-list">
{{#each imgHot}}
<li><a class="impo{{@index}}" href="{{url}}"><img class="lazy" data-original="{{img}}"/></a></li>
<li><a class="impo{{@index}}" href="{{href}}"><img class="lazy" data-original="{{img}}"/></a></li>
{{/each}}
</ul>
</div>
... ...
... ... @@ -4,7 +4,7 @@
<ul class="g-list clearfix">
{{#each imgHot}}
<li>
<a href="{{url}}"><div class="commodity-img">
<a href="{{href}}"><div class="commodity-img">
{{# tip}}
<i class="top">{{.}}</i>
{{/ tip}}
... ... @@ -18,7 +18,7 @@
</div>
<div class="commodity-brands clearfix">
{{#each brands}}
<a href="{{url}}" title="{{name}}"><img class="lazy" data-original="{{img}}"/></a>
<a href="{{href}}" title="{{name}}"><img class="lazy" data-original="{{img}}"/></a>
{{/each}}
</div>
</div>
... ...
... ... @@ -1944,8 +1944,6 @@ exports.init = function(num) {
productList.addHandler('MouseEnter', function(event) {
var itemMr = 10, //list的右边距
itemMb = 35, //list的下边距
ulStr = '',
... ... @@ -1958,11 +1956,6 @@ exports.init = function(num) {
wrapperPt, //鼠标移入时弹层的上内边距
containerPt; //商品列表容器的上内边距
$goodInfoMain.html('');
$goodSelectColor.html('');
$goodItemWrapper.css({
display: 'none'
});
$.ajax({
type: 'POST',
url: '/product/list/getProductPic',
... ... @@ -1972,6 +1965,11 @@ exports.init = function(num) {
}
}).then(function(data) {
//setTimeout(function () {
removeHtmlFn();
ulStr = createColorList(data).colorListStr; //ajax请求的颜色列表
ulNum = createColorList(data).ulNum;//ajax请求的颜色的数量
... ... @@ -1982,8 +1980,9 @@ exports.init = function(num) {
wrapperPt = $goodItemWrapper.css('paddingTop');
containerPt = $goodsContainer.css('paddingTop');
//wrapperWidth = 10 + (15 + 50) * ulNum + event.targetWidth;
wrapperWidth = $goodItemWrapper.width();
wrapperWidth = 10 + (15 + 50) * ulNum + event.targetWidth;
//wrapperWidth = $goodItemWrapper.width();
wrapperX = (event.targetX - 1) * (event.targetWidth + itemMr) - (parseInt(wrapperPl) + 1);
wrapperY = (event.targetY - 1) *
... ... @@ -2003,16 +2002,21 @@ exports.init = function(num) {
display: 'inline-block'
});
//}, 1000);
});
});
$goodItemWrapper.mouseleave(function() {
removeHtmlFn();
});
function removeHtmlFn() {
$goodInfoMain.html('');
$goodSelectColor.html('');
$goodItemWrapper.css({
display: 'none'
});
});
}
};
//鼠标放在颜色列表上效果
... ... @@ -2700,8 +2704,8 @@ if ($.inArray(homePage, ['boys','girls','kids','lifestyle']) > -1) {
require("js/common/new-arrivls")({
type: homePage,
url: '/common/getNewArrival',
firstCount: homePage === ('boys' || 'lifestyle') ? '25' : '20',
pageCount: homePage === ('boys' || 'lifestyle') ? '15' : '12'
count: (homePage === 'boys') || (homePage === 'lifestyle') ? 5 : 4,
rows: [5,3]
});
window.setCookie('_Channel', homePage, {
domain: '.yohobuy.com',
... ... @@ -3706,7 +3710,7 @@ InfiniteLoad.prototype.stop = function() {
InfiniteLoad.prototype.__directionCalculation = function() {
var p = this.options;
if (p.offset.height && p.offset.height() > 0 && $(window).scrollTop() + $(window).height() >= p.offset.height()) {
if (p.offset.height && p.offset.height() > 0 && $(window).scrollTop() + window.innerHeight >= p.offset.height()) {
return true;
}
return false;
... ... @@ -3716,40 +3720,32 @@ module.exports = function(data) {
var $container = $('#newarrivals .goods-container');
var $load = $('.loading a');
var load = new InfiniteLoad({
index: 1,
offset: {
height: function() {
return parseFloat($container.offset().top) + parseFloat($container.height()) - 200;
}
}
});
var options;
var loadAjax;
var url = data.url;
var firstCount = data.firstCount;
var pageCount = data.pageCount;
delete data.url;
delete data.firstCount;
delete data.pageCount;
load.on('after', function(p) {
data = $.extend({}, data, {
pageIndex: p.index
});
data.pageCount = (data.pageIndex === 1) ? firstCount : pageCount;
options = {
loadAjax = function(url, data, count) {
var options = {
type: 'POST',
url: url,
data: data,
success: function(data) {
var code = data.code;
var myTemplate;
var myTemplate,len,pos;
if (code === 200) {
len = data.goods.length % count;
pos = data.goods.length - len - 1;
data.goods.splice(pos, len);
myTemplate = Handlebars.compile(load.tpl);
... ... @@ -3773,23 +3769,22 @@ module.exports = function(data) {
};
$.ajax(options);
};
load.on('after', function(p) {
data = $.extend({}, data, {
pageIndex: p.index
});
data.pageCount = data.count * data.rows[1];
loadAjax(url, data);
});
load.on('before', function() {
load.on('before', function(p) {
//请求模板
// load.tpl = '{{#each this}}';
// load.tpl += '<li>';
// load.tpl += ' <a href="{{url}}"><div class="commodity-img">';
// load.tpl += ' {{# tip}}';
// load.tpl += ' <i class="commodity-tag">{{.}}</i>';
// load.tpl += ' {{/ tip}}';
// load.tpl += ' <img class="lazy" data-original="{{img}}" src="{{img}}"/></div>';
// load.tpl += ' <p class="commodity-name">{{name}}</p>';
// load.tpl += ' <p class="commodity-price"><span>¥{{price}}</span></p>';
// load.tpl += ' </a>';
// load.tpl += '</li>';
// load.tpl += '{{/each}}';
load.tpl = '{{#each this}}';
load.tpl += '<div class="good-info" data-skn="{{skn}}">';
... ... @@ -3844,6 +3839,14 @@ module.exports = function(data) {
load.tpl += '</div>';
load.tpl += '{{/each}}';
data = $.extend({}, data, {
pageIndex: p.index
});
data.pageCount = data.count * data.rows[0];
loadAjax(url, data, data.count);
load.emit();
});
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
... ... @@ -14,9 +14,7 @@ class LifestyleController extends WebAction
$data = array(
'boysHomePage' => true,
'lifestyle' => HomeModel::getChannelResource(HomeModel::COOKIE_NAME_LIFESTYLE, HomeModel::CODE_LIFESTYLE_CHANNEL)
)
// HomeModel::getLifestyleChannel(),
;
);
$this->_view->display('index', $data);
}
}
\ No newline at end of file
... ...