Commit ffe608b8 authored by 程卓's avatar 程卓

测试更改打包环境与对应的接口api

parent b03791a6
...@@ -15,10 +15,8 @@ console.log(process.env.NODE_ENV) ...@@ -15,10 +15,8 @@ console.log(process.env.NODE_ENV)
let env let env
if (process.env.NODE_ENV === 'sit') { if (process.env.NODE_ENV === 'sit') {
env = require('../config/sit.env') env = require('../config/sit.env')
} else if (process.env.NODE_ENV === 'uat') { } else if (process.env.NODE_ENV === 'production') {
env = require('../config/uat.env') env = require('../config/prod.env')
} else if (process.env.NODE_ENV === 'devol') {
env = require('../config/devOnline.env')
} else if (process.env.NODE_ENV === 'pudong-sit') { } else if (process.env.NODE_ENV === 'pudong-sit') {
env = require('../config/pudong/sit.env') env = require('../config/pudong/sit.env')
} else if (process.env.NODE_ENV === 'pudong-prod') { } else if (process.env.NODE_ENV === 'pudong-prod') {
......
'use strict'
module.exports = {
NODE_ENV: '"devol"'
}
...@@ -28,7 +28,7 @@ module.exports = { ...@@ -28,7 +28,7 @@ module.exports = {
}, },
// Various Dev Server settings // Various Dev Server settings
host: '0.0.0.0', // can be overwritten by process.env.HOST host: 'localhost', // can be overwritten by process.env.HOST
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: false, autoOpenBrowser: false,
errorOverlay: true, errorOverlay: true,
......
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
"start": "npm run dev", "start": "npm run dev",
"lint": "eslint --fix --ext .js,.vue src", "lint": "eslint --fix --ext .js,.vue src",
"build": "cross-env NODE_ENV='production' node build/build.js", "build": "cross-env NODE_ENV='production' node build/build.js",
"build:devol": "cross-env NODE_ENV='devol' node build/build.js", "build:sit": "cross-env NODE_ENV='sit' node build/build.js",
"build:prod": "cross-env NODE_ENV='production' node build/build.js",
"build:pudong-sit": "cross-env NODE_ENV='pudong-sit' node build/build.js", "build:pudong-sit": "cross-env NODE_ENV='pudong-sit' node build/build.js",
"build:pudong-prod": "cross-env NODE_ENV='pudong-prod' node build/build.js", "build:pudong-prod": "cross-env NODE_ENV='pudong-prod' node build/build.js",
"build:xuhui-sit": "cross-env NODE_ENV='xuhui-sit' node build/build.js", "build:xuhui-sit": "cross-env NODE_ENV='xuhui-sit' node build/build.js",
......
...@@ -195,9 +195,16 @@ const render = ({appContent, loading} = {}) => { // 渲染方法 ...@@ -195,9 +195,16 @@ const render = ({appContent, loading} = {}) => { // 渲染方法
let system //= micSystemsList 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) { switch (env) {
// case env.indexOf('pudong') > -1: // 根据当前打包的项目调用该项目对应的路由 // case env.indexOf('pudong') > -1: // 根据当前打包的项目调用该项目对应的路由
case 'sit':
system = micSystemsList.sit
break
case 'production':
system = micSystemsList.prod
break
case 'pudong-sit': case 'pudong-sit':
system = micSystemsList.sit system = micSystemsList.sit
break break
......
...@@ -14,6 +14,14 @@ async function GetRoutes(router) { ...@@ -14,6 +14,14 @@ async function GetRoutes(router) {
let MicRouters let MicRouters
switch (env) { switch (env) {
// case env.indexOf('pudong') > -1: // 根据当前打包的项目调用该项目对应的路由 // case env.indexOf('pudong') > -1: // 根据当前打包的项目调用该项目对应的路由
case 'sit':
MicRouters = documents
break
case 'production':
MicRouters = documents
break
case 'pudong-sit': case 'pudong-sit':
MicRouters = pudong MicRouters = pudong
break break
......
...@@ -5,73 +5,40 @@ let BASE_URL = '', MOCK_URL='', ...@@ -5,73 +5,40 @@ let BASE_URL = '', MOCK_URL='',
* 1、此处配置当前项目在不同环境下的API请求前缀 * 1、此处配置当前项目在不同环境下的API请求前缀
* 2、前端服务间、后端服务间需做跨域处理 * 2、前端服务间、后端服务间需做跨域处理
*/ */
// console.log(window.location)
console.log(window.location)
switch (process.env.NODE_ENV) {
case 'devol': // 本地线上部署环境下
BASE_URL = 'http://xuhui.hm.omniview.pro/api/v2'
break
case 'pudong-sit':
BASE_URL = 'http://pudong.hm.omniview.pro/api/v2',
FANGDI_URL = 'http://962121.fgj.sh.gov.cn/wyweb/shanghaiwuye'
break
case 'pudong-prod':
// BASE_URL = 'http://211.136.105.193/apiv2',
BASE_URL = 'http://10.220.105.137:81/api'
FANGDI_URL = 'http://962121.fgj.sh.gov.cn/wyweb/shanghaiwuye'
break
case 'xuhui-sit':
BASE_URL = 'http://xuhui.hm.omniview.pro/api/v2',
FANGDI_URL = 'http://962121.fgj.sh.gov.cn/wyweb/shanghaiwuye'
break
case 'xuhui-prod':
BASE_URL = 'http://31.0.161.39/apiv2',
FANGDI_URL = 'http://962121.fgj.sh.gov.cn/wyweb/shanghaiwuye'
break /**
*
case 'yangpu-sit': * 此处为不同项目所使用的不同接口api, 根据当前浏览器访问的地址来变更对应的接口地址
BASE_URL = 'http://yangpu-hm.omniview.pro/api/v2', * 如果有新增的区局项目 需要将对应的接口地址放入此数组中
FANGDI_URL = 'http://962121.fgj.sh.gov.cn/wyweb/shanghaiwuye' */
const apiList = [
break 'http://pudong.hm.omniview.pro/api/v2', //浦东sit
'http://10.220.105.137:81/api', //浦东prod
case 'yangpu-prod': 'http://xuhui.hm.omniview.pro/api/v2', //徐汇sit
BASE_URL = 'http://10.216.118.142/api', 'http://31.0.161.39/apiv2', //徐汇prod
FANGDI_URL = 'http://962121.fgj.sh.gov.cn/wyweb/shanghaiwuye' 'http://yangpu-hm.omniview.pro/api/v2', //杨浦sit
'http://10.216.118.142/api', //杨浦prod
break 'http://huangpu.hm.omniview.pro/api/v2', //黄浦sit
'http://172.82.26.1/api', //黄浦prod
case 'huangpu-sit': ]
BASE_URL = 'http://huangpu.hm.omniview.pro/api/v2',
FANGDI_URL = 'http://962121.fgj.sh.gov.cn/wyweb/shanghaiwuye'
break MOCK_URL = 'https://yapi.omniview.pro/mock/283' // yapi上的mock地址
case 'huangpu-prod': // 根据当前地址栏访问的地址来决定接口访问的前缀 (生产或测试环境)
BASE_URL = 'http://172.82.26.1/api', if (apiList.find(item => item.indexOf(window.location.origin) != -1 )) {
FANGDI_URL = 'http://962121.fgj.sh.gov.cn/wyweb/shanghaiwuye' BASE_URL = apiList.find(item => item.indexOf(window.location.origin) != -1 )
break }else{ // 本地开发环境需要自行调整对应的接口地址
default: // 默认环境下(开发环境)
// 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'
BASE_URL = 'http://xuhui.hm.omniview.pro/api/v2' BASE_URL = 'http://xuhui.hm.omniview.pro/api/v2'
// 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'
MOCK_URL = 'https://yapi.omniview.pro/mock/283'
break
} }
console.log(BASE_URL)
/** /**
* 此处配置本项目涉及到的所有 * 此处配置本项目涉及到的所有
* 要求 * 要求
...@@ -205,8 +172,6 @@ export default { ...@@ -205,8 +172,6 @@ export default {
get_specialInspection: '/service-documents-ddd/statistical/specialInspection', //行业督查数字 get_specialInspection: '/service-documents-ddd/statistical/specialInspection', //行业督查数字
get_month_check: 'service-documents-ddd/dashboard/house/month', get_month_check: 'service-documents-ddd/dashboard/house/month',
GET_LABEL_LIST: MOCK_URL + '/service-customkey-ddd/labels', // 获取标签列表
GET_FB_WY_MANAGE_CHECK: '/service-documents-ddd/checkOrder/dahboard/countDatas', //首页-房办月查-物业双周查-经理自查 GET_FB_WY_MANAGE_CHECK: '/service-documents-ddd/checkOrder/dahboard/countDatas', //首页-房办月查-物业双周查-经理自查
//角色管理 //角色管理
......
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