Commit 96d97f47 authored by GuanHua's avatar GuanHua

feat:添加路由白名单和店铺商城,渠道商城获取店铺信息的吸怪

parent c5b41269
...@@ -27,6 +27,51 @@ const shopRoute = { ...@@ -27,6 +27,51 @@ const shopRoute = {
component: '@/pages/lxMall/commodityDetail', component: '@/pages/lxMall/commodityDetail',
}, },
{ {
// 商品搜索
path: `/channelmall/commodity/search`,
name: 'channelmallCommoditySearch',
key: 'channelmallCommoditySearch',
hide: true,
component: '@/pages/lxMall/commodity/search',
},
{
// 积分商城
path: `/channelmall/pointsMall`,
name: 'shopPointsMall',
key: 'channelmallPointsMall',
component: '@/pages/lxMall/pointsMall',
},
{
// 资讯
path: `/channelmall/infomation`,
name: 'shopInfomation',
key: 'channelmallInfomation',
component: '@/pages/lxMall/information',
},
{
// 资讯详情
path: '/channelmall/infomation/detail',
name: 'infomationDetail',
key: 'infomationDetail',
hide: true,
component: '@/pages/lxMall/information/detail',
},
{
// 资讯详情搜索
path: '/channelmall/infomation/search',
name: 'infomationSearch',
key: 'infomationSearch',
hide: true,
component: '@/pages/lxMall/information/search',
},
{
// 关于我们
path: `/channelmall/about`,
name: 'shopAbout',
key: 'channelmallAbout',
component: '@/pages/lxMall/shopAbout',
},
{
path: '/noAuth', path: '/noAuth',
component: '@/pages/403', component: '@/pages/403',
}, },
......
...@@ -19,6 +19,14 @@ const shopRoute = { ...@@ -19,6 +19,14 @@ const shopRoute = {
component: '@/pages/lxMall/commodity', component: '@/pages/lxMall/commodity',
}, },
{ {
// 商品详情
path: `/shop/commodity/detail`,
name: 'shopCommodityDetail',
key: 'shopCommodityDetail',
hide: true,
component: '@/pages/lxMall/commodityDetail',
},
{
// 商品搜索 // 商品搜索
path: `/shop/commodity/search`, path: `/shop/commodity/search`,
name: 'shopCommoditySearch', name: 'shopCommoditySearch',
...@@ -41,6 +49,22 @@ const shopRoute = { ...@@ -41,6 +49,22 @@ const shopRoute = {
component: '@/pages/lxMall/information', component: '@/pages/lxMall/information',
}, },
{ {
// 资讯详情
path: '/shop/infomation/detail',
name: 'infomationDetail',
key: 'infomationDetail',
hide: true,
component: '@/pages/lxMall/information/detail',
},
{
// 资讯详情搜索
path: '/shop/infomation/search',
name: 'infomationSearch',
key: 'infomationSearch',
hide: true,
component: '@/pages/lxMall/information/search',
},
{
// 关于我们 // 关于我们
path: `/shop/about`, path: `/shop/about`,
name: 'shopAbout', name: 'shopAbout',
...@@ -48,14 +72,6 @@ const shopRoute = { ...@@ -48,14 +72,6 @@ const shopRoute = {
component: '@/pages/lxMall/shopAbout', component: '@/pages/lxMall/shopAbout',
}, },
{ {
// 商品详情
path: `/shop/commodity/detail`,
name: 'shopCommodityDetail',
key: 'shopCommodityDetail',
hide: true,
component: '@/pages/lxMall/commodityDetail',
},
{
path: '/noAuth', path: '/noAuth',
component: '@/pages/403', component: '@/pages/403',
}, },
......
...@@ -27,15 +27,33 @@ const userLoginLists = [ ...@@ -27,15 +27,33 @@ const userLoginLists = [
// 商城相关路由 // 商城相关路由
const mallLists = [ const mallLists = [
'/', '/',
'/channelmall', '/commodity',
'/shop', '/commodity/search',
'/commodity/detail',
'/purchaseOnline', '/purchaseOnline',
'/pointsMall', '/pointsMall',
'/commodity',
'/shops', '/shops',
'/shop/commodity/detail',
'/shop/commodity',
'/infomation', '/infomation',
'/infomation/detail',
'/infomation/search',
'/shop',
'/shop/commodity',
'/shop/commodity/search',
'/shop/commodity/detail',
'/shop/pointsMall',
'/shop/infomation',
'/shop/infomation/search',
'/shop/infomation/detail',
'/shop/about',
'/channelmall',
'/channelmall/commodity',
'/channelmall/commodity/search',
'/channelmall/commodity/detail',
'/channelmall/pointsMall',
'/channelmall/infomation',
'/channelmall/infomation/detail',
'/channelmall/infomation/search',
'/channelmall/about'
] ]
// let routeAuthUrls: any[] = [] // let routeAuthUrls: any[] = []
...@@ -117,9 +135,9 @@ export function render(oldRender: Function) { ...@@ -117,9 +135,9 @@ export function render(oldRender: Function) {
export function onRouteChange({ routes, matchedRoutes, location, action }) { export function onRouteChange({ routes, matchedRoutes, location, action }) {
console.log('onRouteChange') console.log('onRouteChange')
// if (isDev) { if (isDev) {
// return; return;
// } }
if (whiteLists.includes(location.pathname)) { if (whiteLists.includes(location.pathname)) {
return return
......
...@@ -2,34 +2,44 @@ import React, { useEffect, useMemo, useState } from 'react' ...@@ -2,34 +2,44 @@ import React, { useEffect, useMemo, useState } from 'react'
import Information from '../components/Information' import Information from '../components/Information'
import FloorAnchor from '../components/FloorAnchor' import FloorAnchor from '../components/FloorAnchor'
import CommonTitle from '../components/CommonTitle' import CommonTitle from '../components/CommonTitle'
import FloorSkeleton from '../components/FloorSkeleton'
import { Advert, ShopFloorLine } from 'lingxi-design-ui' import { Advert, ShopFloorLine } from 'lingxi-design-ui'
import AboutUs from '../components/AboutUs' import AboutUs from '../components/AboutUs'
import { inject, observer } from 'mobx-react' import { inject, observer } from 'mobx-react'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import Loading from '../components/Loading' import { LAYOUT_TYPE } from '@/constants'
import { GetTemplatePlatformFindAllFirstCategoryResponse } from '@/services' import { GetTemplatePlatformFindAllFirstCategoryResponse, GetTemplateChannelFindChannelResponse } from '@/services/TemplateApi'
import styles from './index.less' import styles from './index.less'
interface ChannelIndexPropsType { interface ChannelIndexPropsType {
SiteStore?: any; SiteStore?: any;
memberId: number;
shopId: number;
shopUrlParam: string;
shopInfo: GetTemplateChannelFindChannelResponse
} }
const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => { const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
const { channelTemplateId } = props.SiteStore const { memberId, shopUrlParam, shopInfo } = props
const [categoryList, setCategoryList] = useState<GetTemplatePlatformFindAllFirstCategoryResponse>([]) const [categoryList, setCategoryList] = useState<GetTemplatePlatformFindAllFirstCategoryResponse>([])
const [firstAdvertList, setFirstAdvertList] = useState([]) const [firstAdvertList, setFirstAdvertList] = useState([])
const [secondAdvertList, setSecondAdvertList] = useState([]) const [secondAdvertList, setSecondAdvertList] = useState([])
const [categoryComponents, setCategoryComponents] = useState<React.ReactNode>() const [categoryComponents, setCategoryComponents] = useState<React.ReactNode>()
useEffect(() => { useEffect(() => {
getCategoryComponents() if (shopInfo) {
findFirstAdvertsByType() console.log(shopInfo, "shopInfo")
findSecondAdvertsByType() if (shopInfo.templateId) {
}, []) getCategoryComponents()
findFirstAdvertsByType()
findSecondAdvertsByType()
}
}
}, [shopInfo])
const findFirstAdvertsByType = () => { const findFirstAdvertsByType = () => {
let params = { let params = {
templateId: channelTemplateId, templateId: shopInfo.templateId,
type: 1 type: 1
} }
//@ts-ignore //@ts-ignore
...@@ -42,7 +52,7 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => { ...@@ -42,7 +52,7 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
const findSecondAdvertsByType = () => { const findSecondAdvertsByType = () => {
let params = { let params = {
templateId: channelTemplateId, templateId: shopInfo.templateId,
type: 2 type: 2
} }
//@ts-ignore //@ts-ignore
...@@ -73,7 +83,7 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => { ...@@ -73,7 +83,7 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
const fetchCategoryById = (categoryId) => { const fetchCategoryById = (categoryId) => {
return new Promise((resolve) => { return new Promise((resolve) => {
let param = { let param = {
templateId: channelTemplateId, templateId: shopInfo.templateId,
categoryId categoryId
} }
...@@ -115,11 +125,11 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => { ...@@ -115,11 +125,11 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
<FloorAnchor anchorList={categoryList} type="shop" /> <FloorAnchor anchorList={categoryList} type="shop" />
<CommonTitle title="热销商品" type="primary" /> <CommonTitle title="热销商品" type="primary" />
{ {
categoryComponents ? categoryComponents : <Loading /> categoryComponents ? categoryComponents : <FloorSkeleton type={LAYOUT_TYPE.shop} />
} }
<Advert type="service" advertList={secondAdvertList} /> <Advert type="service" advertList={secondAdvertList} />
<CommonTitle title="关于我们" type="primary" /> <CommonTitle title="关于我们" type="primary" />
<AboutUs /> <AboutUs shopInfo={shopInfo} shopUrlParam={shopUrlParam} />
<Information /> <Information />
</div > </div >
) )
......
...@@ -3,7 +3,7 @@ import cx from 'classnames' ...@@ -3,7 +3,7 @@ import cx from 'classnames'
import { Link } from 'umi' import { Link } from 'umi'
import { ArrowRightOutlined } from '@ant-design/icons' import { ArrowRightOutlined } from '@ant-design/icons'
import { Carousel } from 'antd' import { Carousel } from 'antd'
import { GetTemplateShopFindShopResponse } from '@/services/TemplateApi' import { GetTemplateShopFindShopResponse, GetTemplateChannelFindChannelResponse } from '@/services/TemplateApi'
import styles from './index.less' import styles from './index.less'
enum TAB_TYPE { enum TAB_TYPE {
...@@ -12,7 +12,7 @@ enum TAB_TYPE { ...@@ -12,7 +12,7 @@ enum TAB_TYPE {
} }
interface AboutUsPropsType { interface AboutUsPropsType {
shopInfo: GetTemplateShopFindShopResponse, shopInfo: GetTemplateShopFindShopResponse | GetTemplateChannelFindChannelResponse,
shopUrlParam?: string shopUrlParam?: string
} }
......
...@@ -21,23 +21,25 @@ interface ChannelIndexPropsType { ...@@ -21,23 +21,25 @@ interface ChannelIndexPropsType {
} }
const ShopIndex: React.FC<ChannelIndexPropsType> = (props) => { const ShopIndex: React.FC<ChannelIndexPropsType> = (props) => {
const { shopTemplateId } = props.SiteStore const { memberId, shopUrlParam, shopInfo } = props
const { shopId, memberId, shopUrlParam, shopInfo } = props
const [categoryList, setCategoryList] = useState<GetTemplatePlatformFindAllFirstCategoryResponse>([]) const [categoryList, setCategoryList] = useState<GetTemplatePlatformFindAllFirstCategoryResponse>([])
const [firstAdvertList, setFirstAdvertList] = useState([]) const [firstAdvertList, setFirstAdvertList] = useState([])
const [secondAdvertList, setSecondAdvertList] = useState([]) const [secondAdvertList, setSecondAdvertList] = useState([])
// const [shopInfo, setShopInfo] = useState<GetTemplateShopFindShopResponse>()
const [categoryComponents, setCategoryComponents] = useState<React.ReactNode>() const [categoryComponents, setCategoryComponents] = useState<React.ReactNode>()
useEffect(() => { useEffect(() => {
getCategoryComponents() if (shopInfo) {
findFirstAdvertsByType() if (shopInfo.templateId) {
findSecondAdvertsByType() getCategoryComponents()
}, []) findFirstAdvertsByType()
findSecondAdvertsByType()
}
}
}, [shopInfo])
const findFirstAdvertsByType = () => { const findFirstAdvertsByType = () => {
let params = { let params = {
templateId: shopTemplateId, templateId: shopInfo.templateId,
type: 1, type: 1,
memberId memberId
} }
...@@ -51,7 +53,7 @@ const ShopIndex: React.FC<ChannelIndexPropsType> = (props) => { ...@@ -51,7 +53,7 @@ const ShopIndex: React.FC<ChannelIndexPropsType> = (props) => {
const findSecondAdvertsByType = () => { const findSecondAdvertsByType = () => {
let params = { let params = {
templateId: shopTemplateId, templateId: shopInfo.templateId,
type: 2, type: 2,
memberId memberId
} }
...@@ -84,7 +86,7 @@ const ShopIndex: React.FC<ChannelIndexPropsType> = (props) => { ...@@ -84,7 +86,7 @@ const ShopIndex: React.FC<ChannelIndexPropsType> = (props) => {
const fetchCategoryById = (categoryId) => { const fetchCategoryById = (categoryId) => {
return new Promise((resolve) => { return new Promise((resolve) => {
let param = { let param = {
templateId: shopTemplateId, templateId: shopInfo.templateId,
categoryId, categoryId,
memberId memberId
} }
......
...@@ -9,8 +9,8 @@ class SiteStore implements ISiteModule { ...@@ -9,8 +9,8 @@ class SiteStore implements ISiteModule {
@observable public siteUrl: string = GlobalConfig.global.siteUrl; // 站点域名 @observable public siteUrl: string = GlobalConfig.global.siteUrl; // 站点域名
@observable public mallTemplateId: number = null; // 企业商城模板id @observable public mallTemplateId: number = null; // 企业商城模板id
@observable public mallTemplateInfo: any = {}; // 企业商城模板id @observable public mallTemplateInfo: any = {}; // 企业商城模板id
@observable public shopTemplateId: number = 708; // 店铺模板id @observable public shopTemplateId: number = null; // 店铺模板id
@observable public channelTemplateId: number = 903; // 渠道模板id @observable public channelTemplateId: number = null; // 渠道模板id
@observable public commodityTemplateInfo: any = {} @observable public commodityTemplateInfo: any = {}
/** /**
......
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