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
linweijiong
jinfa-platform
Commits
01426f58
Commit
01426f58
authored
Sep 17, 2020
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:渠道商城和渠道自有商城模板的区分
parent
c3e407f1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
16 deletions
+28
-16
index.tsx
src/pages/lxMall/channel/index.tsx
+26
-14
LXChannelLayout.tsx
src/pages/lxMall/layouts/LXChannelLayout.tsx
+1
-1
LXIChannelLayout.tsx
src/pages/lxMall/layouts/LXIChannelLayout.tsx
+1
-1
No files found.
src/pages/lxMall/channel/index.tsx
View file @
01426f58
...
@@ -16,11 +16,12 @@ interface ChannelIndexPropsType {
...
@@ -16,11 +16,12 @@ interface ChannelIndexPropsType {
memberId
:
number
;
memberId
:
number
;
shopId
:
number
;
shopId
:
number
;
shopUrlParam
:
string
;
shopUrlParam
:
string
;
shopInfo
:
GetTemplateChannelFindChannelResponse
shopInfo
:
GetTemplateChannelFindChannelResponse
;
layoutType
:
LAYOUT_TYPE
}
}
const
ChannelIndex
:
React
.
FC
<
ChannelIndexPropsType
>
=
(
props
)
=>
{
const
ChannelIndex
:
React
.
FC
<
ChannelIndexPropsType
>
=
(
props
)
=>
{
const
{
memberId
,
shopUrlParam
,
shopInfo
}
=
props
const
{
memberId
,
shopUrlParam
,
shopInfo
,
layoutType
}
=
props
const
[
categoryList
,
setCategoryList
]
=
useState
<
GetTemplatePlatformFindAllFirstCategoryResponse
>
([])
const
[
categoryList
,
setCategoryList
]
=
useState
<
GetTemplatePlatformFindAllFirstCategoryResponse
>
([])
const
[
firstAdvertList
,
setFirstAdvertList
]
=
useState
([])
const
[
firstAdvertList
,
setFirstAdvertList
]
=
useState
([])
const
[
secondAdvertList
,
setSecondAdvertList
]
=
useState
([])
const
[
secondAdvertList
,
setSecondAdvertList
]
=
useState
([])
...
@@ -28,17 +29,28 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
...
@@ -28,17 +29,28 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
shopInfo
)
{
if
(
shopInfo
)
{
if
(
shopInfo
.
templateId
)
{
let
templateId
getCategoryComponents
()
switch
(
layoutType
)
{
findFirstAdvertsByType
()
case
LAYOUT_TYPE
.
channel
:
findSecondAdvertsByType
()
templateId
=
shopInfo
.
channelShopTemplateId
break
;
case
LAYOUT_TYPE
.
ichannel
:
templateId
=
shopInfo
.
channelOwnShopTemplateId
break
default
:
break
;
}
if
(
templateId
)
{
getCategoryComponents
(
templateId
)
findFirstAdvertsByType
(
templateId
)
findSecondAdvertsByType
(
templateId
)
}
}
}
}
},
[
shopInfo
])
},
[
shopInfo
])
const
findFirstAdvertsByType
=
()
=>
{
const
findFirstAdvertsByType
=
(
templateId
)
=>
{
let
params
=
{
let
params
=
{
templateId
:
shopInfo
.
templateId
,
templateId
,
type
:
1
,
type
:
1
,
memberId
memberId
}
}
...
@@ -50,9 +62,9 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
...
@@ -50,9 +62,9 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
})
})
}
}
const
findSecondAdvertsByType
=
()
=>
{
const
findSecondAdvertsByType
=
(
templateId
)
=>
{
let
params
=
{
let
params
=
{
templateId
:
shopInfo
.
templateId
,
templateId
,
type
:
2
,
type
:
2
,
memberId
memberId
}
}
...
@@ -83,10 +95,10 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
...
@@ -83,10 +95,10 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
/**
/**
* 获取一级品类详细信息
* 获取一级品类详细信息
*/
*/
const
fetchCategoryById
=
(
categoryId
)
=>
{
const
fetchCategoryById
=
(
categoryId
,
templateId
)
=>
{
return
new
Promise
((
resolve
)
=>
{
return
new
Promise
((
resolve
)
=>
{
let
param
=
{
let
param
=
{
templateId
:
shopInfo
.
templateId
,
templateId
:
templateId
,
categoryId
,
categoryId
,
memberId
memberId
}
}
...
@@ -98,12 +110,12 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
...
@@ -98,12 +110,12 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
})
})
}
}
const
getCategoryComponents
=
async
()
=>
{
const
getCategoryComponents
=
async
(
templateId
)
=>
{
let
result
=
[]
let
result
=
[]
let
firstCategory
:
any
=
await
fetchFirstCategory
()
let
firstCategory
:
any
=
await
fetchFirstCategory
()
for
(
let
item
of
firstCategory
)
{
for
(
let
item
of
firstCategory
)
{
let
categoryDetail
:
any
=
await
fetchCategoryById
(
item
.
id
)
let
categoryDetail
:
any
=
await
fetchCategoryById
(
item
.
id
,
templateId
)
result
.
push
(
result
.
push
(
<
ShopFloorLine
<
ShopFloorLine
linkUrl=
{
`/channelmall/commodity?channelId=${shopUrlParam}&categoryId=${item.id}&categoryName=${btoa(encodeURIComponent(item.name))}`
}
linkUrl=
{
`/channelmall/commodity?channelId=${shopUrlParam}&categoryId=${item.id}&categoryName=${btoa(encodeURIComponent(item.name))}`
}
...
...
src/pages/lxMall/layouts/LXChannelLayout.tsx
View file @
01426f58
...
@@ -66,7 +66,7 @@ const LXChannelLayout: React.FC<LXChannelLayoutPropsType> = (props) => {
...
@@ -66,7 +66,7 @@ const LXChannelLayout: React.FC<LXChannelLayoutPropsType> = (props) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
let
body
=
document
.
getElementsByTagName
(
'body'
)[
0
];
let
body
=
document
.
getElementsByTagName
(
'body'
)[
0
];
if
(
shopInfo
)
{
if
(
shopInfo
)
{
body
.
className
=
shopInfo
.
fileName
?
`theme-channel-
${
shopInfo
.
f
ileName
}
`
:
templateName
;
body
.
className
=
shopInfo
.
channelShopTemplateFileName
?
`theme-channel-
${
shopInfo
.
channelShopTemplateF
ileName
}
`
:
templateName
;
}
else
{
}
else
{
body
.
className
=
templateName
body
.
className
=
templateName
}
}
...
...
src/pages/lxMall/layouts/LXIChannelLayout.tsx
View file @
01426f58
...
@@ -65,7 +65,7 @@ const LXIChannelLayout: React.FC<LXIChannelLayoutPropsType> = (props) => {
...
@@ -65,7 +65,7 @@ const LXIChannelLayout: React.FC<LXIChannelLayoutPropsType> = (props) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
let
body
=
document
.
getElementsByTagName
(
'body'
)[
0
];
let
body
=
document
.
getElementsByTagName
(
'body'
)[
0
];
if
(
shopInfo
)
{
if
(
shopInfo
)
{
body
.
className
=
shopInfo
.
fileName
?
`theme-channel-
${
shopInfo
.
f
ileName
}
`
:
templateName
;
body
.
className
=
shopInfo
.
channelOwnShopTemplateFileName
?
`theme-channel-
${
shopInfo
.
channelOwnShopTemplateF
ileName
}
`
:
templateName
;
}
else
{
}
else
{
body
.
className
=
templateName
body
.
className
=
templateName
}
}
...
...
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