Commit 6ff3728d authored by alwayOnlie's avatar alwayOnlie
parents 9fe9a337 5578ac36
......@@ -19,7 +19,8 @@ export const searchBrandOptionEffect = (
memberRoleId,
}).then(res => {
context.setFieldState(fieldName, state => {
state.props['x-component-props'].dataoption = res.data?.data?.map(item => {
const result = res.data?.data || []
state.props['x-component-props'].dataoption = result.map(item => {
return { name: item.name, id: item.id };
});
});
......@@ -44,7 +45,8 @@ export const searchCustomerCategoryOptionEffect = (
}).then(res => {
// PublicApi.getProductPlatformGetCategoryTree().then(res => {
context.setFieldState(fieldName, state => {
state.props['x-component-props'].dataoption = res.data?.map(item => {
const result = res.data || []
state.props['x-component-props'].dataoption = result.map(item => {
return { title: item.name, id: item.id };
});
});
......
......@@ -150,6 +150,11 @@ const CommodityDrawer: React.FC<CommodityDrawerProps> = (props: CommodityDrawerP
case LAYOUT_TYPE.shop:
getFn = PublicApi.getMarketingAdornGoodsListAdorn
break;
case LAYOUT_TYPE.own:
_params.memberId = memberId
_params.memberRoleId = memberRoleId
getFn = PublicApi.getMarketingAdornGoodsListAdorn
break
default:
break;
}
......
......@@ -34,7 +34,7 @@ const Environment_MAPS = {
const Property_MAPS = {
1: 'B端商城',
2: 'C端商城',
3: 'SRM商城',
3: '自营商城',
}
const Title_MAPS = {
......
......@@ -5,7 +5,7 @@ import { PublicApi } from '@/services/api'
import { LAYOUT_TYPE } from '@/constants'
import { STATE_PROPS, PageConfigType, PROPS_SETTING_TYPES } from '@lingxi-disign/core'
import { useSelector } from '@lingxi-disign/react'
import { paramsShop, paramsChannel } from './returnSaveParams'
import { paramsShop, paramsChannel, paramsOwnMall } from './returnSaveParams'
import { history } from 'umi'
import styles from './index.less'
......@@ -42,8 +42,10 @@ const ToolBar: React.FC<ToolBarPropsType> = (props) => {
const handleSave = useCallback(() => {
if (layoutType === LAYOUT_TYPE.shop) {
saveAppEnterprise(paramsShop(templateId, pageConfig))
} else if(layoutType=== LAYOUT_TYPE.channel) {
} else if(layoutType === LAYOUT_TYPE.channel) {
saveAppEnterprise(paramsChannel(templateId, pageConfig, templateInfo))
} else if (layoutType === LAYOUT_TYPE.own) {
saveAppEnterprise(paramsOwnMall(templateId, pageConfig, templateInfo))
}
}, [pageConfig])
......@@ -51,8 +53,10 @@ const ToolBar: React.FC<ToolBarPropsType> = (props) => {
let postFn
if(layoutType=== LAYOUT_TYPE.shop) {
postFn = PublicApi.postTemplateAdornAppStoreSave
} else if(layoutType=== LAYOUT_TYPE.channel) {
} else if(layoutType === LAYOUT_TYPE.channel) {
postFn = PublicApi.postTemplateAdornAppChannelSave
} else if (layoutType === LAYOUT_TYPE.own) {
postFn = PublicApi.postTemplateAdornAppSelfSave
}
if(postFn) {
postFn(param).then(res => {
......
......@@ -148,9 +148,10 @@ const BannerClient: React.FC<BannerClientProps> = (props: BannerClientProps) =>
if (layoutType === LAYOUT_TYPE.shop) {
return RedirectTypeList
}
if (layoutType === LAYOUT_TYPE.channel) {
if (layoutType === LAYOUT_TYPE.channel || layoutType === LAYOUT_TYPE.own) {
return RedirectTypeList_Channel
}
return []
}, [layoutType])
const _recordDetail = useMemo(() => {
......
......@@ -11,6 +11,7 @@ import FormilyUpload from '@/components/UploadFiles/FormilyUploadFiles';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect'
import { LAYOUT_TYPE } from '@/constants'
import ActivityDrawer from '@/pages/editor/components/drawer/activityDrawer';
import MixDrawer from '@/pages/editor/components/drawer/mixDrawer';
import { getAuth } from '@/utils/auth'
import { cardNavSchema } from './schema'
import styles from './index.less';
......@@ -47,6 +48,25 @@ const TyleList = [
},
]
const TyleList_Own = [
{
value: 1,
label: '积分兑换',
},
{
value: 2,
label: '公司介绍',
},
{
value: 3,
label: '成为会员',
},
{
value: 4,
label: '公司介绍',
},
]
const ChannelTyleList = [
{
value: 1,
......@@ -70,6 +90,29 @@ const ChannelTyleList = [
},
]
const RedirectTypeList_Own = [
{
value: 5,
label: '商城导航',
},
{
value: 2,
label: '活动导航',
},
{
value: 1,
label: '品类导航',
},
{
value: 3,
label: '频道导航',
},
{
value: 4,
label: '外部链接',
},
];
const RedirectTypeList = [
{
value: 1,
......@@ -98,11 +141,14 @@ const CardNavItem: React.FC<CardNavItemProps> = (props: CardNavItemProps) => {
const { memberId, memberRoleId } = getAuth() || {}
const fixtureContext = useContext(context);
const [formValue, setFormVale] = useState<any>();
const [mixVisible, setMixVisible] = useState<boolean>(false);
const _fetch: any = useMemo(() => {
switch (type) {
case 2:
return PublicApi.getTemplateWebActivityPageGet
case 5:
return PublicApi.getManageShopDetails
default:
return async () => { }
}
......@@ -110,7 +156,7 @@ const CardNavItem: React.FC<CardNavItemProps> = (props: CardNavItemProps) => {
useEffect(() => {
if(id) {
if(type === 2) {
if([2, 5].includes(type)) {
_fetch?.({ id }).then((res) => {
if (res.code === 1000) {
setRecord(res.data)
......@@ -172,6 +218,7 @@ const CardNavItem: React.FC<CardNavItemProps> = (props: CardNavItemProps) => {
return useMemo(() => {
if (record) {
const chooseType = fixtureContext?.formActions.getFieldValue('type')
if (chooseType === 2) {
return (
<div className={styles['banner-record-activity']}>
......@@ -185,6 +232,17 @@ const CardNavItem: React.FC<CardNavItemProps> = (props: CardNavItemProps) => {
<div className={styles['banner-record-activity-tag']}><StatusTag title={record?.type === 1 ? '平台' : '商家'} type={record?.type === 1 ? 'success' : 'primary'} /></div>
</div>
)
} else if (chooseType === 5) {
return (
<div className={styles['banner-record-activity']}>
<img src={record?.logoUrl} />
<div className={styles['banner-record-activity-right']}>
<Tooltip title={record?.name}>
<div className={styles['banner-record-activity-right-top']}>{record?.name}</div>
</Tooltip>
</div>
</div>
)
}
}
return null
......@@ -201,6 +259,9 @@ const CardNavItem: React.FC<CardNavItemProps> = (props: CardNavItemProps) => {
case 2:
setActVisible(true);
break;
case 5:
setMixVisible(true)
break
default:
break;
}
......@@ -208,7 +269,17 @@ const CardNavItem: React.FC<CardNavItemProps> = (props: CardNavItemProps) => {
const _onChooseConfirm = (record) => {
setRecord(record);
const chooseType = fixtureContext?.formActions.getFieldValue('type')
switch (chooseType) {
case 2:
_onActClose();
break;
case 5:
setMixVisible(false)
break
default:
break;
}
}
const _getTypeList = useMemo(() => {
......@@ -217,6 +288,8 @@ const CardNavItem: React.FC<CardNavItemProps> = (props: CardNavItemProps) => {
return TyleList
case LAYOUT_TYPE.channel:
return ChannelTyleList
case LAYOUT_TYPE.own:
return TyleList_Own
default:
return TyleList
}
......@@ -249,7 +322,7 @@ const CardNavItem: React.FC<CardNavItemProps> = (props: CardNavItemProps) => {
}
if (values.channel && values.type === 3) {
newProps.id = values.channel
} else if (values.type === 2) {
} else if (values.type === 2 || values.type === 5) {
newProps.id = record.id
}
......@@ -264,7 +337,7 @@ const CardNavItem: React.FC<CardNavItemProps> = (props: CardNavItemProps) => {
const list = await getFirstCategoryList()
return {
type: RedirectTypeList,
type: LAYOUT_TYPE.own ? RedirectTypeList_Own : RedirectTypeList,
id: list,
channel: _getTypeList,
}
......@@ -280,6 +353,10 @@ const CardNavItem: React.FC<CardNavItemProps> = (props: CardNavItemProps) => {
components: { FormilyUpload, recordDetail },
};
const _onMixClose = () => {
setMixVisible(false);
}
return (
<>
<NiceForm
......@@ -305,6 +382,15 @@ const CardNavItem: React.FC<CardNavItemProps> = (props: CardNavItemProps) => {
onClose={_onActClose}
onConfirm={_onChooseConfirm}
/>
<MixDrawer
selectId={id}
layoutType={layoutType}
onClose={_onMixClose}
type={1}
property={3}
onConfirm={_onChooseConfirm}
visible={mixVisible}
/>
</>
)
}
......
......@@ -75,7 +75,7 @@ export const cardNavSchema: ISchema = {
{
type: 'value:visible',
target: 'recordDetail',
condition: "{{$value === 2}}"
condition: "{{$value === 2 || $value === 5}}"
},
],
'x-rules': [
......
......@@ -43,18 +43,8 @@ export const channelLayoutConfig : PageConfigType = {
title: '${channelName}',
categoryList: '${categoryList}',
},
childNodes: ['2'],
childComponentName: 'ChannelHeaderNav.ActionItem',
},
'2': {
loop: '${top}',
title: '${item.name}',
hideActions: true,
componentName: 'ChannelHeaderNav.ActionItem',
props: {
data: '${item}'
},
},
'3': {
title: '广告图',
canDelete: false,
......
......@@ -21,6 +21,7 @@ import config from '../../editor/configs';
import { priceFormat } from '@/utils/numberFomat';
import * as MarketingConfigs from './marketing_config';
import { cloneDeep } from 'lodash';
import { GlobalConfig } from '@/global/config'
import {
defaultHeaderNavData,
channelLayoutConfig,
......@@ -52,7 +53,6 @@ import {
import Loading from '../../editor/components/Loading';
import { PublicApi } from '@/services/api';
import { LAYOUT_TYPE } from '@/constants';
// import { GlobalConfig } from '@/global/config'
import MobileSettingPanel from '../../editor/mobileSettingPanel';
import { getAuth } from '@/utils/auth';
import styles from './index.less';
......@@ -117,14 +117,14 @@ const OwnMallTempleteEdit: React.FC<ShopPreviewPropsType> = props => {
};
/**
* 获取app店铺装修信息
* 获取app装修信息
*/
const getAppChannelConfig = (): Promise<any> => {
const getAppConfig = (): Promise<any> => {
return new Promise((resolve, reject) => {
const param: any = {
templateId: id,
};
PublicApi.getTemplateAdornAppChannelFind(param)
PublicApi.getTemplateAdornAppSelfFind(param)
.then(res => {
if (res.code === 1000 && res.data) {
setTemplateInfo(res.data)
......@@ -144,8 +144,9 @@ const OwnMallTempleteEdit: React.FC<ShopPreviewPropsType> = props => {
const param: any = {
shopId,
memberId,
memberRoleId
};
PublicApi.getSearchChannelCommodityTemplateGetFirstCategoryListByMemberId(
PublicApi.getSearchCommodityTemplateGetFirstCategoryListByMemberId(
param,
)
.then(res => {
......@@ -175,6 +176,7 @@ const OwnMallTempleteEdit: React.FC<ShopPreviewPropsType> = props => {
recommendLabel: [2, 3],
};
const res = await PublicApi.getManageContentInformationPage(param);
message.destroy()
if (res.code === 1000 && res.data.data) {
return res.data.data[0].title;
}
......@@ -183,13 +185,15 @@ const OwnMallTempleteEdit: React.FC<ShopPreviewPropsType> = props => {
const getComponentsConfig = async () => {
try {
const appConfig = await getAppChannelConfig();
//渠道信息
const channelInfo = await fetchChannelInfo();
const appConfig = await getAppConfig();
// 商城信息
const shopList = GlobalConfig.web.shopInfo
const webMallInfo = shopList.filter(item => item.id === Number(shopId))[0]
const _mallLayoutConfig: any = cloneDeep(channelLayoutConfig);
const allState = {
top: defaultHeaderNavData,
channelName: channelInfo.memberName,
channelName: webMallInfo.name,
categoryList: await getFirstCategoryList(),
navList: appConfig?.navList ? appConfig?.navList.details : [],
advert: appConfig?.advert ? appConfig?.advert.details : [],
......@@ -1041,20 +1045,20 @@ const OwnMallTempleteEdit: React.FC<ShopPreviewPropsType> = props => {
return !loading ? (
<BrickProvider config={config}>
<Helmet>
<title>渠道装修-渠道主</title>
<title>自营商城装修-首</title>
</Helmet>
<div className={styles['wrapper']}>
<ToolBar
type={1}
title="渠道商城-首页"
title="自营商城装修-首页"
showActions={true}
layoutType={LAYOUT_TYPE.channel}
layoutType={LAYOUT_TYPE.own}
templateId={id}
templateInfo={templateInfo}
/>
<div className={styles['content']}>
<MobileClientEditLeft
layoutType={LAYOUT_TYPE.channel}
layoutType={LAYOUT_TYPE.own}
marketConfigs={MarketingConfigs}
/>
<div className={styles['app-wrapper']}>
......@@ -1068,7 +1072,7 @@ const OwnMallTempleteEdit: React.FC<ShopPreviewPropsType> = props => {
</div>
<MobileSettingPanel
shopId={shopId}
layoutType={LAYOUT_TYPE.channel}
layoutType={LAYOUT_TYPE.own}
/>
</div>
</div>
......
......@@ -21,6 +21,7 @@ import config from '../../editor/configs';
import { priceFormat } from '@/utils/numberFomat';
import * as MarketingConfigs from './marketing_config';
import { cloneDeep } from 'lodash';
import { GlobalConfig } from '@/global/config'
import {
defaultHeaderNavData,
channelLayoutConfig,
......@@ -52,7 +53,6 @@ import {
import Loading from '../../editor/components/Loading';
import { PublicApi } from '@/services/api';
import { LAYOUT_TYPE } from '@/constants';
// import { GlobalConfig } from '@/global/config'
import MobileSettingPanel from '../../editor/mobileSettingPanel';
import { getAuth } from '@/utils/auth';
import styles from './index.less';
......@@ -117,14 +117,14 @@ const OwnMallTempletePreview: React.FC<ShopPreviewPropsType> = props => {
};
/**
* 获取app店铺装修信息
* 获取app装修信息
*/
const getAppChannelConfig = (): Promise<any> => {
const getAppConfig = (): Promise<any> => {
return new Promise((resolve, reject) => {
const param: any = {
templateId: id,
};
PublicApi.getTemplateAdornAppChannelFind(param)
PublicApi.getTemplateAdornAppSelfFind(param)
.then(res => {
if (res.code === 1000 && res.data) {
setTemplateInfo(res.data)
......@@ -144,8 +144,9 @@ const OwnMallTempletePreview: React.FC<ShopPreviewPropsType> = props => {
const param: any = {
shopId,
memberId,
memberRoleId
};
PublicApi.getSearchChannelCommodityTemplateGetFirstCategoryListByMemberId(
PublicApi.getSearchCommodityTemplateGetFirstCategoryListByMemberId(
param,
)
.then(res => {
......@@ -175,6 +176,7 @@ const OwnMallTempletePreview: React.FC<ShopPreviewPropsType> = props => {
recommendLabel: [2, 3],
};
const res = await PublicApi.getManageContentInformationPage(param);
message.destroy()
if (res.code === 1000 && res.data.data) {
return res.data.data[0].title;
}
......@@ -183,13 +185,15 @@ const OwnMallTempletePreview: React.FC<ShopPreviewPropsType> = props => {
const getComponentsConfig = async () => {
try {
const appConfig = await getAppChannelConfig();
//渠道信息
const channelInfo = await fetchChannelInfo();
const appConfig = await getAppConfig();
// 商城信息
const shopList = GlobalConfig.web.shopInfo
const webMallInfo = shopList.filter(item => item.id === Number(shopId))[0]
const _mallLayoutConfig: any = cloneDeep(channelLayoutConfig);
const allState = {
top: defaultHeaderNavData,
channelName: channelInfo.memberName,
channelName: webMallInfo.name,
categoryList: await getFirstCategoryList(),
navList: appConfig?.navList ? appConfig?.navList.details : [],
advert: appConfig?.advert ? appConfig?.advert.details : [],
......@@ -1041,35 +1045,23 @@ const OwnMallTempletePreview: React.FC<ShopPreviewPropsType> = props => {
return !loading ? (
<BrickProvider config={config}>
<Helmet>
<title>渠道装修-渠道主</title>
<title>自营商城装修-首</title>
</Helmet>
<div className={styles['wrapper']}>
<ToolBar
type={1}
title="渠道商城-首页"
showActions={true}
layoutType={LAYOUT_TYPE.channel}
type={2}
title="自营商城装修-首页"
showActions={false}
layoutType={LAYOUT_TYPE.own}
templateId={id}
templateInfo={templateInfo}
/>
<div className={styles['content']}>
<MobileClientEditLeft
layoutType={LAYOUT_TYPE.channel}
marketConfigs={MarketingConfigs}
/>
<div className={styles['app-wrapper']}>
<div className={styles['app-canvas-container']}>
<MobileDesignPanel
onlyEidt
theme={theme}
pageConfig={componentConfigs}
/>
<MobileDesignPanel isPreview onlyEidt theme={theme} pageConfig={componentConfigs} />
</div>
</div>
<MobileSettingPanel
shopId={shopId}
layoutType={LAYOUT_TYPE.channel}
/>
</div>
</div>
</BrickProvider>
......
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