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
6ecb22a4
Commit
6ecb22a4
authored
Nov 30, 2020
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🦄
refactor: 修改代码规范
parent
d92698cd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
26 deletions
+26
-26
index.tsx
src/pages/editor/channelEdit/index.tsx
+26
-26
No files found.
src/pages/editor/channelEdit/index.tsx
View file @
6ecb22a4
...
...
@@ -26,7 +26,7 @@ interface ChannelPreviewPropsType {
}
}
le
t
TemplateList
=
[
'science'
]
cons
t
TemplateList
=
[
'science'
]
const
ChannelPreview
:
React
.
FC
<
ChannelPreviewPropsType
>
=
(
props
)
=>
{
const
{
query
:
{
id
,
template
}
}
=
props
.
location
...
...
@@ -45,11 +45,11 @@ const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
const
findFirstAdvertsByType
=
()
=>
{
return
new
Promise
((
resolve
)
=>
{
let
params
=
{
const
params
:
any
=
{
templateId
:
id
,
type
:
1
}
//@ts-ignore
PublicApi
.
getTemplateChannelFindAdvertsByType
(
params
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
...
...
@@ -62,11 +62,11 @@ const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
const
findSecondAdvertsByType
=
()
=>
{
return
new
Promise
((
resolve
)
=>
{
let
params
=
{
const
params
:
any
=
{
templateId
:
id
,
type
:
2
}
//@ts-ignore
PublicApi
.
getTemplateChannelFindAdvertsByType
(
params
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
...
...
@@ -95,12 +95,11 @@ const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
*/
const
fetchCategoryById
=
(
categoryId
)
=>
{
return
new
Promise
((
resolve
)
=>
{
let
param
=
{
const
param
:
any
=
{
templateId
:
id
,
categoryId
}
// @ts-ignore
PublicApi
.
getTemplateChannelFindFirstCategoryDetail
(
param
).
then
(
res
=>
{
resolve
(
res
.
data
)
})
...
...
@@ -126,13 +125,15 @@ const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
*/
const
fetchLeadNews
=
()
=>
{
return
new
Promise
((
resolve
)
=>
{
//@ts-ignore
PublicApi
.
getManageContentInformationFindAllByRecommendLabel
({
recommendLabel
:
1
}).
then
(
res
=>
{
const
param
:
any
=
{
recommendLabel
:
1
}
PublicApi
.
getManageContentInformationFindAllByRecommendLabel
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
le
t
leadNewsList
:
any
=
res
.
data
||
[]
cons
t
leadNewsList
:
any
=
res
.
data
||
[]
if
(
leadNewsList
.
length
>=
2
)
{
le
t
leftList
=
leadNewsList
.
slice
(
0
,
Math
.
round
(
leadNewsList
.
length
/
2
))
le
t
rightList
=
leadNewsList
.
slice
(
Math
.
round
(
leadNewsList
.
length
/
2
),
leadNewsList
.
length
)
cons
t
leftList
=
leadNewsList
.
slice
(
0
,
Math
.
round
(
leadNewsList
.
length
/
2
))
cons
t
rightList
=
leadNewsList
.
slice
(
Math
.
round
(
leadNewsList
.
length
/
2
),
leadNewsList
.
length
)
resolve
({
leadLeftNews
:
leftList
,
leadRightNews
:
rightList
...
...
@@ -157,10 +158,10 @@ const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
PublicApi
.
getManageContentColumnAll
().
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
let
result
=
""
le
t
allColumn
=
res
.
data
cons
t
allColumn
=
res
.
data
if
(
allColumn
&&
allColumn
.
length
>
0
)
{
let
labelList
=
allColumn
.
map
((
item
:
any
)
=>
item
.
name
)
le
t
showCount
=
4
cons
t
showCount
=
4
if
(
labelList
.
length
<=
showCount
)
{
result
=
labelList
.
join
(
' | '
)
}
else
{
...
...
@@ -185,8 +186,8 @@ const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
// 二号位广告
serviceAdvertConfig
[
serviceAdvertConfig
.
key
].
props
.
advertList
=
await
findSecondAdvertsByType
()
//店铺信息
//店铺信息
const
channelInfo
:
any
=
await
fetchShopInfo
()
AboutUsConfig
[
AboutUsConfig
.
key
].
props
.
shopInfo
=
channelInfo
...
...
@@ -199,17 +200,17 @@ const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
let
initIndex
=
100
let
floorLineConfig
:
any
=
{}
le
t
floorLineKeys
:
any
=
[]
cons
t
floorLineKeys
:
any
=
[]
le
t
firstCategory
:
any
=
await
fetchFirstCategory
()
cons
t
firstCategory
:
any
=
await
fetchFirstCategory
()
for
(
le
t
item
of
firstCategory
)
{
le
t
categoryDetail
:
any
=
await
fetchCategoryById
(
item
.
id
)
for
(
cons
t
item
of
firstCategory
)
{
cons
t
categoryDetail
:
any
=
await
fetchCategoryById
(
item
.
id
)
let
floorLineConfigItem
=
{}
floorLineKeys
.
push
(
String
(
initIndex
+
1
))
le
t
FloorLine
=
{
cons
t
FloorLine
=
{
[
String
(
initIndex
+
1
)]:
{
"componentName"
:
"ShopFloorLine"
,
"props"
:
{
...
...
@@ -219,7 +220,7 @@ const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
}
}
le
t
Category
=
{
cons
t
Category
=
{
[
String
(
initIndex
+
2
)]:
{
"componentName"
:
"ShopFloorLine.Category"
,
"props"
:
{
...
...
@@ -231,7 +232,7 @@ const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
},
}
le
t
Goods
=
{
cons
t
Goods
=
{
[
String
(
initIndex
+
3
)]:
{
"componentName"
:
"ShopFloorLine.Goods"
,
"props"
:
{
...
...
@@ -249,7 +250,7 @@ const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
mallLayoutConfig
[
"0"
].
childNodes
=
[...
mallLayoutConfig
[
"0"
].
childNodes
,
...
floorLineKeys
,
serviceAdvertConfig
.
key
,
CommonTitle2Config
.
key
,
AboutUsConfig
.
key
,
InformationConfig
.
key
,
FooterConfig
.
key
]
le
t
config
=
{
cons
t
config
=
{
...
mallLayoutConfig
,
...
topBarConfig
,
...
topAdvertConfig
,
...
...
@@ -284,4 +285,4 @@ const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
)
:
<
Loading
/>
}
export
default
ChannelPreview
\ No newline at end of file
export
default
ChannelPreview
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