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
2d28ba59
Commit
2d28ba59
authored
Oct 26, 2020
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:根据pass配置动态配置渠道商城路由
parent
5698db1b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
37 deletions
+26
-37
index.ts
config/channelRoutes/index.ts
+3
-15
config.ts
config/config.ts
+0
-1
index.ts
config/mallRoutes/index.ts
+4
-2
index.ts
config/selfchannelRoutes/index.ts
+3
-15
utils.ts
config/utils.ts
+12
-0
index.ts
src/global/config/index.ts
+4
-4
No files found.
config/channelRoutes/index.ts
View file @
2d28ba59
import
BASE_CONFIG
from
'../base.config.json'
import
BASE_CONFIG
from
'../base.config.json'
import
{
MALL_ROUTE_USE_CONFIG
}
from
'../config
'
import
{
checkUrl
}
from
'../utils
'
const
shopInfo
=
BASE_CONFIG
.
web
.
shopInfo
const
shopInfo
=
BASE_CONFIG
.
web
.
shopInfo
let
webChannelInfo
=
shopInfo
.
filter
(
item
=>
item
.
environment
===
1
&&
item
.
type
===
3
)[
0
]
// 渠道商城
let
webChannelInfo
=
shopInfo
.
filter
(
item
=>
item
.
environment
===
1
&&
item
.
type
===
3
)[
0
]
// 渠道商城
let
webChannelPointInfo
=
shopInfo
.
filter
(
item
=>
item
.
environment
===
1
&&
item
.
type
===
5
)[
0
]
// 渠道积分商城
let
webChannelPointInfo
=
shopInfo
.
filter
(
item
=>
item
.
environment
===
1
&&
item
.
type
===
5
)[
0
]
// 渠道积分商城
const
checkUrl
=
(
url
,
defaultUrl
)
=>
{
if
(
url
)
{
if
(
url
.
indexOf
(
'/'
)
>
-
1
)
{
return
url
}
else
{
return
`/
${
url
}
`
}
}
else
{
return
defaultUrl
}
}
const
defaultChannelRoute
=
'/channelmall'
// 默认渠道商城根路径
const
defaultChannelRoute
=
'/channelmall'
// 默认渠道商城根路径
const
defaultIChannelPointRoute
=
'/pointsMall'
// 默认渠道积分商城路径
const
defaultIChannelPointRoute
=
'/pointsMall'
// 默认渠道积分商城路径
const
rootRoute
=
MALL_ROUTE_US
E_CONFIG
?
checkUrl
(
webChannelInfo
.
url
,
defaultChannelRoute
)
:
defaultChannelRoute
const
rootRoute
=
process
.
env
.
USE_ROUT
E_CONFIG
?
checkUrl
(
webChannelInfo
.
url
,
defaultChannelRoute
)
:
defaultChannelRoute
const
pointMallRoute
=
MALL_ROUTE_US
E_CONFIG
?
checkUrl
(
webChannelPointInfo
.
url
,
defaultIChannelPointRoute
)
:
defaultIChannelPointRoute
const
pointMallRoute
=
process
.
env
.
USE_ROUT
E_CONFIG
?
checkUrl
(
webChannelPointInfo
.
url
,
defaultIChannelPointRoute
)
:
defaultIChannelPointRoute
const
ChannelRoute
=
{
const
ChannelRoute
=
{
path
:
rootRoute
,
path
:
rootRoute
,
...
...
config/config.ts
View file @
2d28ba59
...
@@ -3,7 +3,6 @@ import routes from './router'
...
@@ -3,7 +3,6 @@ import routes from './router'
import
proxy
from
'./proxy'
import
proxy
from
'./proxy'
import
theme
from
'./lingxi.theme.config'
import
theme
from
'./lingxi.theme.config'
export
const
MALL_ROUTE_USE_CONFIG
=
process
.
env
.
USE_ROUTE_CONFIG
||
true
// 是否使用pass平台配置的商城子域名
const
OPEN_THEME_BUILD
=
process
.
env
.
NODE_ENV
===
'production'
?
true
:
false
// 是否开启动态主题
const
OPEN_THEME_BUILD
=
process
.
env
.
NODE_ENV
===
'production'
?
true
:
false
// 是否开启动态主题
const
config
:
any
=
{
const
config
:
any
=
{
...
...
config/mallRoutes/index.ts
View file @
2d28ba59
import
shopRoute
from
'../shopRoutes'
import
shopRoute
from
'../shopRoutes'
import
channelRoute
from
'../channelRoutes'
import
channelRoute
from
'../channelRoutes'
import
ichannelRoute
from
'../selfchannelRoutes'
import
ichannelRoute
from
'../selfchannelRoutes'
import
{
MALL_ROUTE_USE_CONFIG
}
from
'../config'
import
BASE_CONFIG
from
'../base.config.json'
import
BASE_CONFIG
from
'../base.config.json'
import
{
checkUrl
}
from
'../utils'
const
shopInfo
=
BASE_CONFIG
.
web
.
shopInfo
const
shopInfo
=
BASE_CONFIG
.
web
.
shopInfo
// let webMallInfo = shopInfo.filter(item => item.environment === 1 && item.type === 1)[0] // 企业商城
// let webMallInfo = shopInfo.filter(item => item.environment === 1 && item.type === 1)[0] // 企业商城
let
webPointMallInfo
=
shopInfo
.
filter
(
item
=>
item
.
environment
===
1
&&
item
.
type
===
2
)[
0
]
// 积分商城
let
webPointMallInfo
=
shopInfo
.
filter
(
item
=>
item
.
environment
===
1
&&
item
.
type
===
2
)[
0
]
// 积分商城
const
defaultPointMallRoute
=
'/pointsMall'
// 积分商城默认路径
const
defaultPointMallRoute
=
'/pointsMall'
// 积分商城默认路径
const
pointMallRoute
=
MALL_ROUTE_USE_CONFIG
?
webPointMallInfo
.
url
||
defaultPointMallRoute
:
defaultPointMallRoute
const
pointMallRoute
=
process
.
env
.
USE_ROUTE_CONFIG
?
checkUrl
(
webPointMallInfo
.
url
,
defaultPointMallRoute
)
:
defaultPointMallRoute
console
.
log
(
process
.
env
.
USE_ROUTE_CONFIG
,
checkUrl
(
webPointMallInfo
.
url
,
defaultPointMallRoute
),
pointMallRoute
,
"pointMallRoute"
)
const
mallRoute
=
{
const
mallRoute
=
{
path
:
'/'
,
path
:
'/'
,
...
...
config/selfchannelRoutes/index.ts
View file @
2d28ba59
import
BASE_CONFIG
from
'../base.config.json'
import
BASE_CONFIG
from
'../base.config.json'
import
{
MALL_ROUTE_USE_CONFIG
}
from
'../config
'
import
{
checkUrl
}
from
'../utils
'
const
shopInfo
=
BASE_CONFIG
.
web
.
shopInfo
const
shopInfo
=
BASE_CONFIG
.
web
.
shopInfo
let
webIChannelInfo
=
shopInfo
.
filter
(
item
=>
item
.
environment
===
1
&&
item
.
type
===
4
)[
0
]
// 渠道自有商城
let
webIChannelInfo
=
shopInfo
.
filter
(
item
=>
item
.
environment
===
1
&&
item
.
type
===
4
)[
0
]
// 渠道自有商城
let
webChannelPointInfo
=
shopInfo
.
filter
(
item
=>
item
.
environment
===
1
&&
item
.
type
===
5
)[
0
]
// 渠道积分商城
let
webChannelPointInfo
=
shopInfo
.
filter
(
item
=>
item
.
environment
===
1
&&
item
.
type
===
5
)[
0
]
// 渠道积分商城
const
checkUrl
=
(
url
,
defaultUrl
)
=>
{
if
(
url
)
{
if
(
url
.
indexOf
(
'/'
)
>
-
1
)
{
return
url
}
else
{
return
`/
${
url
}
`
}
}
else
{
return
defaultUrl
}
}
const
defaultIChannelRoute
=
'/ichannelmall'
// 默认渠道商城根路径
const
defaultIChannelRoute
=
'/ichannelmall'
// 默认渠道商城根路径
const
defaultIChannelPointRoute
=
'/pointsMall'
// 默认渠道积分商城路径
const
defaultIChannelPointRoute
=
'/pointsMall'
// 默认渠道积分商城路径
const
rootRoute
=
MALL_ROUTE_US
E_CONFIG
?
checkUrl
(
webIChannelInfo
.
url
,
defaultIChannelRoute
)
:
defaultIChannelRoute
const
rootRoute
=
process
.
env
.
USE_ROUT
E_CONFIG
?
checkUrl
(
webIChannelInfo
.
url
,
defaultIChannelRoute
)
:
defaultIChannelRoute
const
pointMallRoute
=
MALL_ROUTE_US
E_CONFIG
?
checkUrl
(
webChannelPointInfo
.
url
,
defaultIChannelPointRoute
)
:
defaultIChannelPointRoute
const
pointMallRoute
=
process
.
env
.
USE_ROUT
E_CONFIG
?
checkUrl
(
webChannelPointInfo
.
url
,
defaultIChannelPointRoute
)
:
defaultIChannelPointRoute
const
selfChannelRoute
=
{
const
selfChannelRoute
=
{
path
:
rootRoute
,
path
:
rootRoute
,
...
...
config/utils.ts
0 → 100644
View file @
2d28ba59
export
const
checkUrl
=
(
url
,
defaultUrl
)
=>
{
if
(
url
&&
typeof
url
===
'string'
)
{
if
(
url
.
indexOf
(
'/'
)
>
-
1
)
{
return
url
.
trim
()
}
else
{
return
`/
${
url
}
`
.
trim
()
}
}
else
{
return
defaultUrl
}
}
\ No newline at end of file
src/global/config/index.ts
View file @
2d28ba59
...
@@ -14,12 +14,12 @@ interface newRootObject extends RootObject {
...
@@ -14,12 +14,12 @@ interface newRootObject extends RootObject {
ichannelRootRoute
:
string
;
ichannelRootRoute
:
string
;
}
}
const
checkUrl
=
(
url
,
defaultUrl
)
=>
{
export
const
checkUrl
=
(
url
,
defaultUrl
)
=>
{
if
(
url
)
{
if
(
url
&&
typeof
url
===
'string'
)
{
if
(
url
.
indexOf
(
'/'
)
>
-
1
)
{
if
(
url
.
indexOf
(
'/'
)
>
-
1
)
{
return
url
return
url
.
trim
()
}
else
{
}
else
{
return
`/
${
url
}
`
return
`/
${
url
}
`
.
trim
()
}
}
}
else
{
}
else
{
return
defaultUrl
return
defaultUrl
...
...
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