Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈智峰
jinfa-platform
Commits
96d97f47
Commit
96d97f47
authored
Sep 09, 2020
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:添加路由白名单和店铺商城,渠道商城获取店铺信息的吸怪
parent
c5b41269
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
133 additions
and
42 deletions
+133
-42
index.ts
config/channelRoutes/index.ts
+45
-0
index.ts
config/shopRoutes/index.ts
+24
-8
app.tsx
src/app.tsx
+26
-8
index.tsx
src/pages/lxMall/channel/index.tsx
+22
-12
index.tsx
src/pages/lxMall/components/AboutUs/index.tsx
+2
-2
index.tsx
src/pages/lxMall/shop/index.tsx
+12
-10
index.ts
src/store/site/index.ts
+2
-2
No files found.
config/channelRoutes/index.ts
View file @
96d97f47
...
...
@@ -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'
,
},
...
...
config/shopRoutes/index.ts
View file @
96d97f47
...
...
@@ -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'
,
},
...
...
src/app.tsx
View file @
96d97f47
...
...
@@ -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
...
...
src/pages/lxMall/channel/index.tsx
View file @
96d97f47
...
...
@@ -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
:
channelT
emplateId
,
templateId
:
shopInfo
.
t
emplateId
,
type
:
1
}
//@ts-ignore
...
...
@@ -42,7 +52,7 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
const
findSecondAdvertsByType
=
()
=>
{
let
params
=
{
templateId
:
channelT
emplateId
,
templateId
:
shopInfo
.
t
emplateId
,
type
:
2
}
//@ts-ignore
...
...
@@ -73,7 +83,7 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
const
fetchCategoryById
=
(
categoryId
)
=>
{
return
new
Promise
((
resolve
)
=>
{
let
param
=
{
templateId
:
channelT
emplateId
,
templateId
:
shopInfo
.
t
emplateId
,
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
>
)
...
...
src/pages/lxMall/components/AboutUs/index.tsx
View file @
96d97f47
...
...
@@ -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
}
...
...
src/pages/lxMall/shop/index.tsx
View file @
96d97f47
...
...
@@ -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
:
shop
T
emplateId
,
templateId
:
shop
Info
.
t
emplateId
,
type
:
1
,
memberId
}
...
...
@@ -51,7 +53,7 @@ const ShopIndex: React.FC<ChannelIndexPropsType> = (props) => {
const
findSecondAdvertsByType
=
()
=>
{
let
params
=
{
templateId
:
shop
T
emplateId
,
templateId
:
shop
Info
.
t
emplateId
,
type
:
2
,
memberId
}
...
...
@@ -84,7 +86,7 @@ const ShopIndex: React.FC<ChannelIndexPropsType> = (props) => {
const
fetchCategoryById
=
(
categoryId
)
=>
{
return
new
Promise
((
resolve
)
=>
{
let
param
=
{
templateId
:
shop
T
emplateId
,
templateId
:
shop
Info
.
t
emplateId
,
categoryId
,
memberId
}
...
...
src/store/site/index.ts
View file @
96d97f47
...
...
@@ -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
=
{}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment