Commit d633b502 authored by 程卓's avatar 程卓

根据打包命令展示对应的菜单(可自定义展示部分公共菜单),优化main.js中的子项目注册,

parent 31dae2ed
...@@ -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':
system = micSystemsList.sit
break
case 'pudong-prod':
system = micSystemsList.prod
break
// case env.indexOf('xuhui') > -1:
case 'xuhui-sit':
system = micSystemsList.sit
break
case 'xuhui-prod':
system = micSystemsList.prod
break
case 'huangpu-sit': if(env.indexOf('prod') != -1 ){
system = micSystemsList.sit
break
case 'huangpu-prod':
system = micSystemsList.prod
break
case 'yangpu-sit':
system = micSystemsList.sit
break
case 'yangpu-prod':
system = micSystemsList.prod system = micSystemsList.prod
break }else{
default: // 当前仅可使用pudong / xuhui-sit/uat进行打包
system = micSystemsList.sit system = micSystemsList.sit
break
} }
let projects = [] let projects = []
......
...@@ -149,5 +149,4 @@ ...@@ -149,5 +149,4 @@
] ]
} }
]} ]}
\ No newline at end of file
...@@ -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
{ {
"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
{
"pudong": [
{
"path": "/documents/fiveSearch", "name": "fiveSearch",
"meta": { "title": "物业三查", "menuPath": true,"authCode":"0007", "menuIcon": "profile", "hideInBread": true },
"children": [
{
"path": "/documents/fiveSearch/managerSelfCheckList", "name": "managerSelfCheckList",
"meta": { "title": "小区经理自查", "menuPath": true,"authCode":"000701", "hideInBread": false},
"children": [
{
"path": "/documents/fiveSearch/managerSelfCheckList/managerCheckList", "name": "managerCheckList",
"meta": { "title": "小区经理自查检查单列表","authCode":"000701", "menuPath": false, "hideInBread": false }
},
{
"path": "/documents/fiveSearch/managerSelfCheckList/managerCheckInfo", "name": "managerCheckInfo",
"meta": { "title": "小区经理自查检查单详情","authCode":"00070101", "menuPath": false, "hideInBread": false }
},
{
"path": "/documents/fiveSearch/managerSelfCheckList/managerAllIn", "name": "allIn",
"meta": { "title": "街道检查情况汇总","authCode":"00070102", "menuPath": false, "hideInBread": false }
}
]
},
{
"path": "/documents/fiveSearch/doubleWeekCheckList", "name": "doubleWeekCheckList",
"meta": { "title": "物企双周查","authCode":"000702", "menuPath": true, "hideInBread": false },
"children": [
{
"path": "/documents/fiveSearch/doubleWeekCheckList/doubleCheckList", "name": "doubleCheckList",
"meta": { "title": "物企双周查列表","authCode":"000702" ,"menuPath": false, "hideInBread": false }
},
{
"path": "/documents/fiveSearch/doubleWeekCheckList/doubleCheckInfo", "name": "doubleCheckInfo",
"meta": { "title": "物企双周查详情","authCode":"00070201", "menuPath": false, "hideInBread": false }
},
{
"path": "/documents/fiveSearch/doubleWeekCheckList/doubleAllIn", "name": "allIn",
"meta": { "title": "街道检查情况汇总","authCode":"00070202", "menuPath": false, "hideInBread": false}
}
]
},
{
"path": "/documents/fiveSearch/monthList", "name": "month",
"meta": { "title": "房办月查","authCode":"000704", "menuIcon": "profile", "menuPath": true, "hideInBread": false },
"children": [
{
"path": "/documents/fiveSearch/monthList/monthListSect", "name": "monthListSect",
"meta": { "title": "房办月查小区列表","authCode":"000704", "menuPath": true, "hideInBread": false },
"children": [
{
"path": "/documents/fiveSearch/monthList/monthListSect/monthInfo", "name": "monthInfo",
"meta": { "title": "检查详情","authCode":"00070401", "menuPath": false, "hideInBread": false }
}
]
}
]
},
{
"path": "/documents/fiveSearch/mutableList", "name": "mutableList",
"meta": { "title": "整改单列表","authCode":"000703", "menuPath": true, "hideInBread": false },
"children": [
{
"path": "/documents/fiveSearch/mutableList/info", "name": "mutableInfo",
"meta": { "title": "整改单详情","authCode":"00070301", "menuPath": false, "hideInBread": false }
}
]
}
]
},
{
"path": "/documents/repair", "name": "repairList",
"meta": { "title": "应急报修","authCode":"0005", "menuIcon": "profile", "menuPath": true, "hideInBread": false },
"children": [
{
"path": "/documents/repair/repairList", "name": "repairInnerList",
"meta": { "title": "应急报修列表","authCode":"000501", "menuIcon": "profile", "menuPath": true, "hideInBread": false },
"children": [
{
"path": "/documents/repair/repairInfo", "name": "repairInfo",
"meta": { "title": "报修详情","authCode":"000501", "menuPath": false, "hideInBread": false }
}
]
}
]
}
],
"yangpu": [
{
"path": "/documents/fiveSearch", "name": "fiveSearch",
"meta": { "title": "物业三查", "menuPath": true,"authCode":"0007", "menuIcon": "profile", "hideInBread": true },
"children": [
{
"path": "/documents/fiveSearch/managerSelfCheckList", "name": "managerSelfCheckList",
"meta": { "title": "小区经理自查", "menuPath": true,"authCode":"000701", "hideInBread": false},
"children": [
{
"path": "/documents/fiveSearch/managerSelfCheckList/managerCheckList", "name": "managerCheckList",
"meta": { "title": "小区经理自查检查单列表","authCode":"000701", "menuPath": false, "hideInBread": false }
},
{
"path": "/documents/fiveSearch/managerSelfCheckList/managerCheckInfo", "name": "managerCheckInfo",
"meta": { "title": "小区经理自查检查单详情","authCode":"00070101", "menuPath": false, "hideInBread": false }
},
{
"path": "/documents/fiveSearch/managerSelfCheckList/managerAllIn", "name": "allIn",
"meta": { "title": "街道检查情况汇总","authCode":"00070102", "menuPath": false, "hideInBread": false }
}
]
},
{
"path": "/documents/fiveSearch/doubleWeekCheckList", "name": "doubleWeekCheckList",
"meta": { "title": "物企双周查","authCode":"000702", "menuPath": true, "hideInBread": false },
"children": [
{
"path": "/documents/fiveSearch/doubleWeekCheckList/doubleCheckList", "name": "doubleCheckList",
"meta": { "title": "物企双周查列表","authCode":"000702" ,"menuPath": false, "hideInBread": false }
},
{
"path": "/documents/fiveSearch/doubleWeekCheckList/doubleCheckInfo", "name": "doubleCheckInfo",
"meta": { "title": "物企双周查详情","authCode":"00070201", "menuPath": false, "hideInBread": false }
},
{
"path": "/documents/fiveSearch/doubleWeekCheckList/doubleAllIn", "name": "allIn",
"meta": { "title": "街道检查情况汇总","authCode":"00070202", "menuPath": false, "hideInBread": false}
}
]
},
{
"path": "/documents/fiveSearch/monthList", "name": "month",
"meta": { "title": "房办月查","authCode":"000704", "menuIcon": "profile", "menuPath": true, "hideInBread": false },
"children": [
{
"path": "/documents/fiveSearch/monthList/monthListSect", "name": "monthListSect",
"meta": { "title": "房办月查小区列表","authCode":"000704", "menuPath": true, "hideInBread": false },
"children": [
{
"path": "/documents/fiveSearch/monthList/monthListSect/monthInfo", "name": "monthInfo",
"meta": { "title": "检查详情","authCode":"00070401", "menuPath": false, "hideInBread": false }
}
]
}
]
},
{
"path": "/documents/fiveSearch/mutableList", "name": "mutableList",
"meta": { "title": "整改单列表","authCode":"000703", "menuPath": true, "hideInBread": false },
"children": [
{
"path": "/documents/fiveSearch/mutableList/info", "name": "mutableInfo",
"meta": { "title": "整改单详情","authCode":"00070301", "menuPath": false, "hideInBread": false }
}
]
}
]
},
{
"path": "/documents/repair", "name": "repairList",
"meta": { "title": "应急报修","authCode":"0005", "menuIcon": "profile", "menuPath": true, "hideInBread": false },
"children": [
{
"path": "/documents/repair/repairList", "name": "repairInnerList",
"meta": { "title": "应急报修列表","authCode":"000501", "menuIcon": "profile", "menuPath": true, "hideInBread": false },
"children": [
{
"path": "/documents/repair/repairInfo", "name": "repairInfo",
"meta": { "title": "报修详情","authCode":"000501", "menuPath": false, "hideInBread": false }
}
]
}
]
}
],
"huangpu": [
{
"path": "/documents/fiveSearch", "name": "fiveSearch",
"meta": { "title": "物业三查", "menuPath": true,"authCode":"0007", "menuIcon": "profile", "hideInBread": true },
"children": [
{
"path": "/documents/fiveSearch/managerSelfCheckList", "name": "managerSelfCheckList",
"meta": { "title": "小区经理自查", "menuPath": true,"authCode":"000701", "hideInBread": false},
"children": [
{
"path": "/documents/fiveSearch/managerSelfCheckList/managerCheckList", "name": "managerCheckList",
"meta": { "title": "小区经理自查检查单列表","authCode":"000701", "menuPath": false, "hideInBread": false }
},
{
"path": "/documents/fiveSearch/managerSelfCheckList/managerCheckInfo", "name": "managerCheckInfo",
"meta": { "title": "小区经理自查检查单详情","authCode":"00070101", "menuPath": false, "hideInBread": false }
},
{
"path": "/documents/fiveSearch/managerSelfCheckList/managerAllIn", "name": "allIn",
"meta": { "title": "街道检查情况汇总","authCode":"00070102", "menuPath": false, "hideInBread": false }
}
]
},
{
"path": "/documents/fiveSearch/doubleWeekCheckList", "name": "doubleWeekCheckList",
"meta": { "title": "物企双周查","authCode":"000702", "menuPath": true, "hideInBread": false },
"children": [
{
"path": "/documents/fiveSearch/doubleWeekCheckList/doubleCheckList", "name": "doubleCheckList",
"meta": { "title": "物企双周查列表","authCode":"000702" ,"menuPath": false, "hideInBread": false }
},
{
"path": "/documents/fiveSearch/doubleWeekCheckList/doubleCheckInfo", "name": "doubleCheckInfo",
"meta": { "title": "物企双周查详情","authCode":"00070201", "menuPath": false, "hideInBread": false }
},
{
"path": "/documents/fiveSearch/doubleWeekCheckList/doubleAllIn", "name": "allIn",
"meta": { "title": "街道检查情况汇总","authCode":"00070202", "menuPath": false, "hideInBread": false}
}
]
},
{
"path": "/documents/fiveSearch/monthList", "name": "month",
"meta": { "title": "房办月查","authCode":"000704", "menuIcon": "profile", "menuPath": true, "hideInBread": false },
"children": [
{
"path": "/documents/fiveSearch/monthList/monthListSect", "name": "monthListSect",
"meta": { "title": "房办月查小区列表","authCode":"000704", "menuPath": true, "hideInBread": false },
"children": [
{
"path": "/documents/fiveSearch/monthList/monthListSect/monthInfo", "name": "monthInfo",
"meta": { "title": "检查详情","authCode":"00070401", "menuPath": false, "hideInBread": false }
}
]
}
]
},
{
"path": "/documents/fiveSearch/mutableList", "name": "mutableList",
"meta": { "title": "整改单列表","authCode":"000703", "menuPath": true, "hideInBread": false },
"children": [
{
"path": "/documents/fiveSearch/mutableList/info", "name": "mutableInfo",
"meta": { "title": "整改单详情","authCode":"00070301", "menuPath": false, "hideInBread": false }
}
]
}
]
},
{
"path": "/documents/repair", "name": "repairList",
"meta": { "title": "应急报修","authCode":"0005", "menuIcon": "profile", "menuPath": true, "hideInBread": false },
"children": [
{
"path": "/documents/repair/repairList", "name": "repairInnerList",
"meta": { "title": "应急报修列表","authCode":"000501", "menuIcon": "profile", "menuPath": true, "hideInBread": false },
"children": [
{
"path": "/documents/repair/repairInfo", "name": "repairInfo",
"meta": { "title": "报修详情","authCode":"000501", "menuPath": false, "hideInBread": false }
}
]
}
]
}
]
}
\ No newline at end of file
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)
/** /**
* 此处配置本项目涉及到的所有 * 此处配置本项目涉及到的所有
......
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