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
fadff86f
Commit
fadff86f
authored
Dec 16, 2020
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复模板装修相关bug
parent
95bacda4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
48 deletions
+64
-48
index.tsx
...ngsPanel/propsSettings/components/AdvertSetting/index.tsx
+23
-20
index.tsx
...ingsPanel/propsSettings/components/GoodsSetting/index.tsx
+2
-1
index.tsx
src/pages/editor/shopEdit/index.tsx
+0
-0
index.tsx
src/pages/preview/channelPreview/index.tsx
+39
-27
No files found.
src/pages/editor/settingsPanel/propsSettings/components/AdvertSetting/index.tsx
View file @
fadff86f
...
...
@@ -11,7 +11,7 @@ import { ArrowUpOutlined, DeleteOutlined, PlusOutlined, ArrowDownOutlined, Caret
import
{
addTempalteIdToList
}
from
'../../../../utils'
import
styles
from
'./index.less'
interface
a
dvertItemType
{
interface
A
dvertItemType
{
/**
* ID
*/
...
...
@@ -54,7 +54,7 @@ interface advertItemType {
interface
AdvertSettingPropsType
{
advertList
:
a
dvertItemType
[];
advertList
:
A
dvertItemType
[];
onChange
:
Function
;
type
:
'top'
|
'banner'
|
'interact'
|
'category'
;
templateid
:
number
;
...
...
@@ -64,7 +64,7 @@ interface AdvertSettingPropsType {
const
AdvertSetting
:
React
.
FC
<
AdvertSettingPropsType
>
=
forwardRef
((
props
,
ref
)
=>
{
const
{
advertList
=
[],
templateid
,
type
,
categoryid
,
templateType
}
=
props
const
[
list
,
setList
]
=
useState
<
a
dvertItemType
[]
>
(
advertList
)
const
[
list
,
setList
]
=
useState
<
A
dvertItemType
[]
>
(
advertList
)
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
<
boolean
>
(
false
)
const
[
newProps
,
setNewProps
]
=
useState
(
props
)
...
...
@@ -87,10 +87,10 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
setNewProps
(
newProps
)
}
const
sortUp
=
(
index
:
number
,
item
:
a
dvertItemType
)
=>
{
le
t
newList
=
JSON
.
parse
(
JSON
.
stringify
(
list
))
le
t
tempItem
=
JSON
.
parse
(
JSON
.
stringify
(
item
))
le
t
temp
=
newList
[
index
-
1
]
const
sortUp
=
(
index
:
number
,
item
:
A
dvertItemType
)
=>
{
cons
t
newList
=
JSON
.
parse
(
JSON
.
stringify
(
list
))
cons
t
tempItem
=
JSON
.
parse
(
JSON
.
stringify
(
item
))
cons
t
temp
=
newList
[
index
-
1
]
newList
[
index
-
1
]
=
item
newList
[
index
-
1
].
sort
=
temp
.
sort
newList
[
index
]
=
temp
...
...
@@ -99,10 +99,10 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
changeNewProps
(
'advertList'
,
newList
)
}
const
sortDown
=
(
index
:
number
,
item
:
a
dvertItemType
)
=>
{
le
t
newList
=
JSON
.
parse
(
JSON
.
stringify
(
list
))
le
t
temp
=
newList
[
index
+
1
]
le
t
tempItem
=
JSON
.
parse
(
JSON
.
stringify
(
item
))
const
sortDown
=
(
index
:
number
,
item
:
A
dvertItemType
)
=>
{
cons
t
newList
=
JSON
.
parse
(
JSON
.
stringify
(
list
))
cons
t
temp
=
newList
[
index
+
1
]
cons
t
tempItem
=
JSON
.
parse
(
JSON
.
stringify
(
item
))
newList
[
index
+
1
]
=
item
newList
[
index
+
1
].
sort
=
temp
.
sort
newList
[
index
]
=
temp
...
...
@@ -112,7 +112,7 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
}
const
addSliderItem
=
()
=>
{
le
t
newList
=
JSON
.
parse
(
JSON
.
stringify
(
list
))
cons
t
newList
=
JSON
.
parse
(
JSON
.
stringify
(
list
))
let
sort
=
0
if
(
newList
.
length
<=
0
)
{
sort
=
1
...
...
@@ -120,7 +120,7 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
sort
=
newList
[
newList
.
length
-
1
].
sort
+
1
}
le
t
tempItem
:
any
=
{
cons
t
tempItem
:
any
=
{
templateId
:
Number
(
templateid
),
type
:
getAdvertType
(
type
),
name
:
''
,
...
...
@@ -140,7 +140,7 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
}
const
handleDeleteItem
=
(
index
:
number
)
=>
{
le
t
newList
=
JSON
.
parse
(
JSON
.
stringify
(
list
))
cons
t
newList
=
JSON
.
parse
(
JSON
.
stringify
(
list
))
newList
.
splice
(
index
,
1
)
let
sort
=
1
newList
.
map
(
item
=>
{
...
...
@@ -152,7 +152,7 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
}
const
handleExpand
=
(
sort
:
number
,
state
:
boolean
)
=>
{
le
t
newList
=
JSON
.
parse
(
JSON
.
stringify
(
list
))
cons
t
newList
=
JSON
.
parse
(
JSON
.
stringify
(
list
))
newList
.
map
(
item
=>
{
if
(
item
.
sort
===
sort
)
{
item
.
expand
=
state
...
...
@@ -162,7 +162,7 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
}
const
handleKeyChange
=
(
value
:
string
,
sort
:
number
,
key
:
string
)
=>
{
le
t
newList
=
JSON
.
parse
(
JSON
.
stringify
(
list
))
cons
t
newList
=
JSON
.
parse
(
JSON
.
stringify
(
list
))
newList
.
map
(
item
=>
{
if
(
item
.
sort
===
sort
)
{
item
[
key
]
=
value
...
...
@@ -193,9 +193,10 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
return
}
setConfirmLoading
(
true
)
le
t
newParam
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
newProps
))
cons
t
newParam
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
newProps
))
newParam
.
advertList
=
newParam
.
advertList
.
map
((
item
)
=>
{
if
(
!
item
.
link
&&
!
item
.
link
.
startsWith
(
'http://'
)
&&
!
item
.
link
.
startsWith
(
'https://'
))
{
console
.
log
(
item
.
link
,
"item.link"
)
if
(
item
.
link
&&
!
item
.
link
.
startsWith
(
'http://'
)
&&
!
item
.
link
.
startsWith
(
'https://'
))
{
item
.
link
=
`http://
${
item
.
link
}
`
}
return
item
...
...
@@ -247,7 +248,7 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
reject
()
return
}
le
t
param
:
any
=
{
cons
t
param
:
any
=
{
templateId
:
templateid
,
type
:
getAdvertType
(
type
),
adverts
:
addTempalteIdToList
(
advertList
,
templateid
)
...
...
@@ -293,7 +294,7 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
<
div
className=
{
styles
.
advert_setting_line_name
}
onClick=
{
()
=>
handleExpand
(
item
.
sort
,
!
item
.
expand
)
}
>
<
span
>
{
item
.
name
}
</
span
>
{
!!
item
.
expand
?
<
CaretUpOutlined
className=
{
styles
.
icon
}
/>
:
<
CaretDownOutlined
className=
{
styles
.
icon
}
/>
item
.
expand
?
<
CaretUpOutlined
className=
{
styles
.
icon
}
/>
:
<
CaretDownOutlined
className=
{
styles
.
icon
}
/>
}
</
div
>
{
...
...
@@ -344,4 +345,6 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
)
})
AdvertSetting
.
displayName
=
"AdvertSetting"
export
default
AdvertSetting
src/pages/editor/settingsPanel/propsSettings/components/GoodsSetting/index.tsx
View file @
fadff86f
import
React
,
{
useState
,
useEffect
,
useCallback
}
from
'react'
import
React
,
{
useState
,
useEffect
}
from
'react'
import
{
clearSelectedStatus
,
changeProps
}
from
'lingxi-editor-core'
import
{
Row
,
Col
,
Button
,
Input
,
Pagination
,
Select
,
Form
,
message
,
Modal
}
from
'antd'
import
SettingList
from
'../../../../components/SettingList'
...
...
@@ -207,6 +207,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
changeProps
({
props
:
{
linkdisable
:
true
,
templateid
,
categoryid
,
goodsList
:
newList
...
...
src/pages/editor/shopEdit/index.tsx
View file @
fadff86f
src/pages/preview/channelPreview/index.tsx
View file @
fadff86f
...
...
@@ -8,6 +8,7 @@ import { topBarConfig, topAdvertConfig, headerConfig, mainNavConfig, bannerAdver
import
Loading
from
'../../editor/components/Loading'
import
{
menuData
}
from
'./defaultMenu'
import
{
PublicApi
}
from
'@/services/api'
import
{
getAuth
}
from
'@/utils/auth'
import
styles
from
'./index.less'
interface
ChannelEditPropsType
{
...
...
@@ -25,9 +26,10 @@ interface ChannelEditPropsType {
}
}
let
TemplateList
=
[
'science'
]
const
TemplateList
=
[
'science'
]
const
ChannelEdit
:
React
.
FC
<
ChannelEditPropsType
>
=
(
props
)
=>
{
const
userInfo
=
getAuth
()
||
{}
const
{
query
:
{
id
,
template
}
}
=
props
.
location
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
true
)
const
[
theme
,
setTheme
]
=
useState
<
string
>
(
'theme-channel-science'
)
...
...
@@ -44,11 +46,12 @@ const ChannelEdit: React.FC<ChannelEditPropsType> = (props) => {
const
findFirstAdvertsByType
=
()
=>
{
return
new
Promise
((
resolve
)
=>
{
let
params
=
{
const
params
:
any
=
{
templateId
:
id
,
type
:
1
type
:
1
,
memberId
:
userInfo
.
memberId
}
//@ts-ignore
PublicApi
.
getTemplateChannelFindAdvertsByType
(
params
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
...
...
@@ -61,11 +64,12 @@ const ChannelEdit: React.FC<ChannelEditPropsType> = (props) => {
const
findSecondAdvertsByType
=
()
=>
{
return
new
Promise
((
resolve
)
=>
{
let
params
=
{
const
params
:
any
=
{
templateId
:
id
,
type
:
2
type
:
2
,
memberId
:
userInfo
.
memberId
}
//@ts-ignore
PublicApi
.
getTemplateChannelFindAdvertsByType
(
params
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
...
...
@@ -81,7 +85,10 @@ const ChannelEdit: React.FC<ChannelEditPropsType> = (props) => {
*/
const
fetchFirstCategory
=
()
=>
{
return
new
Promise
((
resolve
)
=>
{
PublicApi
.
getTemplateChannelFindAllFirstCategory
().
then
(
res
=>
{
const
params
:
any
=
{
memberId
:
userInfo
.
memberId
}
PublicApi
.
getTemplateChannelFindAllFirstCategory
(
params
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
}
else
{
...
...
@@ -96,12 +103,12 @@ const ChannelEdit: React.FC<ChannelEditPropsType> = (props) => {
*/
const
fetchCategoryById
=
(
categoryId
)
=>
{
return
new
Promise
((
resolve
)
=>
{
let
param
=
{
const
param
:
any
=
{
templateId
:
id
,
categoryId
categoryId
,
memberId
:
userInfo
.
memberId
}
// @ts-ignore
PublicApi
.
getTemplateChannelFindFirstCategoryDetail
(
param
).
then
(
res
=>
{
resolve
(
res
.
data
)
})
...
...
@@ -114,7 +121,10 @@ const ChannelEdit: React.FC<ChannelEditPropsType> = (props) => {
*/
const
fetchShopInfo
=
()
=>
{
return
new
Promise
((
resolve
)
=>
{
PublicApi
.
getTemplateChannelFindChannel
().
then
(
res
=>
{
const
params
:
any
=
{
memberId
:
userInfo
.
memberId
}
PublicApi
.
getTemplateChannelFindChannel
(
params
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
}
...
...
@@ -127,13 +137,15 @@ const ChannelEdit: React.FC<ChannelEditPropsType> = (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
)
{
let
leadNewsList
:
any
=
res
.
data
||
[]
const
leadNewsList
:
any
=
res
.
data
||
[]
if
(
leadNewsList
.
length
>=
2
)
{
let
leftList
=
leadNewsList
.
slice
(
0
,
Math
.
round
(
leadNewsList
.
length
/
2
))
let
rightList
=
leadNewsList
.
slice
(
Math
.
round
(
leadNewsList
.
length
/
2
),
leadNewsList
.
length
)
const
leftList
=
leadNewsList
.
slice
(
0
,
Math
.
round
(
leadNewsList
.
length
/
2
))
const
rightList
=
leadNewsList
.
slice
(
Math
.
round
(
leadNewsList
.
length
/
2
),
leadNewsList
.
length
)
resolve
({
leadLeftNews
:
leftList
,
leadRightNews
:
rightList
...
...
@@ -158,10 +170,10 @@ const ChannelEdit: React.FC<ChannelEditPropsType> = (props) => {
PublicApi
.
getManageContentColumnAll
().
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
let
result
=
""
let
allColumn
=
res
.
data
const
allColumn
=
res
.
data
if
(
allColumn
&&
allColumn
.
length
>
0
)
{
let
labelList
=
allColumn
.
map
((
item
:
any
)
=>
item
.
name
)
let
showCount
=
4
const
showCount
=
4
if
(
labelList
.
length
<=
showCount
)
{
result
=
labelList
.
join
(
' | '
)
}
else
{
...
...
@@ -200,17 +212,17 @@ const ChannelEdit: React.FC<ChannelEditPropsType> = (props) => {
let
initIndex
=
100
let
floorLineConfig
:
any
=
{}
let
floorLineKeys
:
any
=
[]
const
floorLineKeys
:
any
=
[]
let
firstCategory
:
any
=
await
fetchFirstCategory
()
const
firstCategory
:
any
=
await
fetchFirstCategory
()
for
(
let
item
of
firstCategory
)
{
let
categoryDetail
:
any
=
await
fetchCategoryById
(
item
.
id
)
for
(
const
item
of
firstCategory
)
{
const
categoryDetail
:
any
=
await
fetchCategoryById
(
item
.
id
)
let
floorLineConfigItem
=
{}
floorLineKeys
.
push
(
String
(
initIndex
+
1
))
let
FloorLine
=
{
const
FloorLine
=
{
[
String
(
initIndex
+
1
)]:
{
"componentName"
:
"ShopFloorLine"
,
"props"
:
{
...
...
@@ -220,7 +232,7 @@ const ChannelEdit: React.FC<ChannelEditPropsType> = (props) => {
}
}
let
Category
=
{
const
Category
=
{
[
String
(
initIndex
+
2
)]:
{
"componentName"
:
"ShopFloorLine.Category"
,
"props"
:
{
...
...
@@ -231,7 +243,7 @@ const ChannelEdit: React.FC<ChannelEditPropsType> = (props) => {
},
}
let
Goods
=
{
const
Goods
=
{
[
String
(
initIndex
+
3
)]:
{
"componentName"
:
"ShopFloorLine.Goods"
,
"props"
:
{
...
...
@@ -249,7 +261,7 @@ const ChannelEdit: React.FC<ChannelEditPropsType> = (props) => {
mallLayoutConfig
[
"0"
].
childNodes
=
[...
mallLayoutConfig
[
"0"
].
childNodes
,
...
floorLineKeys
,
serviceAdvertConfig
.
key
,
CommonTitle2Config
.
key
,
AboutUsConfig
.
key
,
InformationConfig
.
key
,
FooterConfig
.
key
]
let
config
=
{
const
config
=
{
...
mallLayoutConfig
,
...
topBarConfig
,
...
topAdvertConfig
,
...
...
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