search-list.page.js 1.02 KB
/**
 * 搜索商品列表页
 */
import 'scss/product/search/list.page.scss';
import Page from 'js/yoho-page';
import noResultHbs from 'hbs/product/search/no-result-new.hbs';
import ProductListWithFilter from './list/product-list-with-filter';
import qs from 'yoho-qs';
import SearchListExtra from './search/search-list-extra';
import 'js/common/footer';

class Search extends Page {
    constructor() {
        super();

        this.selector = {
            goodsContainer: $('#goods-container'),
            defaultGoods: $('.default-goods')
        };

        this.firstScreen = this.selector.defaultGoods.children().size() > 0;
        if (!this.firstScreen) {
            this.selector.goodsContainer.html(noResultHbs());
        }

        let initParams = {
            page: 2
        };

        if (qs) {
            $.extend(initParams, qs);
        }

        new ProductListWithFilter(initParams, null, {
            scrollActived: this.firstScreen
        });

        new SearchListExtra();
    }
}

export default new Search();