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