Commit 04431beb authored by GuanHua's avatar GuanHua

fix: 自营商城模板装修页面修改

parent 4cb597cf
......@@ -23,13 +23,14 @@ import {
} from './defaultData'
import { getDefaultMenuData } from './defaultMenu'
import Loading from '../components/Loading'
import { GlobalConfig } from '@/global/config'
import { getShopInfoById, GlobalConfig } from '@/global/config'
import { getAuth } from '@/utils/auth'
import styles from './index.less'
import { getManageContentInformationFindAllByRecommendLabel } from '@/services/ManageV2Api'
import { getManageContentInformationFindAllByRecommendLabel, postManageWebShopWebAll } from '@/services/ManageV2Api'
import { getSearchShopSelfGetCustomerCategoryTree } from '@/services/SearchV2Api'
import { getTemplateAdornWebSelfFindAdvertsByType, getTemplateAdornWebSelfFindAllFirstCategory, getTemplateAdornWebSelfFindColumn, getTemplateAdornWebSelfMemberCategoryAdorn } from '@/services/TemplateV2Api'
import useBrickAsync from '../hooks/useBrickAsync'
import { getTemplateWebPageTemplateWebFindSelfTemplateDetails } from '@/services/TemplateApi'
interface ShopEditPropsType {
location: {
......@@ -42,7 +43,8 @@ interface ShopEditPropsType {
* 模板名称
*/
template: string;
shopId: number
shopId: number,
property: string,
}
}
}
......@@ -50,7 +52,7 @@ interface ShopEditPropsType {
const TemplateList = ['science']
const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
const { query: { id, template, shopId } } = props.location
const { query: { id, template, shopId, property } } = props.location
const [loading, setLoading] = useState<boolean>(true)
const [theme, setTheme] = useState<string>('theme-ownmall-science')
const [componentConfigs, setComponentConfigs] = useState({})
......@@ -177,15 +179,33 @@ const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
});
};
const getComponentsConfig = async () => {
//商城信息
const shopList = GlobalConfig.web.shopInfo
const webMallInfo = shopList.filter(item => item.id === Number(shopId))[0]
const getMemberSelfMallInfo = async () => {
const param: any = {
id
}
const res = await getTemplateWebPageTemplateWebFindSelfTemplateDetails(param)
if (res.code === 1000) {
return res.data
}
return undefined
}
const getComponentsConfig = async () => {
// 商城信息
const mallInfo: any = await getMemberSelfMallInfo()
// 导航栏
const navData: any = await getOwnMallNavData();
const mallPath = `${REQUEST_HEADER}${webMallInfo?.url}.${TOP_DOMAIN}`
mainNavConfig[mainNavConfig.key].props.menuData = getDefaultMenuData(mallPath, memberId, navData)
if (mallInfo) {
const mallPath = `${REQUEST_HEADER}${mallInfo?.url}.${TOP_DOMAIN}`
mainNavConfig[mainNavConfig.key].props.menuData = getDefaultMenuData(mallPath, memberId, navData)
topBarConfig[topBarConfig.key].props.shopname = mallInfo?.sourceShopName || mallInfo?.shopName
const shopInfo = getShopInfoById(mallInfo.shopId)
headerConfig[headerConfig.key].props.logoUrl = shopInfo?.logoUrl
}
mainNavConfig[mainNavConfig.key].props.type = LAYOUT_TYPE.shop
mainNavConfig[mainNavConfig.key].props.categoryList = await getCategoryTree()
......@@ -198,8 +218,6 @@ const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
// 四号位广告
fourBannerConfig[fourBannerConfig.key].props.advertList = await findAdvertsByType(4)
topBarConfig[topBarConfig.key].props.shopname = webMallInfo?.name
headerConfig[headerConfig.key].props.logoUrl = webMallInfo?.logoUrl
// 行情资讯
InformationConfig[InformationConfig.key].props.newsList = await fetchNewByLabel('4');
......
......@@ -23,12 +23,12 @@ import {
} from './defaultData'
import { getDefaultMenuData } from './defaultMenu'
import Loading from '../components/Loading'
import { GlobalConfig } from '@/global/config'
import { getShopInfoById, GlobalConfig } from '@/global/config'
import { getAuth } from '@/utils/auth'
import styles from './index.less'
import { getManageContentInformationFindAllByRecommendLabel } from '@/services/ManageV2Api'
import { getManageContentInformationFindAllByRecommendLabel, postManageWebShopWebAll } from '@/services/ManageV2Api'
import { getSearchShopSelfGetCustomerCategoryTree } from '@/services/SearchV2Api'
import { getTemplateAdornWebSelfFindAdvertsByType, getTemplateAdornWebSelfFindAllFirstCategory, getTemplateAdornWebSelfFindColumn, getTemplateAdornWebSelfMemberCategoryAdorn } from '@/services/TemplateV2Api'
import { getTemplateAdornWebSelfFindAdvertsByType, getTemplateAdornWebSelfFindAllFirstCategory, getTemplateAdornWebSelfFindColumn, getTemplateAdornWebSelfMemberCategoryAdorn, getTemplateWebPageTemplateWebFindSelfTemplateDetails } from '@/services/TemplateV2Api'
interface ShopEditPropsType {
location: {
......@@ -41,7 +41,8 @@ interface ShopEditPropsType {
* 模板名称
*/
template: string;
shopId: number
shopId: number,
property: number
}
}
}
......@@ -49,7 +50,7 @@ interface ShopEditPropsType {
const TemplateList = ['science']
const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
const { query: { id, template, shopId } } = props.location
const { query: { id, template, shopId, property } } = props.location
const [loading, setLoading] = useState<boolean>(true)
const [theme, setTheme] = useState<string>('theme-ownmall-science')
const [componentConfigs, setComponentConfigs] = useState({})
......@@ -175,19 +176,33 @@ const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
});
};
const getMemberSelfMallInfo = async () => {
const param: any = {
id
}
const res = await getTemplateWebPageTemplateWebFindSelfTemplateDetails(param)
if (res.code === 1000) {
return res.data
}
return undefined
}
const getComponentsConfig = async () => {
// 商城信息
const mallInfo: any = await getMemberSelfMallInfo()
// 导航栏
const navData = await getOwnMallNavData();
//商城信息
const shopList = GlobalConfig.web.shopInfo
const webMallInfo = shopList.filter(item => item.id === Number(shopId))[0]
const navData: any = 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 = mainNavConfig[mainNavConfig.key].props.menuData = getDefaultMenuData(mallPath, memberId);;
if (mallInfo) {
const mallPath = `${REQUEST_HEADER}${mallInfo?.url}.${TOP_DOMAIN}`
mainNavConfig[mainNavConfig.key].props.menuData = getDefaultMenuData(mallPath, memberId, navData)
topBarConfig[topBarConfig.key].props.shopname = mallInfo?.sourceShopName || mallInfo?.shopName
const shopInfo = getShopInfoById(mallInfo.shopId)
headerConfig[headerConfig.key].props.logoUrl = shopInfo?.logoUrl
}
mainNavConfig[mainNavConfig.key].props.type = LAYOUT_TYPE.shop
mainNavConfig[mainNavConfig.key].props.categoryList = await getCategoryTree()
......@@ -200,9 +215,6 @@ const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
// 四号位广告
fourBannerConfig[fourBannerConfig.key].props.advertList = await findAdvertsByType(4)
topBarConfig[topBarConfig.key].props.shopname = webMallInfo.name
headerConfig[headerConfig.key].props.logoUrl = webMallInfo.logoUrl
// 行情资讯
InformationConfig[InformationConfig.key].props.newsList = await fetchNewByLabel('4');
......
/*
* @Author: ghua
* @Date: 2021-02-22 17:02:20
* @LastEditTime: 2021-03-01 11:37:34
* @LastEditors: Please set LastEditors
* @LastEditTime: 2022-02-16 18:45:16
* @LastEditors: GHua
* @Description: app渠道商城装修
* @FilePath: /lingxi-business-paltform/src/pages/mobileTemplate/channelTemplateEdit/index.tsx
*/
......@@ -56,7 +56,7 @@ import MobileSettingPanel from '../../editor/mobileSettingPanel';
import { getAuth } from '@/utils/auth';
import styles from './index.less';
import { getMarketingAdornActivityGoodsAdorn, getMarketingAdornGoodsListAdorn, postMarketingCouponActivityPageSelectDetail } from '@/services/MarketingV2Api';
import { getManageMemberInformationListAdorn } from '@/services/ManageV2Api';
import { getManageMemberInformationListAdorn, postManageWebShopWebAll } from '@/services/ManageV2Api';
import { getSearchCommodityTemplateGetBrandList, getSearchCommodityTemplateGetFirstCategoryListByMemberId } from '@/services/SearchV2Api';
import { getTemplateAdornAppSelfFind } from '@/services/TemplateV2Api';
import useBrickAsync from '@/pages/editor/hooks/useBrickAsync'
......@@ -75,6 +75,7 @@ interface ShopPreviewPropsType {
type: number;
shopId: number;
environment: number;
property: number,
};
};
}
......@@ -83,7 +84,7 @@ const TemplateList = ['science'];
const OwnMallTempleteEdit: React.FC<ShopPreviewPropsType> = props => {
const {
query: { id, template, type, shopId, environment = 4 },
query: { id, template, shopId, environment = 4, property },
} = props.location;
const [loading, setLoading] = useState<boolean>(true);
const [theme, setTheme] = useState<string>('theme-mall-science');
......@@ -199,16 +200,35 @@ const OwnMallTempleteEdit: React.FC<ShopPreviewPropsType> = props => {
return label
}
const getMemberSelfMallInfo = async () => {
const params = {
siteId: GlobalConfig.global.siteInfo.id,
environment: Number(environment),
type: 1,
hasMemberType: 1,
memberId: memberId,
roleId: memberRoleId,
}
const res = await postManageWebShopWebAll(params)
message.destroy()
if (res.code === 1000 && res.data && Array.isArray(res.data) && res.data.length > 0) {
const selfMall = res.data.filter((item) => item.self === 1 && item.property === Number(property))[0]
if (selfMall) {
return selfMall
}
}
return undefined
}
const getComponentsConfig = async () => {
try {
const appConfig = await getAppConfig();
// 商城信息
const shopList = GlobalConfig.web.shopInfo
const webMallInfo = shopList.filter(item => item.id === Number(shopId))[0]
const mallInfo = await getMemberSelfMallInfo()
const _mallLayoutConfig: any = cloneDeep(channelLayoutConfig);
const allState = {
channelName: webMallInfo?.name,
channelName: mallInfo ? mallInfo.name : '',
categoryList: await getFirstCategoryList(),
navList: appConfig?.navList ? appConfig?.navList.details : [],
advert: appConfig?.advert ? appConfig?.advert.details : [],
......
/*
* @Author: ghua
* @Date: 2021-02-22 17:02:20
* @LastEditTime: 2021-03-01 11:37:34
* @LastEditors: Please set LastEditors
* @LastEditTime: 2022-02-16 18:45:23
* @LastEditors: GHua
* @Description: app渠道商城装修
* @FilePath: /lingxi-business-paltform/src/pages/mobileTemplate/channelTemplateEdit/index.tsx
*/
......@@ -55,7 +55,7 @@ import { LAYOUT_TYPE } from '@/constants';
import { getAuth } from '@/utils/auth';
import styles from './index.less';
import { getMarketingAdornActivityGoodsAdorn, getMarketingAdornChannelGoodsListAdorn } from '@/services/MarketingV2Api';
import { getManageContentInformationPage } from '@/services/ManageV2Api';
import { getManageContentInformationPage, postManageWebShopWebAll } from '@/services/ManageV2Api';
import { getSearchCommodityTemplateGetBrandList, getSearchCommodityTemplateGetFirstCategoryListByMemberId } from '@/services/SearchV2Api';
import { getTemplateAdornAppSelfFind } from '@/services/TemplateV2Api';
......@@ -72,6 +72,8 @@ interface ShopPreviewPropsType {
template: string;
type: number;
shopId: number;
environment: number,
property: number,
};
};
}
......@@ -80,7 +82,7 @@ const TemplateList = ['science'];
const OwnMallTempletePreview: React.FC<ShopPreviewPropsType> = props => {
const {
query: { id, template, type, shopId },
query: { id, template, type, shopId, environment, property },
} = props.location;
const [loading, setLoading] = useState<boolean>(true);
const [theme, setTheme] = useState<string>('theme-mall-science');
......@@ -186,16 +188,35 @@ const OwnMallTempletePreview: React.FC<ShopPreviewPropsType> = props => {
return '';
};
const getMemberSelfMallInfo = async () => {
const params = {
siteId: GlobalConfig.global.siteInfo.id,
environment: Number(environment),
type: 1,
hasMemberType: 1,
memberId: memberId,
roleId: memberRoleId,
}
const res = await postManageWebShopWebAll(params)
message.destroy()
if (res.code === 1000 && res.data && Array.isArray(res.data) && res.data.length > 0) {
const selfMall = res.data.filter((item) => item.self === 1 && item.property === Number(property))[0]
if (selfMall) {
return selfMall
}
}
return undefined
}
const getComponentsConfig = async () => {
try {
const appConfig = await getAppConfig();
// 商城信息
const shopList = GlobalConfig.web.shopInfo
const webMallInfo = shopList.filter(item => item.id === Number(shopId))[0]
const mallInfo = await getMemberSelfMallInfo()
const _mallLayoutConfig: any = cloneDeep(channelLayoutConfig);
const allState = {
channelName: webMallInfo?.name,
channelName: mallInfo ? mallInfo.name : '',
categoryList: await getFirstCategoryList(),
navList: appConfig?.navList ? appConfig?.navList.details : [],
advert: appConfig?.advert ? appConfig?.advert.details : [],
......
......@@ -10,6 +10,7 @@ import styles from './index.less'
import { getTemplateWebPageTemplateWebFindSelfTemplateDetails, postTemplateWebPageTemplateWebOpenMro, postTemplateWebPageTemplateWebUseSelfTemplate } from '@/services/TemplateV2Api'
import { getManageShopOpenMro } from '@/services/ManageV2Api'
import { postManageWebShopWebAll, PostManageWebShopWebAllResponse } from '@/services/ManageV2Api'
import { getAuth } from '@/utils/auth'
import { GlobalConfig } from '@/global/config'
......@@ -46,11 +47,6 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
if (res.code === 1000 && res.data && Array.isArray(res.data) && res.data.length > 0) {
const list = res.data.filter((item) => item.self === 1 && item.property === property)
setMallList(list)
if (list && list.length === 1) {
return list[0].id
} else {
return undefined
}
}
}
......@@ -68,12 +64,14 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
}
}, [detailInfo]);
const fetchDetail = () => {
const fetchDetail = async () => {
const param: any = {
id
}
getTemplateWebPageTemplateWebFindSelfTemplateDetails(param).then(res => {
getTemplateWebPageTemplateWebFindSelfTemplateDetails(param).then(async (res) => {
if (res.code === 1000) {
await getMemberShopAll(res.data.environment, res.data.property)
setDetailInfo(res.data)
}
})
......@@ -103,10 +101,10 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
const handleLinkEdit = () => {
if(detailInfo?.environment === 1) {
// 自营商城装修
window.location.href = `/memberCenter/ownMallAbility/ownMallManager/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}&shopId=${detailInfo.shopId}`
window.location.href = `/memberCenter/ownMallAbility/ownMallManager/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}&shopId=${detailInfo?.sourceShopId || detailInfo.shopId}&property=${detailInfo?.property}`
} else if(detailInfo?.environment === 4 || detailInfo?.environment === 3 || detailInfo?.environment === 2) {
// 自营商城装修
window.location.href = `/memberCenter/ownMallAbility/ownMallManager/template/mobile/edit?id=${detailInfo.id}&template=${detailInfo.fileName}&shopId=${detailInfo.shopId}&environment=${detailInfo?.environment}`
window.location.href = `/memberCenter/ownMallAbility/ownMallManager/template/mobile/edit?id=${detailInfo.id}&template=${detailInfo.fileName}&shopId=${detailInfo?.sourceShopId || detailInfo.shopId}&environment=${detailInfo?.environment}&property=${detailInfo?.property}`
} else {
message.info(intl.formatMessage({ id: 'shop.template.edit.tip' }))
}
......@@ -114,9 +112,9 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
const handleLinkPreview = () => {
if(detailInfo?.environment === 1) {
window.location.href = `/memberCenter/ownMallAbility/ownMallManager/template/preview?id=${detailInfo.id}&template=${detailInfo.fileName}&shopId=${detailInfo.shopId}`
window.location.href = `/memberCenter/ownMallAbility/ownMallManager/template/preview?id=${detailInfo.id}&template=${detailInfo.fileName}&shopId=${detailInfo?.sourceShopId || detailInfo.shopId}&property=${detailInfo?.property}`
} else if(detailInfo?.environment === 4 || detailInfo?.environment === 3 || detailInfo?.environment === 2) {
window.location.href = `/memberCenter/ownMallAbility/ownMallManager/template/mobile/preview?id=${detailInfo.id}&template=${detailInfo.fileName}&shopId=${detailInfo.shopId}&environment=${detailInfo?.environment}`
window.location.href = `/memberCenter/ownMallAbility/ownMallManager/template/mobile/preview?id=${detailInfo.id}&template=${detailInfo.fileName}&shopId=${detailInfo?.sourceShopId || detailInfo.shopId}&environment=${detailInfo?.environment}&property=${detailInfo?.property}`
} else {
message.info(intl.formatMessage({ id: 'shop.template.preview.tip' }))
}
......@@ -127,7 +125,7 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
message.info(intl.formatMessage({ id: 'shop.template.edit.tip' }))
return
}
window.location.href = `/memberCenter/ownMallAbility/ownMallManager/template/categoryNavigation?id=${detailInfo.id}&template=${detailInfo.fileName}&shopId=${detailInfo.shopId}&isSelf=1`
window.location.href = `/memberCenter/ownMallAbility/ownMallManager/template/categoryNavigation?id=${detailInfo.id}&template=${detailInfo.fileName}&shopId=${detailInfo?.sourceShopId || detailInfo.shopId}&isSelf=1&property=${detailInfo?.property}`
}
const onChangeMroSetting = (e) => {
......@@ -167,7 +165,7 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
</div>
<div className={styles.template_info_line}>
<label>{intl.formatMessage({ id: 'shop.template.form.label.shopName' })}</label>
<span>{detailInfo?.shopName}</span>
<span>{detailInfo?.sourceShopName || detailInfo?.shopName}</span>
</div>
</div>
</div>
......
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