Commit f2c60d7f authored by GuanHua's avatar GuanHua

fix: 平台首页装修品类接口缺少商城id问题

parent d862a107
......@@ -57,6 +57,24 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
getPlatformConfig();
}, []);
const getDefaultEnterprise = () => {
const shopInfo = GlobalConfig.web.shopInfo;
const webMallList = shopInfo.filter(
(item: { environment: number; type: number }) =>
item.environment === 1 && item.type === 1,
);
const defaultMall = webMallList.filter(item => item.isDefault === 1)[0];
let result: any = undefined;
if (defaultMall) {
result = defaultMall;
} else {
if (webMallList && webMallList.length > 0) {
result = webMallList[0];
}
}
return result;
};
/**
* 获取平台首页装修信息
*/
......@@ -88,10 +106,15 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
*/
const getCategoryTree = () => {
return new Promise((resolve) => {
const defaultMallInfo = getDefaultEnterprise()
const param: any = {
templateId: id
};
PublicApi.getTemplateWebCategoryWebFindEnterpriseCategoryTree(param).then(res => {
const headers: any = {
shopId: defaultMallInfo.id
};
PublicApi.getTemplateWebCategoryWebFindEnterpriseCategoryTree(param, { headers }).then(res => {
if (res.code === 1000) {
resolve(res.data);
} else {
......
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