Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-admin
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-admin
Commits
b28dc3cb
Commit
b28dc3cb
authored
Sep 28, 2021
by
Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改品类导航页排序
parent
2a6f9951
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
6 deletions
+19
-6
useGetLayout.tsx
...stomized/categoryNavigation/common/hooks/useGetLayout.tsx
+11
-3
index.tsx
...mized/categoryNavigation/components/Layout/Tabs/index.tsx
+4
-0
index.tsx
src/pages/pageCustomized/categoryNavigation/index.tsx
+4
-3
No files found.
src/pages/pageCustomized/categoryNavigation/common/hooks/useGetLayout.tsx
View file @
b28dc3cb
...
...
@@ -54,10 +54,18 @@ function useGetLayout() {
const
configKey
=
startKey
+
_index
;
dataFromRequest
[
_item
.
id
]
=
_item
;
tabKeys
.
push
(
configKey
.
toString
());
// const children = Object.keys(_item.children);
// console.log(children);
const
children
=
[
'secondary'
,
'flashSale'
,
'saleRanking'
,
'brand'
,
'suggestProduct'
];
/** [{ name: 'secondary', sort: 1 }] */
const
withSortedChildren
=
Object
.
keys
(
_item
.
children
).
map
((
_typeName
:
string
)
=>
{
const
{
sort
}
=
_item
.
children
[
_typeName
];
return
{
name
:
_typeName
,
sort
:
sort
,
};
});
// const children = ['secondary', 'flashSale', 'saleRanking', 'brand', 'suggestProduct'];
const
children
=
withSortedChildren
.
sort
((
a
,
b
)
=>
a
.
sort
-
b
.
sort
).
map
((
_sortItem
)
=>
_sortItem
.
name
);
const
tabConfig
:
any
=
{
componentName
:
tabName
,
title
:
_item
.
name
,
...
...
src/pages/pageCustomized/categoryNavigation/components/Layout/Tabs/index.tsx
View file @
b28dc3cb
...
...
@@ -27,6 +27,9 @@ const CustomizeTabs: React.FC<Iprops> & { TabItem: typeof TabItem } = (props: Ip
// };
const
getActivityProduct
=
async
(
ids
:
number
[])
=>
{
if
(
ids
.
length
===
0
)
{
return
null
;
}
return
PublicApi
.
getMarketingAdornActivityGoodsAdorn
({
ids
:
ids
as
any
});
};
...
...
@@ -157,6 +160,7 @@ const CustomizeTabs: React.FC<Iprops> & { TabItem: typeof TabItem } = (props: Ip
...
resultData
};
const
cloneDeepPageConfig
=
cloneDeep
(
pageConfig
);
console
.
log
(
cloneDeepPageConfig
);
Object
.
keys
(
resultDataWithSecondary
).
forEach
((
_item
)
=>
{
const
parentKey
=
domKeyMap2Type
.
get
(
_item
);
if
(
!
parentKey
)
{
...
...
src/pages/pageCustomized/categoryNavigation/index.tsx
View file @
b28dc3cb
...
...
@@ -81,7 +81,7 @@ const CategoryNavigation = () => {
/** domKey 从7开始都是tab 的值 */
setLoading
(
true
);
const
tabChildren
=
pageConfig
[
4
].
childNodes
.
slice
(
1
);
const
result
=
tabChildren
.
map
((
_nodeKey
)
=>
{
const
result
=
tabChildren
.
map
((
_nodeKey
:
string
)
=>
{
if
(
!
pageConfig
[
_nodeKey
])
{
return
;
}
...
...
@@ -100,13 +100,14 @@ const CategoryNavigation = () => {
};
const
tabItemData
=
{};
const
tabItemChild
=
pageConfig
[
_nodeKey
].
childNodes
;
tabItemChild
.
forEach
(
element
=>
{
tabItemChild
.
forEach
(
(
element
,
_index
)
=>
{
const
{
otherProps
:
{
type
},
props
,
childNodes
}
=
pageConfig
[
element
];
const
rest
=
type
===
'suggestProduct'
?
{
type
:
props
.
type
,
num
:
props
.
num
}
:
{};
const
rest
=
type
===
'suggestProduct'
?
{
type
:
props
.
type
||
1
,
num
:
props
.
num
||
50
}
:
{};
tabItemData
[
type
]
=
{
title
:
props
?.
title
||
TITLE_MAP
[
type
],
...
rest
,
sort
:
_index
+
1
,
children
:
childNodes
.
map
((
_son
)
=>
{
const
sonData
=
pageConfig
[
_son
];
...
...
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