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
黄庭坚
jinfa-platform
Commits
680e09e8
Commit
680e09e8
authored
Dec 01, 2020
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:商品类型筛选问题
parent
b9e486a5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
19 deletions
+19
-19
index.tsx
...es/lxMall/components/Filter/components/Category/index.tsx
+14
-14
index.tsx
...Mall/components/Filter/components/CommodityType/index.tsx
+4
-4
index.ts
src/store/filter/index.ts
+1
-1
No files found.
src/pages/lxMall/components/Filter/components/Category/index.tsx
View file @
680e09e8
...
...
@@ -34,9 +34,9 @@ const Category: React.FC<CategoryPropsType> = (props) => {
setLastCategoryId
(
null
)
setSelectAttrbuteList
([])
}
else
{
le
t
initKeys
=
[]
cons
t
initKeys
=
[]
// let initAttrKeys = []
for
(
le
t
item
of
filterList
)
{
for
(
cons
t
item
of
filterList
)
{
if
(
item
.
type
===
FILTER_TYPE
.
category
)
{
initKeys
.
push
(
String
(
item
.
key
))
}
...
...
@@ -50,7 +50,7 @@ const Category: React.FC<CategoryPropsType> = (props) => {
useEffect
(()
=>
{
let
getCategoryListFn
le
t
param
:
any
=
{}
cons
t
param
:
any
=
{}
let
headers
=
{}
/**
* 根据不通过的页面类型,请求不同的品类接口
...
...
@@ -105,7 +105,7 @@ const Category: React.FC<CategoryPropsType> = (props) => {
useEffect
(()
=>
{
if
(
lastCategoryId
)
{
le
t
param
:
any
=
{
cons
t
param
:
any
=
{
categoryId
:
lastCategoryId
}
let
getAttributeFn
...
...
@@ -160,8 +160,8 @@ const Category: React.FC<CategoryPropsType> = (props) => {
if
(
!
list
)
{
return
[]
}
le
t
initExpandKeys
=
[]
le
t
result
:
any
=
list
.
map
(
item
=>
{
cons
t
initExpandKeys
=
[]
cons
t
result
:
any
=
list
.
map
(
item
=>
{
initExpandKeys
.
push
(
item
.
id
)
return
{
title
:
item
.
title
,
...
...
@@ -200,7 +200,7 @@ const Category: React.FC<CategoryPropsType> = (props) => {
setAttributeList
([])
onFilter
({
type
:
FILTER_TYPE
.
attribute
,
key
:
[]
,
key
:
null
,
title
:
``
})
}
...
...
@@ -217,12 +217,12 @@ const Category: React.FC<CategoryPropsType> = (props) => {
const
getDetailById
=
(
attrId
,
attrValId
,
state
=
2
)
=>
{
let
detail
=
{}
for
(
le
t
item
of
attributeList
)
{
for
(
cons
t
item
of
attributeList
)
{
if
(
item
.
id
===
attrId
)
{
if
(
state
===
1
)
{
detail
=
item
}
else
{
for
(
le
t
childItem
of
item
.
attributeValueList
)
{
for
(
cons
t
childItem
of
item
.
attributeValueList
)
{
if
(
childItem
.
value
===
attrValId
)
{
detail
=
childItem
}
...
...
@@ -235,7 +235,7 @@ const Category: React.FC<CategoryPropsType> = (props) => {
const
getSelectAttributeList
=
(
selectList
)
=>
{
let
ids
=
[]
for
(
le
t
item
of
selectList
)
{
for
(
cons
t
item
of
selectList
)
{
ids
=
[...
ids
,
...
item
.
customerAttributeValueList
.
map
(
childItem
=>
childItem
.
id
)]
}
return
ids
...
...
@@ -243,12 +243,12 @@ const Category: React.FC<CategoryPropsType> = (props) => {
const
handleChange
=
(
attrId
,
checkedList
)
=>
{
let
tempSelect
=
[...
initSelectAttributeList
]
le
t
attrInfo
:
any
=
getDetailById
(
attrId
,
attrId
,
1
)
le
t
tempItem
=
{
cons
t
attrInfo
:
any
=
getDetailById
(
attrId
,
attrId
,
1
)
cons
t
tempItem
=
{
customerAttributeId
:
attrId
,
customerAttributeName
:
attrInfo
.
name
,
customerAttributeValueList
:
checkedList
.
map
(
item
=>
{
le
t
detail
:
any
=
getDetailById
(
attrId
,
item
)
cons
t
detail
:
any
=
getDetailById
(
attrId
,
item
)
return
{
id
:
detail
.
value
,
name
:
detail
.
label
...
...
@@ -268,7 +268,7 @@ const Category: React.FC<CategoryPropsType> = (props) => {
tempSelect
.
push
(
tempItem
)
}
le
t
keys
=
getSelectAttributeList
(
tempSelect
)
cons
t
keys
=
getSelectAttributeList
(
tempSelect
)
setSelectAttrbuteList
(
keys
)
tempSelect
=
tempSelect
.
filter
(
item
=>
item
.
customerAttributeValueList
.
length
>
0
)
onFilter
({
...
...
src/pages/lxMall/components/Filter/components/CommodityType/index.tsx
View file @
680e09e8
...
...
@@ -27,8 +27,8 @@ const CommodityType: React.FC<CommodityTypePropsType> = (props) => {
if
(
isEmpty
(
filterList
))
{
setSelectKeys
([])
}
else
{
le
t
initKeys
=
[]
for
(
le
t
item
of
filterList
)
{
cons
t
initKeys
=
[]
for
(
cons
t
item
of
filterList
)
{
if
(
item
.
type
===
FILTER_TYPE
.
commodityType
)
{
initKeys
.
push
(
Number
(
item
.
key
))
}
...
...
@@ -54,7 +54,7 @@ const CommodityType: React.FC<CommodityTypePropsType> = (props) => {
}
else
{
onFilter
({
type
:
FILTER_TYPE
.
commodityType
,
key
:
[]
,
key
:
false
,
title
:
''
})
}
...
...
@@ -62,7 +62,7 @@ const CommodityType: React.FC<CommodityTypePropsType> = (props) => {
const
getItemText
=
(
key
:
number
)
=>
{
let
result
=
""
for
(
le
t
item
of
styleOptions
)
{
for
(
cons
t
item
of
styleOptions
)
{
if
(
item
.
value
===
key
)
{
result
=
item
.
label
}
...
...
src/store/filter/index.ts
View file @
680e09e8
...
...
@@ -3,7 +3,7 @@ import { PublicApi } from '@/services/api'
import
{
FILTER_TYPE
}
from
'@/constants'
interface
FilterValueType
{
key
:
string
|
string
[]
|
number
;
key
:
any
;
title
:
string
;
type
:
FILTER_TYPE
;
}
...
...
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