Authored by weiqingting

bug解决

... ... @@ -105,20 +105,21 @@ module.exports = function(data) {
delete data.url;
var loadAjax=function(url,data,count){
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) {
var len = data.goods.length%count;
var pos = data.goods.length-len-1;
data.goods.splice(pos,len);
len = data.goods.length % count;
pos = data.goods.length - len - 1;
data.goods.splice(pos, len);
myTemplate = Handlebars.compile(load.tpl);
$container.append(myTemplate(data.goods));
... ... @@ -141,18 +142,18 @@ 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);
data.pageCount = data.count * data.rows[1];
loadAjax(url, data);
});
load.on('before', function(p) {
... ... @@ -214,11 +215,11 @@ module.exports = function(data) {
data = $.extend({}, data, {
pageIndex: p.index
});
data.pageCount = data.count*data.rows[0];
loadAjax(url,data,data.count);
data.pageCount = data.count * data.rows[0];
loadAjax(url, data, data.count);
load.emit();
});
... ...
... ... @@ -24,8 +24,8 @@ if ($.inArray(homePage, ['boys','girls','kids','lifestyle']) > -1) {
require('../common/new-arrivls')({
type: homePage,
url: '/common/getNewArrival',
count:(homePage === 'boys') || (homePage === 'lifestyle') ? 5 : 4,
rows:[5,3]
count: (homePage === 'boys') || (homePage === 'lifestyle') ? 5 : 4,
rows: [5,3]
});
window.setCookie('_Channel', homePage, {
domain: '.yohobuy.com',
... ...