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
project
jinfa-admin
Commits
ec6f8b6b
Commit
ec6f8b6b
authored
May 25, 2021
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-srm' of
http://10.0.0.22:3000/lingxi/lingxi-business-system
into dev-srm
parents
87050f23
f544eff1
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
1331 additions
and
0 deletions
+1331
-0
index.ts
src/constants/index.ts
+1
-0
defaultData.ts
src/pages/pageCustomized/platformEdit/defaultData.ts
+194
-0
defaultMenu.ts
src/pages/pageCustomized/platformEdit/defaultMenu.ts
+70
-0
index.less
src/pages/pageCustomized/platformEdit/index.less
+26
-0
index.tsx
src/pages/pageCustomized/platformEdit/index.tsx
+334
-0
defaultData.ts
src/pages/pageCustomized/platformPreview/defaultData.ts
+194
-0
defaultMenu.ts
src/pages/pageCustomized/platformPreview/defaultMenu.ts
+70
-0
index.less
src/pages/pageCustomized/platformPreview/index.less
+26
-0
index.tsx
src/pages/pageCustomized/platformPreview/index.tsx
+334
-0
index.less
src/pages/pageCustomized/platformTemplate/index.less
+37
-0
index.tsx
src/pages/pageCustomized/platformTemplate/index.tsx
+45
-0
No files found.
src/constants/index.ts
View file @
ec6f8b6b
...
...
@@ -43,6 +43,7 @@ export const ORDER_TYPE = ['',
]
export
enum
TEMPLATE_TYPE
{
platform
=
0
,
mall
=
1
,
shop
=
2
,
goods
=
3
,
...
...
src/pages/pageCustomized/platformEdit/defaultData.ts
0 → 100644
View file @
ec6f8b6b
export
const
mallLayoutConfig
=
{
key
:
"0"
,
"0"
:
{
"componentName"
:
"MallLayout"
,
"props"
:
{
"style"
:
{
"width"
:
"100%"
,
"minHeight"
:
"100%"
}
},
"childNodes"
:
[
"1"
,
"3"
,
"4"
,
"21"
]
},
}
export
const
topBarConfig
=
{
key
:
"1"
,
"1"
:
{
"componentName"
:
"TopBar"
,
"props"
:
{
linkdisable
:
true
},
}
}
export
const
topAdvertConfig
=
{
key
:
"2"
,
"2"
:
{
"componentName"
:
"Advert"
,
"props"
:
{
"type"
:
"top"
,
"linkdisable"
:
true
,
"advertList"
:
[]
},
},
}
export
const
headerConfig
=
{
key
:
"3"
,
"3"
:
{
"componentName"
:
"Header"
,
"props"
:
{
"logoUrl"
:
""
},
},
}
export
const
mainNavConfig
=
{
key
:
"4"
,
"4"
:
{
"componentName"
:
"MallMainNav"
,
"props"
:
{},
},
}
// < div className = { styles.horizontalWrap } >
// <Category categoryList={ categoryList } />
// < div className = { styles.bannerWrap } >
// {
// useMemo(() => <Advert type="banner" advertList = { firstAdvertList } />, [firstAdvertList])
// }
// {
// useMemo(() => <Advert type="interact" advertList = { secondAdvertList } />, [secondAdvertList])
// }
// </div>
// < div className = { styles.quickNavWrap } >
// <QuickNav
// userInfo={ userInfo }
// userRoles = { userRoles }
// name = { mallInfo?.name }
// advertList = { secondAdvertList }
// />
// </div>
// < /div>
export
const
bannerContainer
=
{
key
:
"21"
,
"21"
:
{
"componentName"
:
"div"
,
"props"
:
{
"style"
:
{
position
:
"relative"
,
display
:
"flex"
,
paddingTop
:
"16px"
,
width
:
"1200px"
,
margin
:
"0 auto"
,
}
},
"childNodes"
:
[
"22"
,
"23"
,
"24"
]
}
}
export
const
categoryConfig
=
{
key
:
"22"
,
"22"
:
{
"componentName"
:
"Category"
,
"props"
:
{
categoryList
:
[],
canHide
:
false
,
}
}
}
export
const
bannerWrap
=
{
key
:
"23"
,
"23"
:
{
"componentName"
:
"div"
,
"props"
:
{
"style"
:
{
margin
:
"0 16px"
,
flex
:
1
,
width
:
0
,
}
},
"childNodes"
:
[
"5"
,
"6"
]
}
}
export
const
quickNavConfigWrap
=
{
key
:
"24"
,
"24"
:
{
"componentName"
:
"div"
,
"props"
:
{},
"childNodes"
:
[
"25"
,
"26"
]
}
}
export
const
quickNavConfig
=
{
key
:
"25"
,
"25"
:
{
"componentName"
:
"QuickNav"
,
"props"
:
{},
}
}
export
const
navAdvertConfig
=
{
key
:
"26"
,
"26"
:
{
"componentName"
:
"Advert"
,
"props"
:
{
"type"
:
"nav"
,
"linkdisable"
:
true
,
"advertList"
:
[]
},
},
}
export
const
bannerAdvertConfig
=
{
key
:
"5"
,
"5"
:
{
"componentName"
:
"Advert"
,
"props"
:
{
"type"
:
"banner"
,
"hasQuickNav"
:
false
,
"linkdisable"
:
true
,
"advertList"
:
[]
}
},
}
export
const
interactAdvertConfig
=
{
key
:
"6"
,
"6"
:
{
"componentName"
:
"Advert"
,
"props"
:
{
"type"
:
"interact"
,
"linkdisable"
:
true
,
"advertList"
:
[]
},
},
}
export
const
FindMoreConfig
=
{
key
:
"18"
,
"18"
:
{
"componentName"
:
"FindMore"
,
"props"
:
{},
},
}
export
const
InformationConfig
=
{
key
:
'19'
,
"19"
:
{
"componentName"
:
"Information"
,
"props"
:
{},
},
}
export
const
FooterConfig
=
{
key
:
'20'
,
"20"
:
{
"componentName"
:
"Footer"
,
"props"
:
{},
},
}
src/pages/pageCustomized/platformEdit/defaultMenu.ts
0 → 100644
View file @
ec6f8b6b
import
{
GlobalConfig
}
from
'@/global/config'
const
siteUrl
=
GlobalConfig
.
site
.
siteInfo
.
siteUrl
/**
* 请求头
*/
export
const
REQUEST_HEADER
=
'http://'
export
const
getTopDomainByHost
=
(
url
:
string
):
string
=>
{
if
(
!
url
)
return
''
return
url
.
split
(
'.'
).
slice
(
-
2
).
join
(
'.'
)
}
export
const
TOP_DOMAIN
=
getTopDomainByHost
(
siteUrl
)
export
const
getMenuData
=
(
shopId
:
number
)
=>
{
const
shopInfo
=
GlobalConfig
.
web
.
shopInfo
const
webMallList
=
shopInfo
.
filter
((
item
:
{
id
:
number
})
=>
item
.
id
===
shopId
)
if
(
webMallList
.
length
>
0
)
{
const
SUB_DOMAIN
=
webMallList
[
0
].
url
return
[
{
"id"
:
0
,
"link"
:
`
${
REQUEST_HEADER
}${
SUB_DOMAIN
}
.
${
TOP_DOMAIN
}
`
,
"name"
:
"商城首页"
,
"status"
:
true
,
"key"
:
"shopHome"
,
},
{
"id"
:
1
,
"link"
:
`
${
REQUEST_HEADER
}${
SUB_DOMAIN
}
.
${
TOP_DOMAIN
}
/commodity`
,
"name"
:
"现货商品"
,
"status"
:
true
,
"key"
:
"shopCommodity"
,
},
{
"id"
:
2
,
"link"
:
`
${
REQUEST_HEADER
}${
SUB_DOMAIN
}
.
${
TOP_DOMAIN
}
/inquiry`
,
"name"
:
"询价商品"
,
"status"
:
true
,
"key"
:
"purchaseOnline"
,
},
{
"id"
:
3
,
"link"
:
`
${
REQUEST_HEADER
}${
SUB_DOMAIN
}
.
${
TOP_DOMAIN
}
/stores`
,
"name"
:
"优选店铺"
,
"status"
:
true
,
"key"
:
"shopPointsMall"
,
},
{
"id"
:
4
,
"link"
:
`
${
REQUEST_HEADER
}${
SUB_DOMAIN
}
.
${
TOP_DOMAIN
}
/integral`
,
"name"
:
"积分商城"
,
"key"
:
"shops"
,
"status"
:
true
,
},
{
"id"
:
5
,
"link"
:
`
${
REQUEST_HEADER
}
info.
${
TOP_DOMAIN
}
`
,
"name"
:
"行情资讯"
,
"status"
:
true
,
"key"
:
"shopInfomation"
,
},
]
}
return
[]
}
src/pages/pageCustomized/platformEdit/index.less
0 → 100644
View file @
ec6f8b6b
@content-height: calc(100vh - 120px);
.wrapper {
background: white;
display: flex;
flex-direction: column;
box-shadow: 2px 0 4px 0 rgba(174, 174, 174, 0.50);
transition: all .3s;
}
.content {
display: flex;
flex: 1;
flex-direction: row;
}
.canvas-container {
display: flex;
flex: 1;
justify-content: center;
background-color: #F4F5F7;
height: calc(@content-height + 50px);
overflow: hidden;
}
\ No newline at end of file
src/pages/pageCustomized/platformEdit/index.tsx
0 → 100644
View file @
ec6f8b6b
import
React
,
{
useEffect
,
useState
}
from
'react'
import
{
LegoProvider
}
from
'lingxi-editor-core'
import
ToolBar
from
'../components/toolBar'
import
DesignPanel
from
'../components/DesignPanel'
import
SettingPanel
from
'../settingsPanel'
import
config
from
'../configs'
import
{
Prompt
}
from
'umi'
import
{
GlobalConfig
}
from
'@/global/config'
import
{
topBarConfig
,
topAdvertConfig
,
headerConfig
,
mainNavConfig
,
bannerContainer
,
quickNavConfigWrap
,
categoryConfig
,
bannerWrap
,
quickNavConfig
,
bannerAdvertConfig
,
interactAdvertConfig
,
navAdvertConfig
,
mallLayoutConfig
,
InformationConfig
,
FooterConfig
}
from
'./defaultData'
import
Loading
from
'../components/Loading'
import
{
LAYOUT_TYPE
}
from
'@/constants'
import
{
getMenuData
}
from
'./defaultMenu'
import
{
PublicApi
}
from
'@/services/api'
import
styles
from
'./index.less'
import
{
isEmpty
}
from
'lodash'
interface
MallEditPropsType
{
location
:
{
query
:
{
/**
* 模板id
*/
id
:
number
;
/**
* 模板名称
*/
template
:
string
;
shopId
:
number
;
}
}
}
const
TemplateList
=
[
'science'
]
const
MallEdit
:
React
.
FC
<
MallEditPropsType
>
=
(
props
)
=>
{
const
{
query
:
{
id
,
template
,
shopId
}
}
=
props
.
location
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
true
)
const
[
theme
,
setTheme
]
=
useState
<
string
>
(
'theme-mall-science'
)
const
[
componentConfigs
,
setComponentConfigs
]
=
useState
({})
useEffect
(()
=>
{
if
(
!
TemplateList
.
includes
(
template
))
{
setTheme
(
`theme-mall-
${
TemplateList
[
0
]}
`
)
}
else
{
setTheme
(
`theme-mall-
${
template
}
`
)
}
getComponentsConfig
()
},
[])
const
findAdvertsByType
=
(
type
:
number
)
=>
{
return
new
Promise
((
resolve
)
=>
{
const
params
:
any
=
{
templateId
:
id
,
type
}
PublicApi
.
getTemplateAdornWebEnterpriseFindAdvertsByType
(
params
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
}
else
{
resolve
([])
}
})
})
}
/**
* 获取所有一级品类信息
*/
const
fetchFirstCategory
=
()
=>
{
return
new
Promise
((
resolve
)
=>
{
PublicApi
.
getTemplateWebCategoryWebFindAllFirstCategory
().
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
}
else
{
resolve
([])
}
})
})
}
/**
* 获取一级品类详细信息
*/
const
fetchCategoryById
=
(
categoryId
)
=>
{
return
new
Promise
((
resolve
)
=>
{
const
param
:
any
=
{
templateId
:
id
,
categoryId
}
PublicApi
.
getTemplateAdornWebEnterpriseCategoryAdorn
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
}
})
})
}
const
fetchNewByLabel
=
(
label
:
string
)
=>
{
// 1-头条文章 2-轮播新闻 3-图片新闻 4-推荐阅读
return
new
Promise
((
resolve
,
reject
)
=>
{
PublicApi
.
getManageContentInformationFindAllByRecommendLabel
({
recommendLabel
:
label
}).
then
((
res
:
{
code
:
number
;
data
:
unknown
})
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
}
else
{
reject
()
}
}).
catch
(()
=>
{
reject
()
})
})
}
/**
* 获取商品品类树
*/
const
getCategoryTree
=
()
=>
{
return
new
Promise
((
resolve
)
=>
{
const
param
:
any
=
{
templateId
:
id
}
PublicApi
.
getTemplateWebCategoryWebFindEnterpriseCategoryTree
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
}
})
})
}
/**
* 获取导航栏菜单数据
*/
const
getMallNavData
=
()
=>
{
return
new
Promise
((
resolve
)
=>
{
const
param
:
any
=
{
templateId
:
id
}
PublicApi
.
getTemplateAdornWebEnterpriseFindColumn
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
}
})
})
}
const
getComponentsConfig
=
async
()
=>
{
// 导航栏
const
navData
=
await
getMallNavData
()
if
(
!
isEmpty
(
navData
))
{
mainNavConfig
[
mainNavConfig
.
key
].
props
.
menuData
=
navData
}
else
{
mainNavConfig
[
mainNavConfig
.
key
].
props
.
menuData
=
getMenuData
(
Number
(
shopId
))
}
// mainNavConfig[mainNavConfig.key].props.type = LAYOUT_TYPE.mall
// mainNavConfig[mainNavConfig.key].props.categoryList = []
categoryConfig
[
categoryConfig
.
key
].
props
.
categoryList
=
await
getCategoryTree
()
// 一号位广告
bannerAdvertConfig
[
bannerAdvertConfig
.
key
].
props
.
advertList
=
await
findAdvertsByType
(
1
)
// 二号位广告
interactAdvertConfig
[
interactAdvertConfig
.
key
].
props
.
advertList
=
await
findAdvertsByType
(
2
)
// 三号位广告
navAdvertConfig
[
navAdvertConfig
.
key
].
props
.
advertList
=
await
findAdvertsByType
(
4
)
const
shopList
=
GlobalConfig
.
web
.
shopInfo
const
webMallInfo
=
shopList
.
filter
(
item
=>
item
.
environment
===
1
&&
item
.
type
===
1
)[
0
]
headerConfig
[
headerConfig
.
key
].
props
.
logoUrl
=
webMallInfo
.
logoUrl
topBarConfig
[
topBarConfig
.
key
].
props
.
shopname
=
webMallInfo
.
name
// 行情资讯
InformationConfig
[
InformationConfig
.
key
].
props
.
newsList
=
await
fetchNewByLabel
(
'4'
)
let
initIndex
=
100
let
floorLineConfig
:
any
=
{}
const
floorLineKeys
:
any
=
[]
const
firstCategory
:
any
=
await
fetchFirstCategory
()
for
(
const
item
of
firstCategory
)
{
const
categoryDetail
:
any
=
await
fetchCategoryById
(
item
.
categoryId
)
let
floorLineConfigItem
=
{}
floorLineKeys
.
push
(
String
(
initIndex
+
1
))
const
FloorLine
=
{
[
String
(
initIndex
+
1
)]:
{
"componentName"
:
"FloorLine"
,
"props"
:
{
title
:
item
.
name
},
"childNodes"
:
[
String
(
initIndex
+
2
),
String
(
initIndex
+
3
)]
}
}
const
Horizontal1
=
{
[
String
(
initIndex
+
2
)]:
{
"componentName"
:
"FloorLine.Horizontal"
,
"props"
:
{},
"childNodes"
:
[
String
(
initIndex
+
4
),
String
(
initIndex
+
5
)]
},
}
const
Brand
=
{
[
String
(
initIndex
+
3
)]:
{
"componentName"
:
"FloorLine.Brand"
,
"props"
:
{
linkdisable
:
true
,
categoryid
:
item
.
id
,
brandList
:
categoryDetail
.
brandBOList
},
},
}
const
Category
=
{
[
String
(
initIndex
+
4
)]:
{
"componentName"
:
"FloorLine.Category"
,
"props"
:
{
linkdisable
:
true
,
categoryid
:
item
.
id
,
categoryAdvertPicUrl
:
categoryDetail
.
categoryAdvertPicUrl
,
secondCategoryList
:
categoryDetail
.
categoryBOList
,
},
},
}
const
Vertical1
=
{
[
String
(
initIndex
+
5
)]:
{
"componentName"
:
"FloorLine.Vertical"
,
"props"
:
{},
"childNodes"
:
[
String
(
initIndex
+
6
),
String
(
initIndex
+
8
)]
},
}
const
FloorHeader
=
{
[
String
(
initIndex
+
6
)]:
{
"componentName"
:
"FloorLine.FloorHeader"
,
"props"
:
{
linkdisable
:
true
,
shopNum
:
categoryDetail
.
shopNum
,
goodsNum
:
categoryDetail
.
goodsNum
},
"childNodes"
:
[
String
(
initIndex
+
7
)]
},
}
const
Banner
=
{
[
String
(
initIndex
+
7
)]:
{
"componentName"
:
"FloorLine.Banner"
,
"props"
:
{
"type"
:
"category"
,
linkdisable
:
true
,
categoryid
:
item
.
id
,
advertList
:
categoryDetail
.
thirdAdvertList
},
},
}
const
Horizontal2
=
{
[
String
(
initIndex
+
8
)]:
{
"componentName"
:
"FloorLine.Horizontal"
,
"props"
:
{},
"childNodes"
:
[
String
(
initIndex
+
9
),
String
(
initIndex
+
10
)]
},
}
const
Goods
=
{
[
String
(
initIndex
+
9
)]:
{
"componentName"
:
"FloorLine.Goods"
,
"props"
:
{
linkdisable
:
true
,
goodsList
:
categoryDetail
.
goodsBOList
,
categoryid
:
item
.
id
,
},
},
}
const
Shops
=
{
[
String
(
initIndex
+
10
)]:
{
"componentName"
:
"FloorLine.Shops"
,
"props"
:
{
linkdisable
:
true
,
shopsList
:
categoryDetail
.
shopBOList
,
categoryid
:
item
.
id
,
},
},
}
floorLineConfigItem
=
{
...
FloorLine
,
...
Horizontal1
,
...
Brand
,
...
Category
,
...
Vertical1
,
...
FloorHeader
,
...
Banner
,
...
Horizontal2
,
...
Goods
,
...
Shops
}
floorLineConfig
=
{
...
floorLineConfig
,
...
floorLineConfigItem
}
initIndex
+=
100
}
mallLayoutConfig
[
"0"
].
childNodes
=
[...
mallLayoutConfig
[
"0"
].
childNodes
,
...
floorLineKeys
,
InformationConfig
.
key
,
FooterConfig
.
key
]
const
config
=
{
...
mallLayoutConfig
,
...
topBarConfig
,
...
topAdvertConfig
,
...
headerConfig
,
...
mainNavConfig
,
...
bannerContainer
,
...
categoryConfig
,
...
bannerWrap
,
...
quickNavConfigWrap
,
...
quickNavConfig
,
...
bannerAdvertConfig
,
...
interactAdvertConfig
,
...
navAdvertConfig
,
...
floorLineConfig
,
...
InformationConfig
,
...
FooterConfig
}
setComponentConfigs
(
config
)
setLoading
(
false
)
}
return
!
loading
?
(
<
LegoProvider
initState=
{
{
componentConfigs
:
componentConfigs
}
}
config=
{
config
}
>
<
Prompt
message=
"你确定要离开么?"
/>
<
div
className=
{
styles
[
'wrapper'
]
}
>
<
ToolBar
/>
<
div
className=
{
styles
[
'content'
]
}
>
<
div
className=
{
styles
[
'canvas-container'
]
}
>
<
DesignPanel
theme=
{
theme
}
/>
</
div
>
</
div
>
</
div
>
<
SettingPanel
templateId=
{
id
}
/>
</
LegoProvider
>
)
:
<
Loading
/>
}
export
default
MallEdit
src/pages/pageCustomized/platformPreview/defaultData.ts
0 → 100644
View file @
ec6f8b6b
export
const
mallLayoutConfig
=
{
key
:
"0"
,
"0"
:
{
"componentName"
:
"MallLayout"
,
"props"
:
{
"style"
:
{
"width"
:
"100%"
,
"minHeight"
:
"100%"
}
},
"childNodes"
:
[
"1"
,
"3"
,
"4"
,
"21"
]
},
}
export
const
topBarConfig
=
{
key
:
"1"
,
"1"
:
{
"componentName"
:
"TopBar"
,
"props"
:
{
linkdisable
:
true
},
}
}
export
const
topAdvertConfig
=
{
key
:
"2"
,
"2"
:
{
"componentName"
:
"Advert"
,
"props"
:
{
"type"
:
"top"
,
"linkdisable"
:
true
,
"advertList"
:
[]
},
},
}
export
const
headerConfig
=
{
key
:
"3"
,
"3"
:
{
"componentName"
:
"Header"
,
"props"
:
{
"logoUrl"
:
""
},
},
}
export
const
mainNavConfig
=
{
key
:
"4"
,
"4"
:
{
"componentName"
:
"MallMainNav"
,
"props"
:
{},
},
}
// < div className = { styles.horizontalWrap } >
// <Category categoryList={ categoryList } />
// < div className = { styles.bannerWrap } >
// {
// useMemo(() => <Advert type="banner" advertList = { firstAdvertList } />, [firstAdvertList])
// }
// {
// useMemo(() => <Advert type="interact" advertList = { secondAdvertList } />, [secondAdvertList])
// }
// </div>
// < div className = { styles.quickNavWrap } >
// <QuickNav
// userInfo={ userInfo }
// userRoles = { userRoles }
// name = { mallInfo?.name }
// advertList = { secondAdvertList }
// />
// </div>
// < /div>
export
const
bannerContainer
=
{
key
:
"21"
,
"21"
:
{
"componentName"
:
"div"
,
"props"
:
{
"style"
:
{
position
:
"relative"
,
display
:
"flex"
,
paddingTop
:
"16px"
,
width
:
"1200px"
,
margin
:
"0 auto"
,
}
},
"childNodes"
:
[
"22"
,
"23"
,
"24"
]
}
}
export
const
categoryConfig
=
{
key
:
"22"
,
"22"
:
{
"componentName"
:
"Category"
,
"props"
:
{
categoryList
:
[],
canHide
:
false
,
}
}
}
export
const
bannerWrap
=
{
key
:
"23"
,
"23"
:
{
"componentName"
:
"div"
,
"props"
:
{
"style"
:
{
margin
:
"0 16px"
,
flex
:
1
,
width
:
0
,
}
},
"childNodes"
:
[
"5"
,
"6"
]
}
}
export
const
quickNavConfigWrap
=
{
key
:
"24"
,
"24"
:
{
"componentName"
:
"div"
,
"props"
:
{},
"childNodes"
:
[
"25"
,
"26"
]
}
}
export
const
quickNavConfig
=
{
key
:
"25"
,
"25"
:
{
"componentName"
:
"QuickNav"
,
"props"
:
{},
}
}
export
const
navAdvertConfig
=
{
key
:
"26"
,
"26"
:
{
"componentName"
:
"Advert"
,
"props"
:
{
"type"
:
"nav"
,
"linkdisable"
:
true
,
"advertList"
:
[]
},
},
}
export
const
bannerAdvertConfig
=
{
key
:
"5"
,
"5"
:
{
"componentName"
:
"Advert"
,
"props"
:
{
"type"
:
"banner"
,
"hasQuickNav"
:
false
,
"linkdisable"
:
true
,
"advertList"
:
[]
}
},
}
export
const
interactAdvertConfig
=
{
key
:
"6"
,
"6"
:
{
"componentName"
:
"Advert"
,
"props"
:
{
"type"
:
"interact"
,
"linkdisable"
:
true
,
"advertList"
:
[]
},
},
}
export
const
FindMoreConfig
=
{
key
:
"18"
,
"18"
:
{
"componentName"
:
"FindMore"
,
"props"
:
{},
},
}
export
const
InformationConfig
=
{
key
:
'19'
,
"19"
:
{
"componentName"
:
"Information"
,
"props"
:
{},
},
}
export
const
FooterConfig
=
{
key
:
'20'
,
"20"
:
{
"componentName"
:
"Footer"
,
"props"
:
{},
},
}
src/pages/pageCustomized/platformPreview/defaultMenu.ts
0 → 100644
View file @
ec6f8b6b
import
{
GlobalConfig
}
from
'@/global/config'
const
siteUrl
=
GlobalConfig
.
site
.
siteInfo
.
siteUrl
/**
* 请求头
*/
export
const
REQUEST_HEADER
=
'http://'
export
const
getTopDomainByHost
=
(
url
:
string
):
string
=>
{
if
(
!
url
)
return
''
return
url
.
split
(
'.'
).
slice
(
-
2
).
join
(
'.'
)
}
export
const
TOP_DOMAIN
=
getTopDomainByHost
(
siteUrl
)
export
const
getMenuData
=
(
shopId
:
number
)
=>
{
const
shopInfo
=
GlobalConfig
.
web
.
shopInfo
const
webMallList
=
shopInfo
.
filter
((
item
:
{
id
:
number
})
=>
item
.
id
===
shopId
)
if
(
webMallList
.
length
>
0
)
{
const
SUB_DOMAIN
=
webMallList
[
0
].
url
return
[
{
"id"
:
0
,
"link"
:
`
${
REQUEST_HEADER
}${
SUB_DOMAIN
}
.
${
TOP_DOMAIN
}
`
,
"name"
:
"商城首页"
,
"status"
:
true
,
"key"
:
"shopHome"
,
},
{
"id"
:
1
,
"link"
:
`
${
REQUEST_HEADER
}${
SUB_DOMAIN
}
.
${
TOP_DOMAIN
}
/commodity`
,
"name"
:
"现货商品"
,
"status"
:
true
,
"key"
:
"shopCommodity"
,
},
{
"id"
:
2
,
"link"
:
`
${
REQUEST_HEADER
}${
SUB_DOMAIN
}
.
${
TOP_DOMAIN
}
/inquiry`
,
"name"
:
"询价商品"
,
"status"
:
true
,
"key"
:
"purchaseOnline"
,
},
{
"id"
:
3
,
"link"
:
`
${
REQUEST_HEADER
}${
SUB_DOMAIN
}
.
${
TOP_DOMAIN
}
/stores`
,
"name"
:
"优选店铺"
,
"status"
:
true
,
"key"
:
"shopPointsMall"
,
},
{
"id"
:
4
,
"link"
:
`
${
REQUEST_HEADER
}${
SUB_DOMAIN
}
.
${
TOP_DOMAIN
}
/integral`
,
"name"
:
"积分商城"
,
"key"
:
"shops"
,
"status"
:
true
,
},
{
"id"
:
5
,
"link"
:
`
${
REQUEST_HEADER
}
info.
${
TOP_DOMAIN
}
`
,
"name"
:
"行情资讯"
,
"status"
:
true
,
"key"
:
"shopInfomation"
,
},
]
}
return
[]
}
src/pages/pageCustomized/platformPreview/index.less
0 → 100644
View file @
ec6f8b6b
@content-height: calc(100vh - 120px);
.wrapper {
background: white;
display: flex;
flex-direction: column;
box-shadow: 2px 0 4px 0 rgba(174, 174, 174, 0.50);
transition: all .3s;
}
.content {
display: flex;
flex: 1;
flex-direction: row;
}
.canvas-container {
display: flex;
flex: 1;
justify-content: center;
background-color: #F4F5F7;
height: calc(@content-height + 50px);
overflow: hidden;
}
\ No newline at end of file
src/pages/pageCustomized/platformPreview/index.tsx
0 → 100644
View file @
ec6f8b6b
import
React
,
{
useEffect
,
useState
}
from
'react'
import
{
LegoProvider
}
from
'lingxi-editor-core'
import
ToolBar
from
'../components/toolBar'
import
DesignPanel
from
'../components/DesignPanel'
import
SettingPanel
from
'../settingsPanel'
import
config
from
'../configs'
import
{
Prompt
}
from
'umi'
import
{
GlobalConfig
}
from
'@/global/config'
import
{
topBarConfig
,
topAdvertConfig
,
headerConfig
,
mainNavConfig
,
bannerContainer
,
quickNavConfigWrap
,
categoryConfig
,
bannerWrap
,
quickNavConfig
,
bannerAdvertConfig
,
interactAdvertConfig
,
navAdvertConfig
,
mallLayoutConfig
,
InformationConfig
,
FooterConfig
}
from
'./defaultData'
import
Loading
from
'../components/Loading'
import
{
LAYOUT_TYPE
}
from
'@/constants'
import
{
getMenuData
}
from
'./defaultMenu'
import
{
PublicApi
}
from
'@/services/api'
import
styles
from
'./index.less'
import
{
isEmpty
}
from
'lodash'
interface
MallEditPropsType
{
location
:
{
query
:
{
/**
* 模板id
*/
id
:
number
;
/**
* 模板名称
*/
template
:
string
;
shopId
:
number
;
}
}
}
const
TemplateList
=
[
'science'
]
const
MallEdit
:
React
.
FC
<
MallEditPropsType
>
=
(
props
)
=>
{
const
{
query
:
{
id
,
template
,
shopId
}
}
=
props
.
location
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
true
)
const
[
theme
,
setTheme
]
=
useState
<
string
>
(
'theme-mall-science'
)
const
[
componentConfigs
,
setComponentConfigs
]
=
useState
({})
useEffect
(()
=>
{
if
(
!
TemplateList
.
includes
(
template
))
{
setTheme
(
`theme-mall-
${
TemplateList
[
0
]}
`
)
}
else
{
setTheme
(
`theme-mall-
${
template
}
`
)
}
getComponentsConfig
()
},
[])
const
findAdvertsByType
=
(
type
:
number
)
=>
{
return
new
Promise
((
resolve
)
=>
{
const
params
:
any
=
{
templateId
:
id
,
type
}
PublicApi
.
getTemplateAdornWebEnterpriseFindAdvertsByType
(
params
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
}
else
{
resolve
([])
}
})
})
}
/**
* 获取所有一级品类信息
*/
const
fetchFirstCategory
=
()
=>
{
return
new
Promise
((
resolve
)
=>
{
PublicApi
.
getTemplateWebCategoryWebFindAllFirstCategory
().
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
}
else
{
resolve
([])
}
})
})
}
/**
* 获取一级品类详细信息
*/
const
fetchCategoryById
=
(
categoryId
)
=>
{
return
new
Promise
((
resolve
)
=>
{
const
param
:
any
=
{
templateId
:
id
,
categoryId
}
PublicApi
.
getTemplateAdornWebEnterpriseCategoryAdorn
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
}
})
})
}
const
fetchNewByLabel
=
(
label
:
string
)
=>
{
// 1-头条文章 2-轮播新闻 3-图片新闻 4-推荐阅读
return
new
Promise
((
resolve
,
reject
)
=>
{
PublicApi
.
getManageContentInformationFindAllByRecommendLabel
({
recommendLabel
:
label
}).
then
((
res
:
{
code
:
number
;
data
:
unknown
})
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
}
else
{
reject
()
}
}).
catch
(()
=>
{
reject
()
})
})
}
/**
* 获取商品品类树
*/
const
getCategoryTree
=
()
=>
{
return
new
Promise
((
resolve
)
=>
{
const
param
:
any
=
{
templateId
:
id
}
PublicApi
.
getTemplateWebCategoryWebFindEnterpriseCategoryTree
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
}
})
})
}
/**
* 获取导航栏菜单数据
*/
const
getMallNavData
=
()
=>
{
return
new
Promise
((
resolve
)
=>
{
const
param
:
any
=
{
templateId
:
id
}
PublicApi
.
getTemplateAdornWebEnterpriseFindColumn
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
}
})
})
}
const
getComponentsConfig
=
async
()
=>
{
// 导航栏
const
navData
=
await
getMallNavData
()
if
(
!
isEmpty
(
navData
))
{
mainNavConfig
[
mainNavConfig
.
key
].
props
.
menuData
=
navData
}
else
{
mainNavConfig
[
mainNavConfig
.
key
].
props
.
menuData
=
getMenuData
(
Number
(
shopId
))
}
// mainNavConfig[mainNavConfig.key].props.type = LAYOUT_TYPE.mall
// mainNavConfig[mainNavConfig.key].props.categoryList = []
categoryConfig
[
categoryConfig
.
key
].
props
.
categoryList
=
await
getCategoryTree
()
// 一号位广告
bannerAdvertConfig
[
bannerAdvertConfig
.
key
].
props
.
advertList
=
await
findAdvertsByType
(
1
)
// 二号位广告
interactAdvertConfig
[
interactAdvertConfig
.
key
].
props
.
advertList
=
await
findAdvertsByType
(
2
)
// 三号位广告
navAdvertConfig
[
navAdvertConfig
.
key
].
props
.
advertList
=
await
findAdvertsByType
(
4
)
const
shopList
=
GlobalConfig
.
web
.
shopInfo
const
webMallInfo
=
shopList
.
filter
(
item
=>
item
.
environment
===
1
&&
item
.
type
===
1
)[
0
]
headerConfig
[
headerConfig
.
key
].
props
.
logoUrl
=
webMallInfo
.
logoUrl
topBarConfig
[
topBarConfig
.
key
].
props
.
shopname
=
webMallInfo
.
name
// 行情资讯
InformationConfig
[
InformationConfig
.
key
].
props
.
newsList
=
await
fetchNewByLabel
(
'4'
)
let
initIndex
=
100
let
floorLineConfig
:
any
=
{}
const
floorLineKeys
:
any
=
[]
const
firstCategory
:
any
=
await
fetchFirstCategory
()
for
(
const
item
of
firstCategory
)
{
const
categoryDetail
:
any
=
await
fetchCategoryById
(
item
.
categoryId
)
let
floorLineConfigItem
=
{}
floorLineKeys
.
push
(
String
(
initIndex
+
1
))
const
FloorLine
=
{
[
String
(
initIndex
+
1
)]:
{
"componentName"
:
"FloorLine"
,
"props"
:
{
title
:
item
.
name
},
"childNodes"
:
[
String
(
initIndex
+
2
),
String
(
initIndex
+
3
)]
}
}
const
Horizontal1
=
{
[
String
(
initIndex
+
2
)]:
{
"componentName"
:
"FloorLine.Horizontal"
,
"props"
:
{},
"childNodes"
:
[
String
(
initIndex
+
4
),
String
(
initIndex
+
5
)]
},
}
const
Brand
=
{
[
String
(
initIndex
+
3
)]:
{
"componentName"
:
"FloorLine.Brand"
,
"props"
:
{
linkdisable
:
true
,
categoryid
:
item
.
id
,
brandList
:
categoryDetail
.
brandBOList
},
},
}
const
Category
=
{
[
String
(
initIndex
+
4
)]:
{
"componentName"
:
"FloorLine.Category"
,
"props"
:
{
linkdisable
:
true
,
categoryid
:
item
.
id
,
categoryAdvertPicUrl
:
categoryDetail
.
categoryAdvertPicUrl
,
secondCategoryList
:
categoryDetail
.
categoryBOList
,
},
},
}
const
Vertical1
=
{
[
String
(
initIndex
+
5
)]:
{
"componentName"
:
"FloorLine.Vertical"
,
"props"
:
{},
"childNodes"
:
[
String
(
initIndex
+
6
),
String
(
initIndex
+
8
)]
},
}
const
FloorHeader
=
{
[
String
(
initIndex
+
6
)]:
{
"componentName"
:
"FloorLine.FloorHeader"
,
"props"
:
{
linkdisable
:
true
,
shopNum
:
categoryDetail
.
shopNum
,
goodsNum
:
categoryDetail
.
goodsNum
},
"childNodes"
:
[
String
(
initIndex
+
7
)]
},
}
const
Banner
=
{
[
String
(
initIndex
+
7
)]:
{
"componentName"
:
"FloorLine.Banner"
,
"props"
:
{
"type"
:
"category"
,
linkdisable
:
true
,
categoryid
:
item
.
id
,
advertList
:
categoryDetail
.
thirdAdvertList
},
},
}
const
Horizontal2
=
{
[
String
(
initIndex
+
8
)]:
{
"componentName"
:
"FloorLine.Horizontal"
,
"props"
:
{},
"childNodes"
:
[
String
(
initIndex
+
9
),
String
(
initIndex
+
10
)]
},
}
const
Goods
=
{
[
String
(
initIndex
+
9
)]:
{
"componentName"
:
"FloorLine.Goods"
,
"props"
:
{
linkdisable
:
true
,
goodsList
:
categoryDetail
.
goodsBOList
,
categoryid
:
item
.
id
,
},
},
}
const
Shops
=
{
[
String
(
initIndex
+
10
)]:
{
"componentName"
:
"FloorLine.Shops"
,
"props"
:
{
linkdisable
:
true
,
shopsList
:
categoryDetail
.
shopBOList
,
categoryid
:
item
.
id
,
},
},
}
floorLineConfigItem
=
{
...
FloorLine
,
...
Horizontal1
,
...
Brand
,
...
Category
,
...
Vertical1
,
...
FloorHeader
,
...
Banner
,
...
Horizontal2
,
...
Goods
,
...
Shops
}
floorLineConfig
=
{
...
floorLineConfig
,
...
floorLineConfigItem
}
initIndex
+=
100
}
mallLayoutConfig
[
"0"
].
childNodes
=
[...
mallLayoutConfig
[
"0"
].
childNodes
,
...
floorLineKeys
,
InformationConfig
.
key
,
FooterConfig
.
key
]
const
config
=
{
...
mallLayoutConfig
,
...
topBarConfig
,
...
topAdvertConfig
,
...
headerConfig
,
...
mainNavConfig
,
...
bannerContainer
,
...
categoryConfig
,
...
bannerWrap
,
...
quickNavConfigWrap
,
...
quickNavConfig
,
...
bannerAdvertConfig
,
...
interactAdvertConfig
,
...
navAdvertConfig
,
...
floorLineConfig
,
...
InformationConfig
,
...
FooterConfig
}
setComponentConfigs
(
config
)
setLoading
(
false
)
}
return
!
loading
?
(
<
LegoProvider
initState=
{
{
componentConfigs
:
componentConfigs
}
}
config=
{
config
}
>
<
Prompt
message=
"你确定要离开么?"
/>
<
div
className=
{
styles
[
'wrapper'
]
}
>
<
ToolBar
/>
<
div
className=
{
styles
[
'content'
]
}
>
<
div
className=
{
styles
[
'canvas-container'
]
}
>
<
DesignPanel
theme=
{
theme
}
/>
</
div
>
</
div
>
</
div
>
<
SettingPanel
templateId=
{
id
}
/>
</
LegoProvider
>
)
:
<
Loading
/>
}
export
default
MallEdit
src/pages/pageCustomized/platformTemplate/index.less
0 → 100644
View file @
ec6f8b6b
.shop_center_template {
.add_card {
display: flex;
height: 100%;
border-radius: 2px;
border: 1px dashed rgba(223, 225, 230, 1);
background: rgba(250, 251, 252, 1);
align-items: center;
justify-content: center;
cursor: pointer;
flex-direction: column;
&:hover {
border: 1px dashed rgba(200, 200, 230, 1);
}
.add_card_btn {
display: flex;
justify-content: center;
align-items: center;
width: 48px;
height: 48px;
background: rgba(235, 236, 240, 1);
border-radius: 50%;
margin-bottom: 24px;
font-size: 22px;
color: #C0C4CC;
}
&>p {
color: #909399;
}
}
}
\ No newline at end of file
src/pages/pageCustomized/platformTemplate/index.tsx
0 → 100644
View file @
ec6f8b6b
import
React
,
{
useState
,
useEffect
}
from
'react'
import
{
Row
,
Col
}
from
'antd'
import
TemplateItem
from
'../components/templateItem'
import
{
inject
}
from
'mobx-react'
import
{
PublicApi
}
from
'@/services/api'
import
{
TEMPLATE_TYPE
}
from
'@/constants'
import
{
GetTemplateWebPageTemplateWebFindAllTemplateByTypeResponse
}
from
'@/services/TemplateApi'
import
styles
from
'./index.less'
interface
ShopCenterTemplatePropsType
{
SiteStore
:
any
}
const
ShopCenterTemplate
:
React
.
FC
<
ShopCenterTemplatePropsType
>
=
(
props
)
=>
{
const
{
SiteStore
:
{
siteId
}
}
=
props
const
[
templateList
,
setTemplateList
]
=
useState
<
GetTemplateWebPageTemplateWebFindAllTemplateByTypeResponse
>
([])
useEffect
(()
=>
{
const
prarm
:
any
=
{
type
:
TEMPLATE_TYPE
.
platform
,
siteId
}
PublicApi
.
getTemplateWebPageTemplateWebFindAllTemplateByType
(
prarm
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setTemplateList
(
res
.
data
)
}
})
},
[])
return
(
<
div
className=
{
styles
.
shop_center_template
}
>
<
Row
gutter=
{
24
}
className=
{
styles
.
template_list
}
>
{
templateList
.
map
(
item
=>
(
<
Col
xxl=
{
6
}
xl=
{
8
}
lg=
{
12
}
key=
{
item
.
id
}
>
<
TemplateItem
templateInfo=
{
item
}
type=
"mall"
/>
</
Col
>
))
}
</
Row
>
</
div
>
)
}
export
default
inject
(
'SiteStore'
)(
ShopCenterTemplate
)
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