Commit 96d97f47 authored by GuanHua's avatar GuanHua

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

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