Commit 6932d66a authored by GuanHua's avatar GuanHua

fix: 自营商城导航装修问题修复

parent ac2bf23f
import React from 'react'; import React from 'react';
import { PageConfigType } from '@linkseeks/design-core'; import { PageConfigType } from '@linkseeks/design-core';
import { BrickDesign } from '@linkseeks/design-react'; import { BrickDesign } from '@linkseeks/design-react';
import { getLocale } from 'umi'
interface DesignPanelPropsType { interface DesignPanelPropsType {
pageConfig: PageConfigType, pageConfig: PageConfigType,
...@@ -11,8 +12,11 @@ interface DesignPanelPropsType { ...@@ -11,8 +12,11 @@ interface DesignPanelPropsType {
const DesignPanel: React.FC<DesignPanelPropsType> = (props) => { const DesignPanel: React.FC<DesignPanelPropsType> = (props) => {
const { pageConfig, theme, pageName = 'index', onlyEidt } = props; const { pageConfig, theme, pageName = 'index', onlyEidt } = props;
const locale = getLocale()
return <BrickDesign return <BrickDesign
pageName={pageName} pageName={pageName}
locale={locale}
initState={{ pageConfig }} initState={{ pageConfig }}
themeName={theme} themeName={theme}
onlyEidt={onlyEidt} onlyEidt={onlyEidt}
......
import React from 'react'; import React from 'react';
import { PageConfigType } from '@linkseeks/design-core'; import { PageConfigType } from '@linkseeks/design-core';
import { BrickPreview } from '@linkseeks/design-react'; import { BrickPreview } from '@linkseeks/design-react';
import { getLocale } from 'umi'
interface DesignPanelPropsType { interface DesignPanelPropsType {
pageConfig: PageConfigType, pageConfig: PageConfigType,
...@@ -11,8 +12,11 @@ interface DesignPanelPropsType { ...@@ -11,8 +12,11 @@ interface DesignPanelPropsType {
const DesignPanel: React.FC<DesignPanelPropsType> = (props) => { const DesignPanel: React.FC<DesignPanelPropsType> = (props) => {
const { pageConfig, theme, pageName = 'index', onlyEidt } = props; const { pageConfig, theme, pageName = 'index', onlyEidt } = props;
const locale = getLocale()
return <BrickPreview return <BrickPreview
pageName={pageName} pageName={pageName}
locale={locale}
initState={{ pageConfig }} initState={{ pageConfig }}
themeName={theme} themeName={theme}
onlyEidt={onlyEidt} onlyEidt={onlyEidt}
......
import { ComponentSchemaType, PROPS_SETTING_TYPES } from '@linkseeks/design-core';
const MallMainNav: ComponentSchemaType = {
propsConfig: {
componentType: {
label: '导航朗编辑',
type: PROPS_SETTING_TYPES.mallNav
},
},
};
export default MallMainNav;
...@@ -58,6 +58,7 @@ import OwnBanner from './OwnBanner' ...@@ -58,6 +58,7 @@ import OwnBanner from './OwnBanner'
import MallHeader from './MallHeader' import MallHeader from './MallHeader'
import OwnMainNav from './OwnMainNav' import OwnMainNav from './OwnMainNav'
import MobileBrand from './MobileBrand' import MobileBrand from './MobileBrand'
import MallMainNav from './MallMainNav'
export default { export default {
View, View,
...@@ -83,6 +84,7 @@ export default { ...@@ -83,6 +84,7 @@ export default {
CommonTitle, CommonTitle,
ChannelHeader, ChannelHeader,
ShopHeader, ShopHeader,
MallMainNav,
MobileBanner, MobileBanner,
MobileChannelBanner, MobileChannelBanner,
MobileQuickNav, MobileQuickNav,
......
...@@ -39,7 +39,7 @@ export const topAdvertConfig = { ...@@ -39,7 +39,7 @@ export const topAdvertConfig = {
export const headerConfig = { export const headerConfig = {
key: "3", key: "3",
"3": { "3": {
"componentName": "MallHeader", "componentName": "Header",
"props": { "props": {
"logoUrl": "", "logoUrl": "",
type: 'own' type: 'own'
...@@ -50,7 +50,7 @@ export const headerConfig = { ...@@ -50,7 +50,7 @@ export const headerConfig = {
export const mainNavConfig = { export const mainNavConfig = {
key: "4", key: "4",
"4": { "4": {
"componentName": "OwnMainNav", "componentName": "MallMainNav",
"props": { "props": {
}, },
......
...@@ -2,49 +2,65 @@ import { getIntl } from 'umi' ...@@ -2,49 +2,65 @@ import { getIntl } from 'umi'
const intl = getIntl() const intl = getIntl()
export const getDefaultMenuData = (mallPath: string, memberId: number) => { export interface NavItemType {
link: string,
name: string,
status: boolean,
type: number,
}
const getStatusByType = (type: number, list: NavItemType[] | undefined) => {
if (!list) return true
const current = list.filter((item) => item.type === type)[0]
if (current) {
return current.status
}
return true
}
export const getDefaultMenuData = (mallPath: string, memberId: number, list?: any[]) => {
return [ return [
{ {
"link": `${mallPath}/${memberId}`, "link": `${mallPath}/${memberId}`,
"name": intl.formatMessage({ id: 'editor.own.menu.home' }), "name": intl.formatMessage({ id: 'editor.own.menu.home' }),
"key": "Home", "key": "Home",
type: 1, type: 1,
status: true, status: getStatusByType(1, list),
}, },
{ {
"link": `${mallPath}/${memberId}/commodity`, "link": `${mallPath}/${memberId}/commodity`,
"name": intl.formatMessage({ id: 'editor.own.menu.commodity' }), "name": intl.formatMessage({ id: 'editor.own.menu.commodity' }),
"key": "commodity", "key": "commodity",
type: 2, type: 2,
status: true, status: getStatusByType(2, list),
}, },
{ {
"link": `${mallPath}/${memberId}/inquery`, "link": `${mallPath}/${memberId}/inquery`,
"name": intl.formatMessage({ id: 'editor.own.menu.inquery' }), "name": intl.formatMessage({ id: 'editor.own.menu.inquery' }),
"key": "inquery", "key": "inquery",
type: 3, type: 3,
status: true, status: getStatusByType(3, list),
}, },
{ {
"link": `${mallPath}/${memberId}/points`, "link": `${mallPath}/${memberId}/points`,
"name": intl.formatMessage({ id: 'editor.own.menu.integral' }), "name": intl.formatMessage({ id: 'editor.own.menu.integral' }),
"key": "points", "key": "points",
type: 4, type: 4,
status: true, status: getStatusByType(4, list),
}, },
{ {
"link": `${mallPath}/${memberId}/infomation`, "link": `${mallPath}/${memberId}/infomation`,
"name": intl.formatMessage({ id: 'editor.own.menu.infomation' }), "name": intl.formatMessage({ id: 'editor.own.menu.infomation' }),
"key": "infomation", "key": "infomation",
type: 6, type: 6,
status: true, status: getStatusByType(6, list),
}, },
{ {
"link": `${mallPath}/${memberId}/about`, "link": `${mallPath}/${memberId}/about`,
"name": intl.formatMessage({ id: 'editor.own.menu.about' }), "name": intl.formatMessage({ id: 'editor.own.menu.about' }),
"key": "about", "key": "about",
type: 5, type: 5,
status: true, status: getStatusByType(5, list),
}, },
] ]
......
...@@ -182,13 +182,9 @@ const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => { ...@@ -182,13 +182,9 @@ const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
const webMallInfo = shopList.filter(item => item.id === Number(shopId))[0] const webMallInfo = shopList.filter(item => item.id === Number(shopId))[0]
// 导航栏 // 导航栏
const navData = await getOwnMallNavData(); const navData: any = await getOwnMallNavData();
if(!isEmpty(navData)) { const mallPath = `${REQUEST_HEADER}${webMallInfo?.url}.${TOP_DOMAIN}`
mainNavConfig[mainNavConfig.key].props.menuData = navData; mainNavConfig[mainNavConfig.key].props.menuData = getDefaultMenuData(mallPath, memberId, navData)
} else {
const mallPath = `${REQUEST_HEADER}${webMallInfo?.url}.${TOP_DOMAIN}`
mainNavConfig[mainNavConfig.key].props.menuData = getDefaultMenuData(mallPath, memberId);
}
mainNavConfig[mainNavConfig.key].props.type = LAYOUT_TYPE.shop mainNavConfig[mainNavConfig.key].props.type = LAYOUT_TYPE.shop
mainNavConfig[mainNavConfig.key].props.categoryList = await getCategoryTree() mainNavConfig[mainNavConfig.key].props.categoryList = await getCategoryTree()
......
...@@ -66,7 +66,8 @@ const MallNav: React.FC<MallNavProps> = (props) => { ...@@ -66,7 +66,8 @@ const MallNav: React.FC<MallNavProps> = (props) => {
return { return {
name: item.name, name: item.name,
link: item.link, link: item.link,
status: item.status status: item.status,
type: item.type
}; };
}) })
}; };
......
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