Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuywap-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
毕凯
7 years ago
Commit
64321f2d6cfb998c191cf3f06d9323b8216676d5
2 parents
ea9d6365
9964044f
Merge branch 'hotfix/cartfilter' into 'feature/qps'
筛选加载策略 See merge request
!1020
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
52 additions
and
23 deletions
public/js/3party/material-new/controller.js
public/js/product/chanpin.page.js
public/js/product/list/product-list-with-filter.js
public/js/product/search/list.js
public/js/product/shop-brand.page.js
public/js/product/shop-list.page.js
public/js/product/shop-reds.page.js
public/scss/product/search/list.page.css
public/js/3party/material-new/controller.js
View file @
64321f2
...
...
@@ -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'
));
}
}
...
...
public/js/product/chanpin.page.js
View file @
64321f2
...
...
@@ -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'
);
...
...
public/js/product/list/product-list-with-filter.js
View file @
64321f2
...
...
@@ -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'
);
...
...
public/js/product/search/list.js
View file @
64321f2
...
...
@@ -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
)
{
...
...
public/js/product/shop-brand.page.js
View file @
64321f2
...
...
@@ -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();
...
...
public/js/product/shop-list.page.js
View file @
64321f2
...
...
@@ -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'
);
...
...
public/js/product/shop-reds.page.js
View file @
64321f2
...
...
@@ -51,7 +51,7 @@ if ($shopCategory.length > 0) {
// 页面打开直接加载筛选项
productListWithFilter
.
getFilter
();
//
productListWithFilter.getFilter();
require
(
'../plugin/sticky'
);
require
(
'./shop/coupon'
);
...
...
public/scss/product/search/list.page.css
View file @
64321f2
...
...
@@ -5,3 +5,4 @@
@import
"search"
;
@import
"list"
;
@import
"search-index"
;
@import
"layout/loading"
;
...
...
Please
register
or
login
to post a comment