Commit 44fb9147 authored by GuanHua's avatar GuanHua

fix;渠道商城链接错误时显示问题

parent ffeba113
......@@ -124,22 +124,28 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
getFn = PublicApi.postSearchShopEnterpriseGetCommodityList
break
case LAYOUT_TYPE.shop:
param.storeId = shopId
getFn = PublicApi.postSearchShopStoreGetCommodityList
if (shopId) {
param.storeId = shopId
getFn = PublicApi.postSearchShopStoreGetCommodityList
}
break
case LAYOUT_TYPE.channel:
param.channelMemberId = memberId
headers = {
type: 3
if (memberId) {
param.channelMemberId = memberId
headers = {
type: 3
}
getFn = PublicApi.postSearchShopChannelGetCommodityList
}
getFn = PublicApi.postSearchShopChannelGetCommodityList
break
case LAYOUT_TYPE.ichannel:
param.channelMemberId = memberId
headers = {
type: 4
if (memberId) {
param.channelMemberId = memberId
headers = {
type: 4
}
getFn = PublicApi.postSearchShopChannelGetCommodityList
}
getFn = PublicApi.postSearchShopChannelGetCommodityList
break
}
......
......@@ -4,10 +4,11 @@ import styles from './index.less'
interface NoResultPropsType {
search?: string,
type?: number
}
const SearchShopResult: React.FC<NoResultPropsType> = (props) => {
const { search } = props
const { search, type = 1 } = props
return (
<div className={styles.no_result_container}>
<div className={styles.no_result}>
......@@ -21,11 +22,11 @@ const SearchShopResult: React.FC<NoResultPropsType> = (props) => {
<>
抱歉,没有找到与“
<span className={styles.no_result_tip_search}>{search}</span>
”相关的店铺
”相关的{type === 1 ? '店铺' : '渠道商城'}
</>
) : (
<>
抱歉,没有找到相关的店铺
抱歉,没有找到相关的{type === 1 ?'店铺' : '渠道商城'}
</>
)
}
......@@ -34,8 +35,8 @@ const SearchShopResult: React.FC<NoResultPropsType> = (props) => {
<div className={styles.no_result_suggest}>
<ul className={styles.no_result_suggest_list}>
<li>出现的可能原因:</li>
<li>1、管理员冻结了该店铺</li>
<li>2、店铺链接出现错误</li>
<li>1、管理员冻结了该{type === 1 ? '店铺' : '渠道商城'}</li>
<li>2、{type === 1 ? '店铺' : '渠道商城'}链接出现错误</li>
</ul>
</div>
</div>
......
......@@ -10,6 +10,7 @@ import { inject, observer } from 'mobx-react'
import TopBar from '../components/TopBar'
import { PublicApi } from '@/services/api'
import { GetTemplateChannelFindChannelResponse } from '@/services/TemplateApi'
import SearchShopResult from '../components/SearchShopResult'
import ChannelHeader from '../components/ChannelHeader'
import MainNav from '../components/MainNav'
import SideNav from '../components/SideNav'
......@@ -31,6 +32,7 @@ const LXChannelLayout: React.FC<LXChannelLayoutPropsType> = (props) => {
const { channelId } = location.query
const [shopInfo, setShopInfo] = useState<GetTemplateChannelFindChannelResponse>()
const [query, setQuery] = useState<any>({})
const [loading, setLoading] = useState<boolean>(true)
const getMenuRouter = (routes: any, pathname: any) => {
let list = routes.filter((item: any) => pathname.indexOf(item.key) > -1)
......@@ -48,7 +50,7 @@ const LXChannelLayout: React.FC<LXChannelLayoutPropsType> = (props) => {
queryParam = queryParam ? JSON.parse(queryParam) : {}
setQuery(queryParam)
} catch (error) {
setLoading(false)
}
}, [])
......@@ -64,6 +66,9 @@ const LXChannelLayout: React.FC<LXChannelLayoutPropsType> = (props) => {
if (res.code === 1000) {
setShopInfo(res.data)
}
setLoading(false)
}).catch(() => {
setLoading(false)
})
}
......@@ -95,7 +100,7 @@ const LXChannelLayout: React.FC<LXChannelLayoutPropsType> = (props) => {
)
}
{
children && React.Children.map(children, (child: any) => {
!loading ? shopInfo ? children && React.Children.map(children, (child: any) => {
return React.cloneElement(child,
{
layoutType: LAYOUT_TYPE.channel,
......@@ -105,7 +110,7 @@ const LXChannelLayout: React.FC<LXChannelLayoutPropsType> = (props) => {
shopInfo
},
);
})
}) : <SearchShopResult type={2} /> : null
}
</div>
<Footer />
......
......@@ -10,6 +10,7 @@ import { inject, observer } from 'mobx-react'
import TopBar from '../components/TopBar'
import { PublicApi } from '@/services/api'
import { GetTemplateChannelFindChannelResponse } from '@/services/TemplateApi'
import SearchShopResult from '../components/SearchShopResult'
import ChannelHeader from '../components/ChannelHeader'
import MainNav from '../components/MainNav'
import SideNav from '../components/SideNav'
......@@ -31,6 +32,7 @@ const LXIChannelLayout: React.FC<LXIChannelLayoutPropsType> = (props) => {
const { channelId } = location.query
const [shopInfo, setShopInfo] = useState<GetTemplateChannelFindChannelResponse>()
const [query, setQuery] = useState<any>({})
const [loading, setLoading] = useState<boolean>(true)
const getMenuRouter = (routes: any, pathname: any) => {
let list = routes.filter((item: any) => pathname.indexOf(item.key) > -1)
......@@ -47,7 +49,7 @@ const LXIChannelLayout: React.FC<LXIChannelLayoutPropsType> = (props) => {
queryParam = queryParam ? JSON.parse(queryParam) : {}
setQuery(queryParam)
} catch (error) {
setLoading(false)
}
}, [])
......@@ -64,6 +66,9 @@ const LXIChannelLayout: React.FC<LXIChannelLayoutPropsType> = (props) => {
if (res.code === 1000) {
setShopInfo(res.data)
}
setLoading(false)
}).catch(() => {
setLoading(false)
})
}
......@@ -89,7 +94,7 @@ const LXIChannelLayout: React.FC<LXIChannelLayoutPropsType> = (props) => {
)
}
{
children && React.Children.map(children, (child: any) => {
!loading ? shopInfo ? children && React.Children.map(children, (child: any) => {
return React.cloneElement(child,
{
layoutType: LAYOUT_TYPE.ichannel,
......@@ -99,7 +104,7 @@ const LXIChannelLayout: React.FC<LXIChannelLayoutPropsType> = (props) => {
shopInfo
},
);
})
}) : <SearchShopResult type={2} /> : null
}
</div>
<Footer />
......
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