Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenshaokai
jinfa-platform
Commits
4e2f64ec
Commit
4e2f64ec
authored
Dec 03, 2020
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:店铺商品品类筛选问题
parent
e6bb8559
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
11 deletions
+35
-11
index.ts
src/constants/index.ts
+0
-0
index.tsx
...es/lxMall/components/Filter/components/Category/index.tsx
+28
-11
index.ts
src/store/filter/index.ts
+7
-0
No files found.
src/constants/index.ts
View file @
4e2f64ec
This diff is collapsed.
Click to expand it.
src/pages/lxMall/components/Filter/components/Category/index.tsx
View file @
4e2f64ec
...
...
@@ -6,6 +6,7 @@ import { LAYOUT_TYPE, FILTER_TYPE } from '@/constants'
import
{
PublicApi
}
from
'@/services/api'
import
isEmpty
from
'lodash/isEmpty'
import
styles
from
'./index.less'
import
{
Layout
}
from
'@formily/antd'
const
CheckboxGroup
=
Checkbox
.
Group
...
...
@@ -29,6 +30,7 @@ const Category: React.FC<CategoryPropsType> = (props) => {
const
[
initSelectAttributeList
,
setInitSelectAttributeList
]
=
useState
<
any
>
([])
useEffect
(()
=>
{
console
.
log
(
JSON
.
stringify
(
filterList
))
if
(
isEmpty
(
filterList
))
{
setSelectedKeys
([])
setLastCategoryId
(
null
)
...
...
@@ -39,6 +41,8 @@ const Category: React.FC<CategoryPropsType> = (props) => {
for
(
const
item
of
filterList
)
{
if
(
item
.
type
===
FILTER_TYPE
.
category
)
{
initKeys
.
push
(
String
(
item
.
key
))
}
else
if
(
item
.
type
===
FILTER_TYPE
.
customerCategory
)
{
initKeys
.
push
(
String
(
item
.
key
))
}
if
(
item
.
type
===
FILTER_TYPE
.
attribute
)
{
setInitSelectAttributeList
(
item
.
key
)
...
...
@@ -186,7 +190,6 @@ const Category: React.FC<CategoryPropsType> = (props) => {
}
const
handleSelect
=
(
selectedKeys
,
info
)
=>
{
console
.
log
(
info
)
const
{
title
,
children
,
name
}
=
info
.
node
setSelectedKeys
(
selectedKeys
)
if
(
children
.
length
===
0
)
{
...
...
@@ -196,17 +199,31 @@ const Category: React.FC<CategoryPropsType> = (props) => {
}
else
{
setLastCategoryId
(
null
)
setAttributeList
([])
onFilter
({
type
:
FILTER_TYPE
.
attribute
,
key
:
null
,
title
:
``
})
if
(
filterList
.
some
(
item
=>
item
.
type
===
FILTER_TYPE
.
attribute
))
{
onFilter
({
type
:
FILTER_TYPE
.
attribute
,
key
:
null
,
title
:
``
})
}
}
onFilter
({
type
:
FILTER_TYPE
.
category
,
key
:
selectedKeys
,
title
:
typeof
title
===
'string'
?
title
:
name
})
switch
(
layoutType
)
{
case
LAYOUT_TYPE
.
mall
:
onFilter
({
type
:
FILTER_TYPE
.
category
,
key
:
selectedKeys
,
title
:
typeof
title
===
'string'
?
title
:
name
})
break
default
:
onFilter
({
type
:
FILTER_TYPE
.
customerCategory
,
key
:
selectedKeys
,
title
:
typeof
title
===
'string'
?
title
:
name
})
break
}
}
const
handleExpand
=
(
expandedKeys
)
=>
{
...
...
src/store/filter/index.ts
View file @
4e2f64ec
...
...
@@ -138,6 +138,9 @@ class FilterStore {
case
FILTER_TYPE
.
category
:
tempFilterParam
.
categoryId
=
Number
(
filterItem
.
key
[
0
])
break
case
FILTER_TYPE
.
customerCategory
:
tempFilterParam
.
customerCategoryId
=
Number
(
filterItem
.
key
[
0
])
break
case
FILTER_TYPE
.
commodityType
:
tempFilterParam
.
priceTypeList
=
[
filterItem
.
key
]
break
...
...
@@ -202,6 +205,10 @@ class FilterStore {
tempFilterParam
.
customerCategoryId
=
filterItem
.
key
[
0
]
tempFilterParam
.
customerCategoryName
=
filterItem
.
title
break
case
FILTER_TYPE
.
customerCategory
:
tempFilterParam
.
customerCategoryId
=
filterItem
.
key
[
0
]
tempFilterParam
.
customerCategoryName
=
filterItem
.
title
break
case
FILTER_TYPE
.
brand
:
tempFilterParam
.
brandId
=
filterItem
.
key
tempFilterParam
.
brandName
=
filterItem
.
title
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment