Commit 44fb9147 authored by GuanHua's avatar GuanHua

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

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