Commit 6bd44272 authored by GuanHua's avatar GuanHua

fix: 店铺能力装修路由修改

parent 4511c8b8
...@@ -37,31 +37,6 @@ const router = [ ...@@ -37,31 +37,6 @@ const router = [
} }
] ]
}, },
{
// web渠道商城模板装修
path: '/channel/template/edit',
component: '@/pages/editor/channelEdit',
},
{
// web店铺模板装修
path: '/shop/template/edit',
component: '@/pages/editor/shopEdit',
},
{
// web渠道商城模板预览
path: '/channel/template/preview',
component: '@/pages/preview/channelPreview',
},
{
// web店铺模板预览
path: '/shop/template/preview',
component: '@/pages/preview/shopPreview',
},
{
// app店铺模板装修
path: '/mobile/shop/template/edit',
component: '@/pages/mobileTemplate/shopTemplateEdit',
},
memberCenterRoute, memberCenterRoute,
...mallRoute, ...mallRoute,
{ {
......
...@@ -151,7 +151,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => { ...@@ -151,7 +151,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
} }
: {} : {}
return ( return currentRouter.noLayout ? props.children : (
<ProLayout <ProLayout
pageTitleRender={() => currentRouter ? currentRouter.name : window.location.href} pageTitleRender={() => currentRouter ? currentRouter.name : window.location.href}
// contentStyle={{minWidth: '1280px'}} // contentStyle={{minWidth: '1280px'}}
......
...@@ -56,12 +56,12 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => { ...@@ -56,12 +56,12 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
} }
const handleLinkEdit = () => { const handleLinkEdit = () => {
window.location.href = `/channel/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}` window.location.href = `/memberCenter/channelAbility/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}`
// history.push(`/channel/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}`) // history.push(`/channel/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}`)
} }
const handleLinkPreview = () => { const handleLinkPreview = () => {
window.location.href = `/channel/template/preview?id=${detailInfo.id}&template=${detailInfo.fileName}` window.location.href = `/memberCenter/channelAbility/template/preview?id=${detailInfo.id}&template=${detailInfo.fileName}`
} }
......
import { PROPS_TYPES } from 'lingxi-editor-core'
export const mallLayoutConfig = {
key: "0",
"0": {
"componentName": "MallLayout",
"props": {
"style": {
"width": "100%",
"minHeight": "100%",
"background": "#F7F8FA",
"overflowX": "hidden",
"paddingBottom": "50px",
}
},
"childNodes": ["1", "2", "5"]
},
}
export const mobileShopHeaderNav = {
key: "1",
"1": {
"componentName": "MobileShopHeaderNav",
"componentType": PROPS_TYPES.mobileShopHeaderNav,
"title": "背景图编辑",
"canEdit": true,
"canHide": false,
"props": {
"shopInfo": {
memberName: "温州市龙昌皮业有限公司",
logo: "https://shushangyun-lingxi.oss-cn-shenzhen.aliyuncs.com/f60693caed3f47868e5897bd1ccf40ea1610331248766.png",
creditPoint: 998,
registerYears: 2,
avgTradeCommentStar: 3,
}
},
}
}
export const divWrap = {
key: "2",
"2": {
"componentName": "div",
"props": {
"style": {
position: "relative",
marginTop: -24,
backgroundColor: "#FFF",
borderTopLeftRadius: '16px',
borderTopRightRadius: '16px',
zIndex: 6,
padding: '2px 4px',
}
},
"childNodes": ["3", "4"]
}
}
export const mobileBanner = {
key: "3",
"3": {
"componentName": "MobileBanner",
"componentType": PROPS_TYPES.mobileBanner,
"title": "轮播广告",
"canEdit": true,
"canHide": false,
"props": {
dataList: []
}
}
}
export const mobileQuickNav = {
key: "4",
"4": {
"componentName": "MobileQuickNav",
"componentType": PROPS_TYPES.mobileQuickNav,
"title": "导航模块",
"canEdit": true,
"canHide": false,
"props": {
dataList: [
{
"id":1,
"expand":false,
"icon":"https://shushangyun-lingxi.oss-cn-shenzhen.aliyuncs.com/c5d66f1488cc47d0a73279ce1ef11c991610677462848.png",
"type":1,
"name":"商城",
"url":""
},
{
"id":2,
"expand":false,
"icon":"https://shushangyun-lingxi.oss-cn-shenzhen.aliyuncs.com/9f105bdebcfb4010b5827f7b64fb53281610696444606.png",
"type":2,
"name":"分类",
"url":""
},
{
"id":3,
"expand":false,
"icon":"https://shushangyun-lingxi.oss-cn-shenzhen.aliyuncs.com/d4383c684c6e4707b405f46f281796d71610696469970.png",
"type":3,
"name":"积分兑换",
"url":""
},
{
"id":4,
"expand":false,
"icon":"https://shushangyun-lingxi.oss-cn-shenzhen.aliyuncs.com/d4383c684c6e4707b405f46f281796d71610696469970.png",
"type":4,
"name":"公司介绍",
"url":""
},
{
"id":5,
"expand":false,
"icon":"https://shushangyun-lingxi.oss-cn-shenzhen.aliyuncs.com/441a66ebeb3b45e6a64ecfa9977f411c1610696489991.png",
"type":5,
"name":"成为会员",
"url":""
},
]
}
}
}
export const mobileShopCommodityList = {
key: "5",
"5": {
"componentName": "MobileShopCommodityList",
"componentType": PROPS_TYPES.mobileShopCommodity,
"title": "商品推荐",
"canEdit": true,
"canHide": false,
"props": {
"dataList": [
{
categoryId: 1,
categoryName: "灯光照明",
categoryImage: "https://shushangyun-lingxi.oss-cn-shenzhen.aliyuncs.com/19466a6f8a5448c5b1a2011f642126611610677625949.png",
productList: [
{
id: 11,
name: '三级抗震螺纹钢 HRB400E 25*12三钢',
sellPoints: ["硬度适中偏软", "手感舒适"],
min: 79,
unitName: "吨",
sold: 3133,
mainPic: "https://shushangyun-lingxi.oss-cn-shenzhen.aliyuncs.com/19466a6f8a5448c5b1a2011f642126611610677625949.png"
},
{
id: 12,
name: '三级抗震螺纹钢 HRB400E 25*12三钢',
sellPoints: ["硬度适中偏软", "手感舒适"],
min: 79,
unitName: "吨",
sold: 3133,
mainPic: "https://shushangyun-lingxi.oss-cn-shenzhen.aliyuncs.com/19466a6f8a5448c5b1a2011f642126611610677625949.png"
},
{
id: 13,
name: '三级抗震螺纹钢 HRB400E 25*12三钢',
sellPoints: ["硬度适中偏软", "手感舒适"],
min: 79,
unitName: "吨",
sold: 3133,
mainPic: "https://shushangyun-lingxi.oss-cn-shenzhen.aliyuncs.com/19466a6f8a5448c5b1a2011f642126611610677625949.png"
},
{
id: 14,
name: '三级抗震螺纹钢 HRB400E 25*12三钢',
sellPoints: ["硬度适中偏软", "手感舒适"],
min: 79,
unitName: "吨",
sold: 3133,
mainPic: "https://shushangyun-lingxi.oss-cn-shenzhen.aliyuncs.com/19466a6f8a5448c5b1a2011f642126611610677625949.png"
}
]
},
{
categoryId: 2,
categoryName: "灯光照明",
categoryImage: "https://shushangyun-lingxi.oss-cn-shenzhen.aliyuncs.com/19466a6f8a5448c5b1a2011f642126611610677625949.png",
productList: [
{
id: 21,
name: '四级抗震螺纹钢 HRB400E 25*12三钢',
sellPoints: ["硬度适中偏软"],
min: 79,
unitName: "吨",
sold: 3133,
mainPic: "https://shushangyun-lingxi.oss-cn-shenzhen.aliyuncs.com/19466a6f8a5448c5b1a2011f642126611610677625949.png"
},
{
id: 22,
name: '三级抗震螺纹钢 HRB400E 25*12三钢',
sellPoints: ["硬度适中偏软", "手感舒适"],
min: 79,
unitName: "吨",
sold: 3133,
mainPic: "https://shushangyun-lingxi.oss-cn-shenzhen.aliyuncs.com/19466a6f8a5448c5b1a2011f642126611610677625949.png"
}
]
}
]
}
}
}
@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;
justify-content: center;
background-color: #F2F3F5;
height: calc(100vh - 64px);
}
.app-wrapper {
display: flex;
flex: 1;
justify-content: center;
}
.app-canvas-container {
display: flex;
width: 381px;
margin-top: 40px;
margin-bottom: 52px;
justify-content: center;
background-color: #F4F5F7;
// height: calc(@content-height + 50px);
overflow: hidden;
}
.loading_wrap {
width: 100%;
height: 100vh;
justify-content: center;
flex-direction: column;
display: flex;
align-items: center;
.loading_text {
margin-top: 16px;
font-size: 14px;
font-weight: bold;
}
}
/*
* @Author: ghua
* @Date: 2021-01-14 17:03:08
* @Last Modified by: ghua
* @Last Modified time: 2021-01-15 17:47:38
* @Description 店铺主页装修
*/
import React, { useEffect, useState } from 'react'
import { LegoProvider } from 'lingxi-editor-core'
import ToolBar from '../../editor/components/toolBar'
import MobileDesignPanel from '../../editor/components/MobileDesignPanel'
import AllComponents from '../../editor/components/ComponentsPreview'
import { message } from 'antd'
import config from '../../editor/configs'
import {
mallLayoutConfig,
divWrap,
mobileShopHeaderNav,
mobileBanner,
mobileQuickNav,
mobileShopCommodityList,
} from './config'
import Loading from '../../editor/components/Loading'
import { PublicApi } from '@/services/api'
import { LAYOUT_TYPE } from '@/constants'
import { GetTemplateAdornAppStoreFindResponse, GetTemplateWebMemberShopWebFindByMemberIdAndRoleIdResponse } from '@/services/TemplateApi'
// import { GlobalConfig } from '@/global/config'
import MobileSettingPanel from '../../editor/mobileSettingPanel'
import { getAuth } from '@/utils/auth'
import styles from './index.less'
interface ShopPreviewPropsType {
location: {
query: {
/**
* 模板id
*/
id: number;
/**
* 模板名称
*/
template: string;
}
}
}
const TemplateList = ['science']
const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
const { query: { id, template } } = props.location
const [loading, setLoading] = useState<boolean>(true)
const [theme, setTheme] = useState<string>('theme-mall-science')
const [componentConfigs, setComponentConfigs] = useState({})
const { memberId, memberRoleId } = getAuth() || {}
useEffect(() => {
if (!TemplateList.includes(template)) {
setTheme(`theme-mall-${TemplateList[0]}`)
} else {
setTheme(`theme-mall-${template}`)
}
getComponentsConfig()
}, [])
/**
* 获取店铺信息
*/
const fetchShopInfo = (): Promise<GetTemplateWebMemberShopWebFindByMemberIdAndRoleIdResponse> => {
return new Promise((resolve) => {
const param: any = {
memberId,
roleId: memberRoleId
}
PublicApi.getTemplateWebMemberShopWebFindByMemberIdAndRoleId(param).then(res => {
if (res.code === 1000) {
if (res.code === 1000) {
resolve(res.data)
}
}
})
})
}
/**
* 获取app店铺装修信息
*/
const getAppShopConfig = (): Promise<GetTemplateAdornAppStoreFindResponse | null> => {
return new Promise((resolve, reject) => {
const param: any = {
templateId: id
}
PublicApi.getTemplateAdornAppStoreFind(param).then(res => {
if(res.code === 1000) {
resolve(res.data)
} else {
reject(res)
}
}).catch((eror) => {
reject(eror)
})
})
}
const getRecommendShopList = (param) => {
return new Promise((resolve, reject) => {
PublicApi.getTemplateWebMemberShopWebRecommendList(param).then(res => {
if(res.code === 1000) {
resolve(res.data.data)
} else {
reject(false)
}
}).catch((eror) => {
reject(false)
})
})
}
const getStoreBOList = (dataList) => {
if(dataList) {
const res = dataList.map(item => {
item.selectId = item.id
item.name = item.memberName
item.selectInfo = Object.assign({}, item)
return item
})
return res
} else {
return []
}
}
/**
* 根据选中的类型和id获取信息
* @param data
*/
const getSelectInfo = (data): Promise<any[] | undefined> => {
return new Promise((resolve) => {
let getFn: any = null
const param: any = {
current: 1,
pageSize: 100,
}
switch(data.type) {
case 1:
param.idInList = data.recommend
getFn = PublicApi.postSearchMobileShopEnterpriseGetCommodityList
break
case 2:
param.idList = data.recommend
getFn = PublicApi.getTemplateWebMemberShopWebRecommendList
break
case 3:
param.idList = data.recommend
getFn = PublicApi.postSearchMobileShopEnterpriseGetCategoryBrand
break
case 4:
param.idList = data.recommend
getFn = PublicApi.getManageContentInformationPageByIdIn
break
default:
break
}
getFn ? getFn(param).then(res => {
message.destroy()
resolve(data.type === 3 ? res.data : res.data.data)
}).catch(() => {
resolve(undefined)
}) : resolve(undefined)
})
}
const getExcellentDetailsBO = async (dataList) => {
if(dataList) {
const newRes: any = []
for(const item of dataList) {
const temp = { ...item }
temp.recommendList = await getSelectInfo(item)
newRes.push(temp)
}
console.log(newRes, 'newRes')
return newRes
} else {
return []
}
}
const changeData = (dataList) => {
if(dataList) {
return dataList.map((dataItem) => {
return {
categoryId: dataItem.id,
categoryName: dataItem.name,
categoryImage: dataItem.imageUrl || "",
productList: dataItem.commodityResponseList ? dataItem.commodityResponseList.map((commodityItem) => {
return {
id: commodityItem.id,
name: commodityItem.name,
sellPoints: commodityItem.sellingPoint,
min: commodityItem.min,
unitName: commodityItem.unitName,
sold: commodityItem.sold,
mainPic: commodityItem.mainPic,
}
}) : []
}
})
}
return []
}
/**
* 根据商品id,查询商品根据分类的列表
* @param idList
*/
const fetchCategoryByCommodityId = (idList: number[]) => {
return new Promise((resolve) => {
const param = {
idList
}
PublicApi.postSearchMobileShopStoreGetCategoryByCommodityId(param).then((res) => {
message.destroy()
if (res.code === 1000) {
resolve(changeData(res.data))
} else {
resolve([])
}
}).catch(() => {
resolve([])
})
})
}
const getComponentsConfig = async () => {
try {
const appConfig = await getAppShopConfig()
console.log(appConfig, "appConfig")
//店铺信息
const shopInfo = await fetchShopInfo()
mobileShopHeaderNav[mobileShopHeaderNav.key].props.shopInfo = shopInfo
if(appConfig?.backdropBO) {
mobileShopHeaderNav[mobileShopHeaderNav.key].props.backdrop = appConfig?.backdropBO.backdrop
}
if(appConfig?.advertBO) {
mobileBanner[mobileBanner.key].props.dataList = appConfig?.advertBO.advertDetailsBOList
}
if(appConfig?.functionBO) {
mobileQuickNav[mobileQuickNav.key].props.dataList = appConfig?.functionBO.functionDetailsBO
}
if(appConfig?.productBO) {
const dataList = await fetchCategoryByCommodityId(appConfig.productBO.productIdList)
mobileShopCommodityList[mobileShopCommodityList.key].props = {
storeId: shopInfo.id,
title: appConfig.productBO.title,
productIdList: appConfig.productBO.productIdList,
dataList,
}
} else {
mobileShopCommodityList[mobileShopCommodityList.key].props.storeId = shopInfo.id
mobileShopCommodityList[mobileShopCommodityList.key].props.title = '热销商品'
}
const config = {
...mallLayoutConfig,
...mobileShopHeaderNav,
...divWrap,
...mobileBanner,
...mobileQuickNav,
...mobileShopCommodityList,
}
setComponentConfigs(config)
setLoading(false)
} catch (error) {
console.log(error)
}
}
return !loading ? (
<LegoProvider initState={{ componentConfigs: componentConfigs }} config={config}>
<div className={styles['wrapper']}>
<ToolBar type={1} title="店铺主页" showActions={true} layoutType={LAYOUT_TYPE.shop} templateId={id} />
<div className={styles['content']}>
<AllComponents />
<div className={styles['app-wrapper']}>
<div className={styles['app-canvas-container']}>
<MobileDesignPanel theme={theme} />
</div>
</div>
<MobileSettingPanel />
</div>
</div>
</LegoProvider>
) : <Loading />
}
export default mobileShopTempleteEdit
...@@ -367,7 +367,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => { ...@@ -367,7 +367,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
<UploadImage <UploadImage
imgUrl={""} imgUrl={""}
large={true} large={true}
fileMaxSize={100} fileMaxSize={400}
size="600x400" size="600x400"
onChange={(url) => handleAddworkshopPics(url)} onChange={(url) => handleAddworkshopPics(url)}
/> />
...@@ -392,7 +392,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => { ...@@ -392,7 +392,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
<UploadImage <UploadImage
imgUrl={""} imgUrl={""}
large={true} large={true}
fileMaxSize={100} fileMaxSize={400}
size="106x107" size="106x107"
onChange={(url) => handleAddhonorPics(url)} onChange={(url) => handleAddhonorPics(url)}
/> />
......
...@@ -60,17 +60,17 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => { ...@@ -60,17 +60,17 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
const handleLinkEdit = () => { const handleLinkEdit = () => {
if(detailInfo?.environment === 1) { if(detailInfo?.environment === 1) {
// web店铺装修 // web店铺装修
window.location.href = `/shop/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}` window.location.href = `/memberCenter/shopAbility/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}`
} else if(detailInfo?.environment === 4) { } else if(detailInfo?.environment === 4) {
// app店铺装修 // app店铺装修
window.location.href = `/mobile/shop/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}` window.location.href = `/memberCenter/shopAbility/template/mobile/edit?id=${detailInfo.id}&template=${detailInfo.fileName}`
} else { } else {
message.info("暂不支持该类型模板装修") message.info("暂不支持该类型模板装修")
} }
} }
const handleLinkPreview = () => { const handleLinkPreview = () => {
window.location.href = `/shop/template/preview?id=${detailInfo.id}&template=${detailInfo.fileName}` window.location.href = `/memberCenter/shopAbility/template/preview?id=${detailInfo.id}&template=${detailInfo.fileName}`
} }
return ( return (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment