Authored by 郭成尧

filter-loading

... ... @@ -6,7 +6,8 @@ import {
const ProductListWithFilter = require('product/list/product-list-with-filter');
const lazyLoad = require('yoho-jquery-lazyload');
let productListWithFilter = new ProductListWithFilter({
new ProductListWithFilter({
page: 2,
material: true,
unionType: window.queryString.union_type
... ... @@ -15,7 +16,8 @@ let productListWithFilter = new ProductListWithFilter({
class MaterialController extends Controller {
constructor() {
super();
productListWithFilter.getFilter();
// productListWithFilter.getFilter();
lazyLoad($('img.lazy'));
}
}
... ...
... ... @@ -14,4 +14,4 @@ require('common/footer');
new ProductListWithFilter({
query: $.trim($('.nav-title').text()),
page: 2, // 首页服务端已经渲染
}, 'product/search/chanpin/goods').getFilter();
}, 'product/search/chanpin/goods');
... ...
... ... @@ -12,6 +12,7 @@ const filter = require('plugin/filter');
const noResultHbs = require('product/search/no-result-new.hbs');
const lazyLoad = require('yoho-jquery-lazyload');
const cacheStore = require('./cache-store');
const loading = require('plugin/loading');
class ProductListWithFilter {
constructor(filterParams, searchUrl, extra) {
... ... @@ -248,6 +249,9 @@ class ProductListWithFilter {
}
});
loading.hideLoading();
filter.showFilter();
this.view.filterBody = $('.filter-body');
}
});
... ... @@ -317,7 +321,13 @@ class ProductListWithFilter {
this.view.pre.removeClass('active');
$this.addClass('active');
filter.showFilter();
if ($('.filter-body').length < 1) {
loading.init($('.yoho-page'));
loading.showLoading();
this.getFilter();
} else {
filter.showFilter();
}
}
} else { // 排序改变
this.view.dropList.css('display', 'none');
... ...
... ... @@ -746,7 +746,10 @@ if ($brandHeader.data('isbaseshop') === true) {
Object.assign(defaultOpt, {shop_id: $brandHeader.data('id')});
}
(function() {
/**
* 获取筛选面板数据
*/
function getFilter() {
let pars = {};
if (age_level) {
... ... @@ -862,10 +865,11 @@ if ($brandHeader.data('isbaseshop') === true) {
$pre.siblings('.filter').removeClass('active');
}
});
loading.hideLoading();
filter.showFilter();
}
});
}());
}
lazyLoad($('.lazy'));
... ... @@ -963,6 +967,9 @@ $dropList.on('touchend', 'li', function(e) {
$dropList.addClass('hide');
});
/**
* 顶部排序等点击事件处理
*/
$listNav.on('touchend touchcancel', function(e) {
let $this = $(e.target).closest('li'),
nav,
... ... @@ -993,7 +1000,13 @@ $listNav.on('touchend touchcancel', function(e) {
$pre.removeClass('active');
$this.addClass('active');
filter.showFilter();
if ($('.filter-body').length < 1) {
loading.init($('.yoho-page'));
loading.showLoading();
getFilter();
} else {
filter.showFilter();
}
}
} else {
... ... @@ -1231,6 +1244,11 @@ $('.more-shop').on('click', function() {
}
});
// 筛选改为点击加载
// (function() {
// getFilter();
// }());
// 进入店铺埋点
$('.brand-way a').on('click', function() {
if (window._yas && window._yas.sendCustomInfo) {
... ...
... ... @@ -3,11 +3,10 @@ let ProductListWithFilter = require('product/list/product-list-with-filter');
const brandId = $('#brandId').val();
let productListWithFilterModel =
new ProductListWithFilter({
brand_id: brandId,
page: 2, // 首页服务端已经渲染
isShopBrand: 'Y' // 传给 filter,表明调用哪个接口获取筛选面板的数据
}, 'product/search/brand/goods');
new ProductListWithFilter({
brand_id: brandId,
page: 2, // 首页服务端已经渲染
isShopBrand: 'Y' // 传给 filter,表明调用哪个接口获取筛选面板的数据
}, 'product/search/brand/goods');
productListWithFilterModel.getFilter();
// productListWithFilterModel.getFilter();
... ...
... ... @@ -10,14 +10,13 @@ const $collectShopIcon = $('#collectShop');
const shopId = $('#shopId').val();
const productListWithFilterModel =
new ProductListWithFilter({
shop_id: shopId,
page: 2, // 首页服务端已经渲染
isShopList: 'Y' // 传给 filter,表明调用哪个接口获取筛选面板的数据
}, 'product/search/shop/goods');
new ProductListWithFilter({
shop_id: shopId,
page: 2, // 首页服务端已经渲染
isShopList: 'Y' // 传给 filter,表明调用哪个接口获取筛选面板的数据
}, 'product/search/shop/goods');
productListWithFilterModel.getFilter();
// productListWithFilterModel.getFilter();
require('./shop/coupon');
... ...
... ... @@ -51,7 +51,7 @@ if ($shopCategory.length > 0) {
// 页面打开直接加载筛选项
productListWithFilter.getFilter();
// productListWithFilter.getFilter();
require('../plugin/sticky');
require('./shop/coupon');
... ...
... ... @@ -5,3 +5,4 @@
@import "search";
@import "list";
@import "search-index";
@import "layout/loading";
... ...