Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pc
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
wbx-PCAndMobi
pc
Commits
d633b502
Commit
d633b502
authored
May 07, 2021
by
程卓
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
根据打包命令展示对应的菜单(可自定义展示部分公共菜单),优化main.js中的子项目注册,
parent
31dae2ed
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
302 additions
and
154 deletions
+302
-154
main.js
src/main.js
+2
-42
documentsRoutes.json
src/router/documentsRoutes.json
+0
-1
getMicRouters.js
src/router/getMicRouters.js
+24
-35
huangpuRoutes.json
src/router/huangpuRoutes.json
+1
-56
routeByFilter.json
src/router/routeByFilter.json
+263
-0
api.js
src/server/api.js
+12
-20
No files found.
src/main.js
View file @
d633b502
...
@@ -196,51 +196,11 @@ let system //= micSystemsList
...
@@ -196,51 +196,11 @@ let system //= micSystemsList
let
env
=
process
.
env
.
NODE_ENV
let
env
=
process
.
env
.
NODE_ENV
console
.
log
(
process
.
env
.
NODE_ENV
,
'NODE_ENV'
)
console
.
log
(
process
.
env
.
NODE_ENV
,
'NODE_ENV'
)
switch
(
env
)
{
// case env.indexOf('pudong') > -1: // 根据当前打包的项目调用该项目对应的路由
case
'sit'
:
system
=
micSystemsList
.
sit
break
case
'production'
:
system
=
micSystemsList
.
prod
break
case
'pudong-sit'
:
if
(
env
.
indexOf
(
'prod'
)
!=
-
1
){
system
=
micSystemsList
.
sit
break
case
'pudong-prod'
:
system
=
micSystemsList
.
prod
system
=
micSystemsList
.
prod
break
}
else
{
// case env.indexOf('xuhui') > -1:
case
'xuhui-sit'
:
system
=
micSystemsList
.
sit
break
case
'xuhui-prod'
:
system
=
micSystemsList
.
prod
break
case
'huangpu-sit'
:
system
=
micSystemsList
.
sit
break
case
'huangpu-prod'
:
system
=
micSystemsList
.
prod
break
case
'yangpu-sit'
:
system
=
micSystemsList
.
sit
break
case
'yangpu-prod'
:
system
=
micSystemsList
.
prod
break
default
:
// 当前仅可使用pudong / xuhui-sit/uat进行打包
system
=
micSystemsList
.
sit
system
=
micSystemsList
.
sit
break
}
}
let
projects
=
[]
let
projects
=
[]
...
...
src/router/documentsRoutes.json
View file @
d633b502
...
@@ -149,5 +149,4 @@
...
@@ -149,5 +149,4 @@
]
]
}
}
]}
]}
\ No newline at end of file
src/router/getMicRouters.js
View file @
d633b502
...
@@ -7,58 +7,63 @@ import ajax from '@/server/ajax'
...
@@ -7,58 +7,63 @@ import ajax from '@/server/ajax'
import
api
from
'@/server/api'
import
api
from
'@/server/api'
import
documents
from
'@/router/documentsRoutes.json'
import
documents
from
'@/router/documentsRoutes.json'
import
defaultRoutes
from
'@/router/defaultRoutes.json'
import
defaultRoutes
from
'@/router/defaultRoutes.json'
// import removeRoutes from '@/router/getRoutesChoose.js'
import
routeByFilter
from
'@/router/routeByFilter.json'
import
Store
from
'@/store/index'
import
Store
from
'@/store/index'
/**
*
* @param { defaultRoutes , documentsRoutes} 私有菜单(子项目) , 公共菜单(子项目)
* 1. 当打包命令没有指定对应的区局,选用默认私有菜单文件 defaultRoutes(空的菜单) , 在下方会耦合 documentsRoutes(公共菜单) 内的全部菜单做展示
* 2. 打包命令包含区局的情况下, 选用对应区局的私有菜单文件, 并在getRoutesChoose文件中过滤需要展示的documentsRoutes内的菜单,在下方耦合
*
*/
console
.
log
(
routeByFilter
)
async
function
GetRoutes
(
router
)
{
async
function
GetRoutes
(
router
)
{
let
env
=
process
.
env
.
NODE_ENV
let
env
=
process
.
env
.
NODE_ENV
// console.log(env)
// console.log(env)
let
MicRouters
let
MicRouters
switch
(
env
)
{
switch
(
env
)
{
// case env.indexOf('pudong') > -1: // 根据当前打包的项目调用该项目对应的路由
case
'sit'
:
MicRouters
=
defaultRoutes
break
case
'production'
:
MicRouters
=
defaultRoutes
break
case
'pudong-sit'
:
case
'pudong-sit'
:
pudong
.
Layout
=
pudong
.
Layout
.
concat
(
'pudong'
in
routeByFilter
?
routeByFilter
.
pudong
:
documents
.
Layout
)
MicRouters
=
pudong
MicRouters
=
pudong
break
break
case
'pudong-prod'
:
case
'pudong-prod'
:
pudong
.
Layout
=
pudong
.
Layout
.
concat
(
'pudong'
in
routeByFilter
?
routeByFilter
.
pudong
:
documents
.
Layout
)
MicRouters
=
pudong
MicRouters
=
pudong
break
break
// case env.indexOf('xuhui') > -1:
case
'xuhui-sit'
:
case
'xuhui-sit'
:
xuhui
.
Layout
=
xuhui
.
Layout
.
concat
(
'xuhui'
in
routeByFilter
?
routeByFilter
.
xuhui
:
documents
.
Layout
)
MicRouters
=
xuhui
MicRouters
=
xuhui
break
break
case
'xuhui-prod'
:
case
'xuhui-prod'
:
xuhui
.
Layout
=
xuhui
.
Layout
.
concat
(
'xuhui'
in
routeByFilter
?
routeByFilter
.
xuhui
:
documents
.
Layout
)
MicRouters
=
xuhui
MicRouters
=
xuhui
break
break
case
'huangpu-sit'
:
case
'huangpu-sit'
:
huangpu
.
Layout
=
huangpu
.
Layout
.
concat
(
'huangpu'
in
routeByFilter
?
routeByFilter
.
huangpu
:
documents
.
Layout
)
MicRouters
=
huangpu
MicRouters
=
huangpu
break
break
case
'huangpu-prod'
:
case
'huangpu-prod'
:
huangpu
.
Layout
=
huangpu
.
Layout
.
concat
(
'huangpu'
in
routeByFilter
?
routeByFilter
.
huangpu
:
documents
.
Layout
)
MicRouters
=
huangpu
MicRouters
=
huangpu
break
break
case
'yangpu-sit'
:
case
'yangpu-sit'
:
yangpu
.
Layout
=
yangpu
.
Layout
.
concat
(
'yangpu'
in
routeByFilter
?
routeByFilter
.
yangpu
:
documents
.
Layout
)
MicRouters
=
yangpu
MicRouters
=
yangpu
break
break
case
'yangpu-prod'
:
case
'yangpu-prod'
:
yangpu
.
Layout
=
yangpu
.
Layout
.
concat
(
'yangpu'
in
routeByFilter
?
routeByFilter
.
yangpu
:
documents
.
Layout
)
MicRouters
=
yangpu
MicRouters
=
yangpu
break
break
case
'development'
:
// 本地开发展示对应的子项目路由
default
:
// 当前仅可使用pudong / xuhui-sit/uat进行打包
xuhui
.
Layout
=
xuhui
.
Layout
.
concat
(
'xuhui'
in
routeByFilter
?
routeByFilter
.
xuhui
:
documents
.
Layout
)
MicRouters
=
xuhui
MicRouters
=
xuhui
break
break
default
:
// 当命令没有指定的情况下会选用空的私有菜单
MicRouters
=
documents
break
}
}
await
function
()
{
await
function
()
{
...
@@ -96,22 +101,6 @@ async function GetRoutes(router) {
...
@@ -96,22 +101,6 @@ async function GetRoutes(router) {
}
}
}
}
for
(
let
key
in
documents
)
{
for
(
let
i
=
0
;
i
<
documents
[
key
].
length
;
i
++
)
{
let
firstRouter
=
Object
.
assign
({},
documents
[
key
][
i
])
if
(
!!
firstRouter
.
meta
.
openMode
&&
firstRouter
.
meta
.
openMode
==
'outsite'
)
{
firstRouter
.
component
=
TipsOutsite
}
parent
.
children
.
push
(
Object
.
assign
({},
firstRouter
))
router
.
addRoutes
([
parent
])
}
}
// console.log(router)
}
}
export
default
GetRoutes
export
default
GetRoutes
src/router/huangpuRoutes.json
View file @
d633b502
{
{
"Layout"
:
[
"Layout"
:
[
{
"path"
:
"/hp_order/month"
,
"name"
:
"month"
,
"meta"
:
{
"title"
:
"检查单"
,
"menuIcon"
:
"profile"
,
"menuPath"
:
false
,
"hideInBread"
:
false
},
"children"
:[
{
"path"
:
"/hp_order/month/monthList"
,
"name"
:
"month"
,
"meta"
:
{
"title"
:
"房办月查列表"
,
"menuIcon"
:
"profile"
,
"menuPath"
:
false
,
"hideInBread"
:
false
},
"children"
:
[
{
"path"
:
"/hp_order/month/monthInfo"
,
"name"
:
"monthInfo"
,
"meta"
:
{
"title"
:
"检查详情"
,
"menuPath"
:
false
,
"hideInBread"
:
false
}
}
]
}
]
},
{
"path"
:
"/hp_question/repair"
,
"name"
:
"repairList"
,
"meta"
:
{
"title"
:
"应急报修"
,
"menuIcon"
:
"profile"
,
"menuPath"
:
false
,
"hideInBread"
:
false
},
"children"
:[
{
"path"
:
"/hp_question/repair/repairList"
,
"name"
:
"repairList"
,
"meta"
:
{
"title"
:
"应急报修列表"
,
"menuIcon"
:
"profile"
,
"menuPath"
:
false
,
"hideInBread"
:
false
},
"children"
:
[
{
"path"
:
"/hp_question/repair/repairInfo"
,
"name"
:
"repairInfo"
,
"meta"
:
{
"title"
:
"报修详情"
,
"menuPath"
:
false
,
"hideInBread"
:
false
}
}
]
}
]
},
{
"path"
:
"/hp_question/tousu"
,
"name"
:
"tousu"
,
"meta"
:
{
"title"
:
"投诉信息"
,
"menuPath"
:
true
,
"menuIcon"
:
"profile"
,
"hideInBread"
:
true
},
"children"
:
[
{
"path"
:
"/hp_question/tousu/tousuQuestion"
,
"name"
:
"tousuQuestion"
,
"meta"
:
{
"title"
:
"投诉问题排行"
,
"menuPath"
:
true
,
"hideInBread"
:
false
},
"children"
:[
{
"path"
:
"/hp_question/tousu/tousuQuestion/questionInfo"
,
"name"
:
"questionInfo"
,
"meta"
:
{
"title"
:
"投诉问题列表"
,
"menuPath"
:
false
,
"hideInBread"
:
false
}
},
{
"path"
:
"/hp_question/tousu/tousuQuestion/tousuDetails"
,
"name"
:
"tousuDetails"
,
"meta"
:
{
"title"
:
"投诉问题详情"
,
"menuPath"
:
false
,
"hideInBread"
:
false
}
}
]
},
{
"path"
:
"/hp_question/tousu/tousuDensity"
,
"name"
:
"tousuDensity"
,
"meta"
:
{
"title"
:
"投诉密度排行"
,
"menuPath"
:
true
,
"hideInBread"
:
false
}
}
]
}
]
]
}
}
\ No newline at end of file
src/router/routeByFilter.json
0 → 100644
View file @
d633b502
This diff is collapsed.
Click to expand it.
src/server/api.js
View file @
d633b502
let
BASE_URL
=
''
,
MOCK_URL
=
''
,
let
BASE_URL
=
''
,
MOCK_URL
=
''
,
FANGDI_URL
=
'http://962121.fgj.sh.gov.cn/wyweb/shanghaiwuye'
FANGDI_URL
=
'http://962121.fgj.sh.gov.cn/wyweb/shanghaiwuye'
/**
* todo
* 1、此处配置当前项目在不同环境下的API请求前缀
* 2、前端服务间、后端服务间需做跨域处理
*/
/**
/**
*
*
* 此处
为不同项目所使用的不同接口api
, 根据当前浏览器访问的地址来变更对应的接口地址
* 此处
配置当前项目在不同环境下的API请求前缀
, 根据当前浏览器访问的地址来变更对应的接口地址
* 如果有新增的区局项目 需要将对应的接口地址放入此数组中
* 如果有新增的区局项目 需要将对应的接口地址
前缀
放入此数组中
*/
*/
const
apiList
=
[
const
apiList
=
[
'http://pudong.hm.omniview.pro/api/v2'
,
//浦东sit
'http://pudong.hm.omniview.pro/api/v2'
,
//
浦东sit
'http://10.220.105.137:81/api'
,
//浦东prod
'http://10.220.105.137:81/api'
,
//
浦东prod
'http://xuhui.hm.omniview.pro/api/v2'
,
//徐汇sit
'http://xuhui.hm.omniview.pro/api/v2'
,
//
徐汇sit
'http://31.0.161.39/apiv2'
,
//徐汇prod
'http://31.0.161.39/apiv2'
,
//
徐汇prod
'http://yangpu-hm.omniview.pro/api/v2'
,
//杨浦sit
'http://yangpu-hm.omniview.pro/api/v2'
,
//
杨浦sit
'http://10.216.118.142/api'
,
//杨浦prod
'http://10.216.118.142/api'
,
//
杨浦prod
'http://huangpu.hm.omniview.pro/api/v2'
,
//黄浦sit
'http://huangpu.hm.omniview.pro/api/v2'
,
//
黄浦sit
'http://172.82.26.1/api'
,
//黄浦prod
'http://172.82.26.1/api'
,
//
黄浦prod
]
]
MOCK_URL
=
'https://yapi.omniview.pro/mock/283'
// yapi上的mock地址
MOCK_URL
=
'https://yapi.omniview.pro/mock/283'
// yapi上的mock地址
// 根据当前地址栏访问的地址来决定接口访问的前缀 (生产或测试环境)
//
1.
根据当前地址栏访问的地址来决定接口访问的前缀 (生产或测试环境)
if
(
apiList
.
find
(
item
=>
item
.
indexOf
(
window
.
location
.
origin
)
!=
-
1
))
{
if
(
apiList
.
find
(
item
=>
item
.
indexOf
(
window
.
location
.
origin
)
!=
-
1
))
{
BASE_URL
=
apiList
.
find
(
item
=>
item
.
indexOf
(
window
.
location
.
origin
)
!=
-
1
)
BASE_URL
=
apiList
.
find
(
item
=>
item
.
indexOf
(
window
.
location
.
origin
)
!=
-
1
)
}
else
{
// 2.本地开发环境需要自行调整对应的接口地址前缀
}
else
{
// 本地开发环境需要自行调整对应的接口地址
// BASE_URL = 'http://31.0.161.39/apiv2'
// BASE_URL = 'http://31.0.161.39/apiv2'
// BASE_URL = 'http://211.136.105.193/apiv2'
// BASE_URL = 'http://211.136.105.193/apiv2'
// BASE_URL = 'http://yangpu-hm.omniview.pro/api/v2'
// BASE_URL = 'http://yangpu-hm.omniview.pro/api/v2'
...
@@ -37,7 +30,6 @@ if (apiList.find(item => item.indexOf(window.location.origin) != -1 )) {
...
@@ -37,7 +30,6 @@ if (apiList.find(item => item.indexOf(window.location.origin) != -1 )) {
// BASE_URL = 'http://pudong.hm.omniview.pro/api/v2'
// BASE_URL = 'http://pudong.hm.omniview.pro/api/v2'
// BASE_URL = 'http://211.136.105.193/apiv2'
// BASE_URL = 'http://211.136.105.193/apiv2'
}
}
console
.
log
(
BASE_URL
)
/**
/**
* 此处配置本项目涉及到的所有
* 此处配置本项目涉及到的所有
...
...
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